release: version 1.1.0

This commit is contained in:
Hiddify
2024-03-19 17:07:11 +01:00
parent c55c696c05
commit c609030b92
6 changed files with 463 additions and 463 deletions

View File

@@ -1,10 +1,10 @@
package main package main
import "C" import "C"
import v2 "github.com/hiddify/libcore/v2" import v2 "github.com/hiddify/libcore/v2"
//export StartCoreGrpcServer //export StartCoreGrpcServer
func StartCoreGrpcServer(listenAddress *C.char) (CErr *C.char) { func StartCoreGrpcServer(listenAddress *C.char) (CErr *C.char) {
err := v2.StartCoreGrpcServer(C.GoString(listenAddress)) err := v2.StartCoreGrpcServer(C.GoString(listenAddress))
return emptyOrErrorC(err) return emptyOrErrorC(err)
} }

View File

@@ -1,14 +1,14 @@
version: '3.8' version: '3.8'
services: services:
hiddify: hiddify:
image: ghcr.io/hiddify/hiddify-next-core/cli:latest image: ghcr.io/hiddify/hiddify-next-core/cli:latest
ports: ports:
- "2334:2334" - "2334:2334"
- "6756:6756" - "6756:6756"
- "6450:6450" - "6450:6450"
environment: environment:
CONFIG: "https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp#WARP%20(IRCF)" CONFIG: "https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp#WARP%20(IRCF)"
volumes: volumes:
- ./data/:/hiddify/data/ - ./data/:/hiddify/data/
command: ["/opt/hiddify.sh"] command: ["/opt/hiddify.sh"]

View File

@@ -1,41 +1,41 @@
{ {
"service-mode": "proxy", "service-mode": "proxy",
"log-level": "info", "log-level": "info",
"resolve-destination": true, "resolve-destination": true,
"ipv6-mode": "prefer_ipv4", "ipv6-mode": "prefer_ipv4",
"remote-dns-address": "tcp://1.1.1.1", "remote-dns-address": "tcp://1.1.1.1",
"remote-dns-domain-strategy": "", "remote-dns-domain-strategy": "",
"direct-dns-address": "1.1.1.1", "direct-dns-address": "1.1.1.1",
"direct-dns-domain-strategy": "", "direct-dns-domain-strategy": "",
"mixed-port": 2334, "mixed-port": 2334,
"local-dns-port": 6450, "local-dns-port": 6450,
"tun-implementation": "mixed", "tun-implementation": "mixed",
"mtu": 9000, "mtu": 9000,
"strict-route": false, "strict-route": false,
"connection-test-url": "https://www.gstatic.com/generate_204", "connection-test-url": "https://www.gstatic.com/generate_204",
"url-test-interval": 600, "url-test-interval": 600,
"enable-clash-api": true, "enable-clash-api": true,
"clash-api-port": 6756, "clash-api-port": 6756,
"bypass-lan": false, "bypass-lan": false,
"allow-connection-from-lan": true, "allow-connection-from-lan": true,
"enable-fake-dns": false, "enable-fake-dns": false,
"enable-dns-routing": true, "enable-dns-routing": true,
"independent-dns-cache": true, "independent-dns-cache": true,
"enable-tls-fragment": false, "enable-tls-fragment": false,
"tls-fragment-size": "20-70", "tls-fragment-size": "20-70",
"tls-fragment-sleep": "10-30", "tls-fragment-sleep": "10-30",
"enable-tls-mixed-sni-case": false, "enable-tls-mixed-sni-case": false,
"enable-tls-padding": false, "enable-tls-padding": false,
"tls-padding-size": "15-30", "tls-padding-size": "15-30",
"enable-mux": false, "enable-mux": false,
"mux-padding": false, "mux-padding": false,
"mux-max-streams": 4, "mux-max-streams": 4,
"mux-protocol": "h2mux", "mux-protocol": "h2mux",
"enable-warp": false, "enable-warp": false,
"warp-detour-mode": "outbound", "warp-detour-mode": "outbound",
"warp-license-key": "", "warp-license-key": "",
"warp-clean-ip": "auto", "warp-clean-ip": "auto",
"warp-port": 0, "warp-port": 0,
"warp-noise": "5-10", "warp-noise": "5-10",
"warp-noise-delay": "20-200" "warp-noise-delay": "20-200"
} }

