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

@@ -74,7 +74,7 @@ jobs:
rm -f /*.h
rm ./hiddify-libcore*sources* ||echo "no source"
rm ./hiddify-libcore-macos-a*.dylib || echo "no macos arm and amd"
files=$(ls | grep -E '^(libcore\.(dll|so|dylib|aar)|Libcore.xcframework|hiddify-service(\.exe)?)$')
files=$(ls | grep -E '^(libcore\.(dll|so|dylib|aar)|Libcore.xcframework|HiddifyService(\.exe)?)$')
echo tar -czvf hiddify-core-${{ matrix.job.target }}.tar.gz $files
tar -czvf hiddify-core-${{ matrix.job.target }}.tar.gz $files

View File

@@ -2,7 +2,7 @@ PRODUCT_NAME=libcore
BASENAME=$(PRODUCT_NAME)
BINDIR=bin
LIBNAME=$(PRODUCT_NAME)
SRVNAME=hiddify-service
SRVNAME=HiddifyService
BRANCH=$(shell git branch --show-current)
VERSION=$(shell git describe --tags || echo "unknown version")
@@ -35,6 +35,7 @@ ios: lib_install
windows-amd64:
curl http://localhost:18020/exit || echo "exited"
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILDLIB) -o $(BINDIR)/$(LIBNAME).dll ./custom
go get github.com/akavel/rsrc
go install github.com/akavel/rsrc

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 {

View File

@@ -3,7 +3,16 @@ set GOOS=windows
set GOARCH=amd64
set CC=x86_64-w64-mingw32-gcc
set CGO_ENABLED=1
curl http://localhost:18020/exit || echo "Exited"
del bin\libcore.dll bin\HiddifyService.exe
set CGO_LDFLAGS=
go build -trimpath -tags with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc -ldflags="-w -s" -buildmode=c-shared -o bin/libcore.dll ./custom
go get github.com/akavel/rsrc
go install github.com/akavel/rsrc
rsrc -manifest admin_service\cmd\admin_service.manifest -ico ..\assets\images\tray_icon_connected.ico -o admin_service\cmd\admin_service.syso
go build -o bin/hiddify-service.exe ./admin_service/cmd/
copy bin\libcore.dll .
set CGO_LDFLAGS="libcore.dll"
go build -o bin/HiddifyService.exe ./admin_service/cmd/
del libcore.dll