chg: Change name of service to HiddifyService

This commit is contained in:
Hiddify
2024-02-03 15:55:59 +01:00
parent e53c65fa18
commit fd782bf7e8
6 changed files with 22 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
<!-- <assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="hiddify-service.exe"
name="HiddifyService.exe"
type="win32"
/> -->
<description>Hiddify Tunnel Service</description>

View File

@@ -20,7 +20,7 @@ import (
func main() {
args := os.Args
if len(args) < 2 {
fmt.Println("Usage: hiddify-service.exe empty/start/stop/uninstall/install")
fmt.Println("Usage: HiddifyService.exe empty/start/stop/uninstall/install")
args = append(args, "")
}

View File

@@ -4,6 +4,7 @@ import (
"crypto/tls"
"fmt"
"net/http"
"os"
"strconv"
"github.com/hiddify/libcore/global"
@@ -20,6 +21,7 @@ const (
func StartWebServer(Port int, TLS bool) {
http.HandleFunc("/start", startHandler)
http.HandleFunc("/stop", StopHandler)
http.HandleFunc("/exit", ExitHandler)
server := &http.Server{
Addr: "127.0.0.1:" + fmt.Sprintf("%d", Port),
}
@@ -91,6 +93,11 @@ func StopHandler(w http.ResponseWriter, r *http.Request) {
}
http.Error(w, fmt.Sprintf("Ok"), http.StatusOK)
}
func ExitHandler(w http.ResponseWriter, r *http.Request) {
global.StopServiceC()
os.Exit(0)
http.Error(w, fmt.Sprintf("Ok"), http.StatusOK)
}
func GetStack(stack string) global.Stack {
switch stack {