View File

@@ -1,236 +1,236 @@
package v2 package v2
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"os" "os"
"os/signal" "os/signal"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
"syscall" "syscall"
"time" "time"
"github.com/hiddify/libcore/config" "github.com/hiddify/libcore/config"
pb "github.com/hiddify/libcore/hiddifyrpc" pb "github.com/hiddify/libcore/hiddifyrpc"
"github.com/sagernet/sing-box/option" "github.com/sagernet/sing-box/option"
) )
func RunStandalone(hiddifySettingPath string, configPath string) error { func RunStandalone(hiddifySettingPath string, configPath string) error {
fmt.Println("Running in standalone mode") fmt.Println("Running in standalone mode")
useFlutterBridge = false useFlutterBridge = false
current, err := readAndBuildConfig(hiddifySettingPath, configPath) current, err := readAndBuildConfig(hiddifySettingPath, configPath)
if err != nil { if err != nil {
fmt.Printf("Error in read and build config %v", err) fmt.Printf("Error in read and build config %v", err)
return err return err
} }
go StartService(&pb.StartRequest{ go StartService(&pb.StartRequest{
ConfigContent: current.Config, ConfigContent: current.Config,
EnableOldCommandServer: false, EnableOldCommandServer: false,
DelayStart: false, DelayStart: false,
EnableRawConfig: true, EnableRawConfig: true,
}) })
go updateConfigInterval(current, hiddifySettingPath, configPath) go updateConfigInterval(current, hiddifySettingPath, configPath)
sigChan := make(chan os.Signal, 1) sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
fmt.Printf("Waiting for CTRL+C to stop\n") fmt.Printf("Waiting for CTRL+C to stop\n")
<-sigChan <-sigChan
fmt.Printf("CTRL+C recived-->stopping\n") fmt.Printf("CTRL+C recived-->stopping\n")
_, err = Stop() _, err = Stop()
return err return err
} }
type ConfigResult struct { type ConfigResult struct {
Config string Config string
RefreshInterval int RefreshInterval int
} }
func readAndBuildConfig(hiddifySettingPath string, configPath string) (ConfigResult, error) { func readAndBuildConfig(hiddifySettingPath string, configPath string) (ConfigResult, error) {
var result ConfigResult var result ConfigResult
result, err := readConfigContent(configPath) result, err := readConfigContent(configPath)
if err != nil { if err != nil {
return result, err return result, err
} }
hiddifyconfig := config.DefaultConfigOptions() hiddifyconfig := config.DefaultConfigOptions()
if hiddifySettingPath != "" { if hiddifySettingPath != "" {
hiddifyconfig, err = readConfigOptionsAt(hiddifySettingPath) hiddifyconfig, err = readConfigOptionsAt(hiddifySettingPath)
if err != nil { if err != nil {
return result, err return result, err
} }
} }
configOptions = hiddifyconfig configOptions = hiddifyconfig
result.Config, err = buildConfig(result.Config, *hiddifyconfig) result.Config, err = buildConfig(result.Config, *hiddifyconfig)
if err != nil { if err != nil {
return result, err return result, err
} }
return result, nil return result, nil
} }
func readConfigContent(configPath string) (ConfigResult, error) { func readConfigContent(configPath string) (ConfigResult, error) {
var content string var content string
var refreshInterval int var refreshInterval int
if strings.HasPrefix(configPath, "http://") || strings.HasPrefix(configPath, "https://") { if strings.HasPrefix(configPath, "http://") || strings.HasPrefix(configPath, "https://") {
client := &http.Client{} client := &http.Client{}
// Create a new request // Create a new request
req, err := http.NewRequest("GET", configPath, nil) req, err := http.NewRequest("GET", configPath, nil)
if err != nil { if err != nil {
fmt.Println("Error creating request:", err) fmt.Println("Error creating request:", err)
return ConfigResult{}, err return ConfigResult{}, err
} }
req.Header.Set("User-Agent", "HiddifyNext/17.5.0 ("+runtime.GOOS+") like ClashMeta v2ray sing-box") req.Header.Set("User-Agent", "HiddifyNext/17.5.0 ("+runtime.GOOS+") like ClashMeta v2ray sing-box")
resp, err := client.Do(req) resp, err := client.Do(req)
if err != nil { if err != nil {
fmt.Println("Error making GET request:", err) fmt.Println("Error making GET request:", err)
return ConfigResult{}, err return ConfigResult{}, err
} }
defer resp.Body.Close() defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
return ConfigResult{}, fmt.Errorf("failed to read config body: %w", err) return ConfigResult{}, fmt.Errorf("failed to read config body: %w", err)
} }
content = string(body) content = string(body)
refreshInterval, _ = extractRefreshInterval(resp.Header, content) refreshInterval, _ = extractRefreshInterval(resp.Header, content)
fmt.Printf("Refresh interval: %d\n", refreshInterval) fmt.Printf("Refresh interval: %d\n", refreshInterval)
} else { } else {
data, err := ioutil.ReadFile(configPath) data, err := ioutil.ReadFile(configPath)
if err != nil { if err != nil {
return ConfigResult{}, fmt.Errorf("failed to read config file: %w", err) return ConfigResult{}, fmt.Errorf("failed to read config file: %w", err)
} }
content = string(data) content = string(data)
} }
return ConfigResult{ return ConfigResult{
Config: content, Config: content,
RefreshInterval: refreshInterval, RefreshInterval: refreshInterval,
}, nil }, nil
} }
func extractRefreshInterval(header http.Header, bodyStr string) (int, error) { func extractRefreshInterval(header http.Header, bodyStr string) (int, error) {
refreshIntervalStr := header.Get("profile-update-interval") refreshIntervalStr := header.Get("profile-update-interval")
if refreshIntervalStr != "" { if refreshIntervalStr != "" {
refreshInterval, err := strconv.Atoi(refreshIntervalStr) refreshInterval, err := strconv.Atoi(refreshIntervalStr)
if err != nil { if err != nil {
return 0, fmt.Errorf("failed to parse refresh interval from header: %w", err) return 0, fmt.Errorf("failed to parse refresh interval from header: %w", err)
} }
return refreshInterval, nil return refreshInterval, nil
} }
lines := strings.Split(bodyStr, "\n") lines := strings.Split(bodyStr, "\n")
for _, line := range lines { for _, line := range lines {
line = strings.TrimSpace(line) line = strings.TrimSpace(line)
if strings.HasPrefix(line, "//profile-update-interval:") || strings.HasPrefix(line, "#profile-update-interval:") { if strings.HasPrefix(line, "//profile-update-interval:") || strings.HasPrefix(line, "#profile-update-interval:") {
parts := strings.SplitN(line, ":", 2) parts := strings.SplitN(line, ":", 2)
str := strings.TrimSpace(parts[1]) str := strings.TrimSpace(parts[1])
refreshInterval, err := strconv.Atoi(str) refreshInterval, err := strconv.Atoi(str)
if err != nil { if err != nil {
return 0, fmt.Errorf("failed to parse refresh interval from body: %w", err) return 0, fmt.Errorf("failed to parse refresh interval from body: %w", err)
} }
return refreshInterval, nil return refreshInterval, nil
} }
} }
return 0, nil return 0, nil
} }
func buildConfig(configContent string, options config.ConfigOptions) (string, error) { func buildConfig(configContent string, options config.ConfigOptions) (string, error) {
parsedContent, err := config.ParseConfigContent(configContent, true) parsedContent, err := config.ParseConfigContent(configContent, true)
if err != nil { if err != nil {
return "", fmt.Errorf("failed to parse config content: %w", err) return "", fmt.Errorf("failed to parse config content: %w", err)
} }
singconfigs, err := readConfigBytes([]byte(parsedContent)) singconfigs, err := readConfigBytes([]byte(parsedContent))
if err != nil { if err != nil {
return "", err return "", err
} }
finalconfig, err := config.BuildConfig(options, *singconfigs) finalconfig, err := config.BuildConfig(options, *singconfigs)
if err != nil { if err != nil {
return "", fmt.Errorf("failed to build config: %w", err) return "", fmt.Errorf("failed to build config: %w", err)
} }
finalconfig.Log.Output = "" finalconfig.Log.Output = ""
finalconfig.Experimental.ClashAPI.ExternalUI = "webui" finalconfig.Experimental.ClashAPI.ExternalUI = "webui"
if options.AllowConnectionFromLAN { if options.AllowConnectionFromLAN {
finalconfig.Experimental.ClashAPI.ExternalController = "0.0.0.0:6756" finalconfig.Experimental.ClashAPI.ExternalController = "0.0.0.0:6756"
} else { } else {
finalconfig.Experimental.ClashAPI.ExternalController = "127.0.0.1:6756" finalconfig.Experimental.ClashAPI.ExternalController = "127.0.0.1:6756"
} }
fmt.Printf("Open http://localhost:6756/ui/?secret=%s in your browser\n", finalconfig.Experimental.ClashAPI.Secret) fmt.Printf("Open http://localhost:6756/ui/?secret=%s in your browser\n", finalconfig.Experimental.ClashAPI.Secret)
if err := Setup("./", "./", "./tmp", 0, false); err != nil { if err := Setup("./", "./", "./tmp", 0, false); err != nil {
return "", fmt.Errorf("failed to set up global configuration: %w", err) return "", fmt.Errorf("failed to set up global configuration: %w", err)
} }
configStr, err := config.ToJson(*finalconfig) configStr, err := config.ToJson(*finalconfig)
if err != nil { if err != nil {
return "", fmt.Errorf("failed to convert config to JSON: %w", err) return "", fmt.Errorf("failed to convert config to JSON: %w", err)
} }
return configStr, nil return configStr, nil
} }
func updateConfigInterval(current ConfigResult, hiddifySettingPath string, configPath string) { func updateConfigInterval(current ConfigResult, hiddifySettingPath string, configPath string) {
if current.RefreshInterval <= 0 { if current.RefreshInterval <= 0 {
return return
} }
for { for {
<-time.After(time.Duration(current.RefreshInterval) * time.Hour) <-time.After(time.Duration(current.RefreshInterval) * time.Hour)
new, err := readAndBuildConfig(hiddifySettingPath, configPath) new, err := readAndBuildConfig(hiddifySettingPath, configPath)
if err != nil { if err != nil {
continue continue
} }
if new.Config != current.Config { if new.Config != current.Config {
go Stop() go Stop()
go StartService(&pb.StartRequest{ go StartService(&pb.StartRequest{
ConfigContent: new.Config, ConfigContent: new.Config,
DelayStart: false, DelayStart: false,
EnableOldCommandServer: false, EnableOldCommandServer: false,
DisableMemoryLimit: false, DisableMemoryLimit: false,
EnableRawConfig: true, EnableRawConfig: true,
}) })
} }
current = new current = new
} }
} }
func readConfigBytes(content []byte) (*option.Options, error) { func readConfigBytes(content []byte) (*option.Options, error) {
var options option.Options var options option.Options
err := options.UnmarshalJSON(content) err := options.UnmarshalJSON(content)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &options, nil return &options, nil
} }
func readConfigOptionsAt(path string) (*config.ConfigOptions, error) { func readConfigOptionsAt(path string) (*config.ConfigOptions, error) {
content, err := os.ReadFile(path) content, err := os.ReadFile(path)
if err != nil { if err != nil {
return nil, err return nil, err
} }
var options config.ConfigOptions var options config.ConfigOptions
err = json.Unmarshal(content, &options) err = json.Unmarshal(content, &options)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if options.Warp.WireguardConfigStr != "" { if options.Warp.WireguardConfigStr != "" {
err := json.Unmarshal([]byte(options.Warp.WireguardConfigStr), &options.Warp.WireguardConfig) err := json.Unmarshal([]byte(options.Warp.WireguardConfigStr), &options.Warp.WireguardConfig)
if err != nil { if err != nil {
return nil, err return nil, err
} }
} }
return &options, nil return &options, nil
} }

