new: add vpn service mode as seperated option, fix crash of wireguard in wireguard and more stable wireguard

This commit is contained in:
Hiddify
2024-02-14 15:49:47 +01:00
parent 43d9ef9bbd
commit 3111671d6e
7 changed files with 76 additions and 70 deletions

View File

@@ -3,6 +3,7 @@ package config
import (
"fmt"
"io"
"time"
"net/http"
"net/url"
@@ -96,9 +97,12 @@ func runTunnelService(opt ConfigOptions) (bool, error) {
out, err := ExecuteCmd(executablePath, "install", false)
fmt.Println("Shell command executed:", out, err)
if err != nil {
out, err := ExecuteCmd(executablePath, "", true)
out, err = ExecuteCmd(executablePath, "", true)
fmt.Println("Shell command executed without flag:", out, err)
}
if err == nil {
<-time.After(1 * time.Second) //wait until service loaded completely
}
return startTunnelRequest(opt, false)
}