new: add cli interface with basic webui
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<!-- <assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="*"
|
||||
name="HiddifyService.exe"
|
||||
type="win32"
|
||||
/> -->
|
||||
<description>Hiddify Tunnel Service</description>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
@@ -1,50 +0,0 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Import the function from the DLL
|
||||
char* AdminServiceStart(const char* arg);
|
||||
|
||||
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func main() {
|
||||
args := os.Args
|
||||
if len(args) < 2 {
|
||||
fmt.Println("Usage: HiddifyService.exe empty/start/stop/uninstall/install")
|
||||
args = append(args, "")
|
||||
}
|
||||
|
||||
arg := C.CString(args[1])
|
||||
defer C.free(unsafe.Pointer(arg))
|
||||
|
||||
result := C.AdminServiceStart(arg)
|
||||
defer C.free(unsafe.Pointer(result))
|
||||
|
||||
goRes := C.GoString(result)
|
||||
|
||||
parts := strings.SplitN(goRes, " ", 2)
|
||||
|
||||
var parsedExitCode int
|
||||
_, err := fmt.Sscanf(parts[0], "%d", &parsedExitCode)
|
||||
parsedOutMessage := parts[1]
|
||||
if err != nil {
|
||||
fmt.Println("Error parsing the string:", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("%d %s", parsedExitCode, parsedOutMessage)
|
||||
|
||||
if parsedExitCode != 0 {
|
||||
os.Exit(parsedExitCode)
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ func StartService(goArg string) (int, string) {
|
||||
svcConfig := &service.Config{
|
||||
Name: "HiddifyTunnelService",
|
||||
DisplayName: "Hiddify Tunnel Service",
|
||||
Arguments: []string{"tunnel", "run"},
|
||||
Description: "This is a bridge for tunnel",
|
||||
Option: map[string]interface{}{
|
||||
"RunAtLoad": true,
|
||||
|
||||
Reference in New Issue
Block a user