View File

@@ -1,44 +1,44 @@
package v2 package v2
import ( import (
"context" "context"
pb "github.com/hiddify/libcore/hiddifyrpc" pb "github.com/hiddify/libcore/hiddifyrpc"
"github.com/sagernet/sing-box/experimental/libbox" "github.com/sagernet/sing-box/experimental/libbox"
) )
func (s *CoreService) GetSystemProxyStatus(ctx context.Context, empty *pb.Empty) (*pb.SystemProxyStatus, error) { func (s *CoreService) GetSystemProxyStatus(ctx context.Context, empty *pb.Empty) (*pb.SystemProxyStatus, error) {
return GetSystemProxyStatus(ctx, empty) return GetSystemProxyStatus(ctx, empty)
} }
func GetSystemProxyStatus(ctx context.Context, empty *pb.Empty) (*pb.SystemProxyStatus, error) { func GetSystemProxyStatus(ctx context.Context, empty *pb.Empty) (*pb.SystemProxyStatus, error) {
status, err := libbox.NewStandaloneCommandClient().GetSystemProxyStatus() status, err := libbox.NewStandaloneCommandClient().GetSystemProxyStatus()
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &pb.SystemProxyStatus{ return &pb.SystemProxyStatus{
Available: status.Available, Available: status.Available,
Enabled: status.Enabled, Enabled: status.Enabled,
}, nil }, nil
} }
func (s *CoreService) SetSystemProxyEnabled(ctx context.Context, in *pb.SetSystemProxyEnabledRequest) (*pb.Response, error) { func (s *CoreService) SetSystemProxyEnabled(ctx context.Context, in *pb.SetSystemProxyEnabledRequest) (*pb.Response, error) {
return SetSystemProxyEnabled(ctx, in) return SetSystemProxyEnabled(ctx, in)
} }
func SetSystemProxyEnabled(ctx context.Context, in *pb.SetSystemProxyEnabledRequest) (*pb.Response, error) { func SetSystemProxyEnabled(ctx context.Context, in *pb.SetSystemProxyEnabledRequest) (*pb.Response, error) {
err := libbox.NewStandaloneCommandClient().SetSystemProxyEnabled(in.IsEnabled) err := libbox.NewStandaloneCommandClient().SetSystemProxyEnabled(in.IsEnabled)
if err != nil { if err != nil {
return &pb.Response{ return &pb.Response{
ResponseCode: pb.ResponseCode_FAILED, ResponseCode: pb.ResponseCode_FAILED,
Message: err.Error(), Message: err.Error(),
}, err }, err
} }
return &pb.Response{ return &pb.Response{
ResponseCode: pb.ResponseCode_OK, ResponseCode: pb.ResponseCode_OK,
Message: "", Message: "",
}, nil }, nil
} }

