chg: Change name of service to HiddifyService
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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, "")
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user