View File

@@ -1,119 +1,119 @@
package v2 package v2
import ( import (
"context" "context"
"fmt" "fmt"
"log" "log"
"os" "os"
pb "github.com/hiddify/libcore/hiddifyrpc" pb "github.com/hiddify/libcore/hiddifyrpc"
) )
func (s *TunnelService) Start(ctx context.Context, in *pb.TunnelStartRequest) (*pb.TunnelResponse, error) { func (s *TunnelService) Start(ctx context.Context, in *pb.TunnelStartRequest) (*pb.TunnelResponse, error) {
if in.ServerPort == 0 { if in.ServerPort == 0 {
in.ServerPort = 2334 in.ServerPort = 2334
} }
useFlutterBridge = false useFlutterBridge = false
res, err := Start(&pb.StartRequest{ res, err := Start(&pb.StartRequest{
ConfigContent: makeTunnelConfig(in.Ipv6, in.ServerPort, in.StrictRoute, in.EndpointIndependentNat, in.Stack), ConfigContent: makeTunnelConfig(in.Ipv6, in.ServerPort, in.StrictRoute, in.EndpointIndependentNat, in.Stack),
EnableOldCommandServer: false, EnableOldCommandServer: false,
DisableMemoryLimit: false, DisableMemoryLimit: false,
EnableRawConfig: true, EnableRawConfig: true,
}) })
fmt.Printf("Start Result: %+v\n", res) fmt.Printf("Start Result: %+v\n", res)
if err != nil { if err != nil {
return &pb.TunnelResponse{ return &pb.TunnelResponse{
Message: err.Error(), Message: err.Error(),
}, err }, err
} }
return &pb.TunnelResponse{ return &pb.TunnelResponse{
Message: "OK", Message: "OK",
}, err }, err
} }
func makeTunnelConfig(Ipv6 bool, ServerPort int32, StrictRoute bool, EndpointIndependentNat bool, Stack string) string { func makeTunnelConfig(Ipv6 bool, ServerPort int32, StrictRoute bool, EndpointIndependentNat bool, Stack string) string {
var ipv6 string var ipv6 string
if Ipv6 { if Ipv6 {
ipv6 = ` "inet6_address": "fdfe:dcba:9876::1/126",` ipv6 = ` "inet6_address": "fdfe:dcba:9876::1/126",`
} else { } else {
ipv6 = "" ipv6 = ""
} }
base := `{ base := `{
"inbounds": [ "inbounds": [
{ {
"type": "tun", "type": "tun",
"tag": "tun-in", "tag": "tun-in",
"interface_name": "HiddifyTunnel", "interface_name": "HiddifyTunnel",
"inet4_address": "172.19.0.1/30", "inet4_address": "172.19.0.1/30",
` + ipv6 + ` ` + ipv6 + `
"mtu": 9000, "mtu": 9000,
"auto_route": true, "auto_route": true,
"strict_route": ` + fmt.Sprintf("%t", StrictRoute) + `, "strict_route": ` + fmt.Sprintf("%t", StrictRoute) + `,
"endpoint_independent_nat": ` + fmt.Sprintf("%t", EndpointIndependentNat) + `, "endpoint_independent_nat": ` + fmt.Sprintf("%t", EndpointIndependentNat) + `,
"stack": "` + Stack + `" "stack": "` + Stack + `"
} }
], ],
"outbounds": [ "outbounds": [
{ {
"type": "socks", "type": "socks",
"tag": "socks-out", "tag": "socks-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": ` + fmt.Sprintf("%d", ServerPort) + `, "server_port": ` + fmt.Sprintf("%d", ServerPort) + `,
"version": "5" "version": "5"
}, },
{ {
"type": "direct", "type": "direct",
"tag": "direct-out" "tag": "direct-out"
} }
], ],
"route": { "route": {
"rules": [ "rules": [
{ {
"process_name":"Hiddify.exe", "process_name":"Hiddify.exe",
"outbound": "direct-out" "outbound": "direct-out"
}, },
{ {
"process_name":"Hiddify", "process_name":"Hiddify",
"outbound": "direct-out" "outbound": "direct-out"
}, },
{ {
"process_name":"HiddifyCli", "process_name":"HiddifyCli",
"outbound": "direct-out" "outbound": "direct-out"
}, },
{ {
"process_name":"HiddifyCli.exe", "process_name":"HiddifyCli.exe",
"outbound": "direct-out" "outbound": "direct-out"
} }
] ]
} }
}` }`
return base return base
} }
func (s *TunnelService) Stop(ctx context.Context, _ *pb.Empty) (*pb.TunnelResponse, error) { func (s *TunnelService) Stop(ctx context.Context, _ *pb.Empty) (*pb.TunnelResponse, error) {
res, err := Stop() res, err := Stop()
log.Printf("Stop Result: %+v\n", res) log.Printf("Stop Result: %+v\n", res)
if err != nil { if err != nil {
return &pb.TunnelResponse{ return &pb.TunnelResponse{
Message: err.Error(), Message: err.Error(),
}, err }, err
} }
return &pb.TunnelResponse{ return &pb.TunnelResponse{
Message: "OK", Message: "OK",
}, err }, err
} }
func (s *TunnelService) Status(ctx context.Context, _ *pb.Empty) (*pb.TunnelResponse, error) { func (s *TunnelService) Status(ctx context.Context, _ *pb.Empty) (*pb.TunnelResponse, error) {
return &pb.TunnelResponse{ return &pb.TunnelResponse{
Message: "Not Implemented", Message: "Not Implemented",
}, nil }, nil
} }
func (s *TunnelService) Exit(ctx context.Context, _ *pb.Empty) (*pb.TunnelResponse, error) { func (s *TunnelService) Exit(ctx context.Context, _ *pb.Empty) (*pb.TunnelResponse, error) {
Stop() Stop()
os.Exit(0) os.Exit(0)
return &pb.TunnelResponse{ return &pb.TunnelResponse{
Message: "OK", Message: "OK",
}, nil }, nil
} }