From 946f0878ff218d47b13da9a45cc7a13be10b4f77 Mon Sep 17 00:00:00 2001 From: Hiddify <114227601+hiddify-com@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:36:31 +0200 Subject: [PATCH] new: ignore utls if no fp is in the url, fix instance not stoped --- config/config.go | 605 +++++++++++++++++++++++------------------------ go.mod | 6 +- go.sum | 6 +- v2/custom.go | 9 +- 4 files changed, 310 insertions(+), 316 deletions(-) diff --git a/config/config.go b/config/config.go index 5ba03e2..99ecd1b 100644 --- a/config/config.go +++ b/config/config.go @@ -68,7 +68,6 @@ func BuildConfig(opt ConfigOptions, input option.Options) (*option.Options, erro options.Route = input.Route } directDNSDomains := make(map[string]bool) - dnsRules := []option.DefaultDNSRule{} var bind string if opt.AllowConnectionFromLAN { @@ -236,313 +235,8 @@ func BuildConfig(opt ConfigOptions, input option.Options) (*option.Options, erro directDNSDomains["full:"+parsedUrl.Host] = true //TODO: IS it really needed } - - routeRules := []option.Rule{ - { - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - Inbound: []string{InboundDNSTag}, - Outbound: OutboundDNSTag, - }, - }, - { - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - Port: []uint16{53}, - Outbound: OutboundDNSTag, - }, - }, - { - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - ClashMode: "Direct", - Outbound: OutboundDirectTag, - }, - }, - { - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - ClashMode: "Global", - Outbound: OutboundMainProxyTag, - }, - }, - } - if opt.EnableTun { - routeRules = append( - routeRules, - option.Rule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - ProcessName: []string{"Hiddify", "Hiddify.exe", "HiddifyCli", "HiddifyCli.exe"}, - Outbound: OutboundBypassTag, - }, - }, - ) - } - if opt.BypassLAN { - routeRules = append( - routeRules, - option.Rule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - GeoIP: []string{"private"}, - Outbound: OutboundBypassTag, - }, - }, - ) - } - - if opt.EnableFakeDNS { - inet4Range := netip.MustParsePrefix("198.18.0.0/15") - inet6Range := netip.MustParsePrefix("fc00::/18") - options.DNS.FakeIP = &option.DNSFakeIPOptions{ - Enabled: true, - Inet4Range: &inet4Range, - Inet6Range: &inet6Range, - } - options.DNS.Servers = append( - options.DNS.Servers, - option.DNSServerOptions{ - Tag: DNSFakeTag, - Address: "fakeip", - Strategy: option.DomainStrategy(dns.DomainStrategyUseIPv4), - }, - ) - options.DNS.Rules = append( - options.DNS.Rules, - option.DNSRule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultDNSRule{ - Inbound: []string{InboundTUNTag}, - Server: DNSFakeTag, - DisableCache: true, - }, - }, - ) - - } - - for _, rule := range opt.Rules { - routeRule := rule.MakeRule() - switch rule.Outbound { - case "bypass": - routeRule.Outbound = OutboundBypassTag - case "block": - routeRule.Outbound = OutboundBlockTag - case "proxy": - routeRule.Outbound = OutboundDNSTag - } - - if routeRule.IsValid() { - routeRules = append( - routeRules, - option.Rule{ - Type: C.RuleTypeDefault, - DefaultOptions: routeRule, - }, - ) - } - - dnsRule := rule.MakeDNSRule() - switch rule.Outbound { - case "bypass": - dnsRule.Server = DNSDirectTag - case "block": - dnsRule.Server = DNSBlockTag - dnsRule.DisableCache = true - case "proxy": - if opt.EnableFakeDNS { - fakeDnsRule := dnsRule - fakeDnsRule.Server = DNSFakeTag - fakeDnsRule.Inbound = []string{InboundTUNTag} - dnsRules = append(dnsRules, fakeDnsRule) - } - dnsRule.Server = DNSRemoteTag - } - dnsRules = append(dnsRules, dnsRule) - } - - if opt.EnableDNSRouting { - for _, dnsRule := range dnsRules { - if dnsRule.IsValid() { - options.DNS.Rules = append( - options.DNS.Rules, - option.DNSRule{ - Type: C.RuleTypeDefault, - DefaultOptions: dnsRule, - }, - ) - } - } - } - if options.DNS.Rules == nil { - options.DNS.Rules = []option.DNSRule{} - } - var dnsCPttl uint32 = 3000 - parsedURL, err := url.Parse(opt.ConnectionTestUrl) - if err == nil { - options.DNS.Rules = append( - options.DNS.Rules, - option.DNSRule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultDNSRule{ - Domain: []string{parsedURL.Host}, - Server: DNSRemoteTag, - RewriteTTL: &dnsCPttl, - DisableCache: false, - }, - }, - ) - } - - options.Route = &option.RouteOptions{ - Rules: routeRules, - AutoDetectInterface: true, - OverrideAndroidVPN: true, - // RuleSet: []option.RuleSet{}, - // GeoIP: &option.GeoIPOptions{ - // Path: opt.GeoIPPath, - // }, - // Geosite: &option.GeositeOptions{ - // Path: opt.GeoSitePath, - // }, - } - if opt.Region != "other" { - options.DNS.Rules = append( - options.DNS.Rules, - option.DNSRule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultDNSRule{ - RuleSet: []string{ - "geoip-" + opt.Region, - "geosite-" + opt.Region, - }, - Server: DNSDirectTag, - }, - }, - ) - options.DNS.Rules = append( - options.DNS.Rules, - option.DNSRule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultDNSRule{ - DomainSuffix: []string{"." + opt.Region}, - Server: DNSDirectTag, - }, - }, - ) - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geoip-" + opt.Region, - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", - - UpdateInterval: option.Duration(5 * time.Hour * 24), - }, - }) - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geosite-" + opt.Region, - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", - UpdateInterval: option.Duration(5 * time.Hour * 24), - }, - }) - - routeRuleIp := option.Rule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - RuleSet: []string{ - "geoip-" + opt.Region, - "geosite-" + opt.Region, - }, - Outbound: OutboundDirectTag, - }, - } - options.Route.Rules = append([]option.Rule{routeRuleIp}, options.Route.Rules...) - routeRuleLocalDomain := option.Rule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - DomainSuffix: []string{"." + opt.Region}, - Outbound: OutboundDirectTag, - }, - } - options.Route.Rules = append([]option.Rule{routeRuleLocalDomain}, options.Route.Rules...) - } - if opt.BlockAds { - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geosite-ads", - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", - UpdateInterval: option.Duration(5 * time.Hour * 24), - }, - }) - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geosite-malware", - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", - UpdateInterval: option.Duration(5 * time.Hour * 24), - }, - }) - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geosite-phishing", - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", - UpdateInterval: option.Duration(5 * time.Hour * 24), - }, - }) - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geosite-cryptominers", - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", - UpdateInterval: option.Duration(5 * time.Hour * 24), - }, - }) - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geoip-phishing", - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", - UpdateInterval: option.Duration(5 * time.Hour * 24), - }, - }) - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geoip-malware", - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", - UpdateInterval: option.Duration(5 * time.Hour * 24), - }, - }) - - routeRule := option.Rule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - RuleSet: []string{ - "geosite-ads", - "geosite-malware", - "geosite-phishing", - "geosite-cryptominers", - "geoip-malware", - "geoip-phishing", - }, - Outbound: OutboundBlockTag, - }, - } - options.Route.Rules = append([]option.Rule{routeRule}, options.Route.Rules...) - } + setRoutingOptions(&options, &opt) + setFakeDns(&options, &opt) var outbounds []option.Outbound var tags []string OutboundMainProxyTag = OutboundSelectTag @@ -710,6 +404,301 @@ func BuildConfig(opt ConfigOptions, input option.Options) (*option.Options, erro return &options, nil } +func setFakeDns(options *option.Options, opt *ConfigOptions) { + if opt.EnableFakeDNS { + inet4Range := netip.MustParsePrefix("198.18.0.0/15") + inet6Range := netip.MustParsePrefix("fc00::/18") + options.DNS.FakeIP = &option.DNSFakeIPOptions{ + Enabled: true, + Inet4Range: &inet4Range, + Inet6Range: &inet6Range, + } + options.DNS.Servers = append( + options.DNS.Servers, + option.DNSServerOptions{ + Tag: DNSFakeTag, + Address: "fakeip", + Strategy: option.DomainStrategy(dns.DomainStrategyUseIPv4), + }, + ) + options.DNS.Rules = append( + options.DNS.Rules, + option.DNSRule{ + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultDNSRule{ + Inbound: []string{InboundTUNTag}, + Server: DNSFakeTag, + DisableCache: true, + }, + }, + ) + + } +} + +func setRoutingOptions(options *option.Options, opt *ConfigOptions) { + dnsRules := []option.DefaultDNSRule{} + routeRules := []option.Rule{} + rulesets := []option.RuleSet{} + if opt.EnableTun { + routeRules = append( + routeRules, + option.Rule{ + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultRule{ + ProcessName: []string{"Hiddify", "Hiddify.exe", "HiddifyCli", "HiddifyCli.exe"}, + Outbound: OutboundBypassTag, + }, + }, + ) + } + routeRules = append(routeRules, option.Rule{ + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultRule{ + Inbound: []string{InboundDNSTag}, + Outbound: OutboundDNSTag, + }, + }) + routeRules = append(routeRules, option.Rule{ + + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultRule{ + Port: []uint16{53}, + Outbound: OutboundDNSTag, + }, + }) + // { + // Type: C.RuleTypeDefault, + // DefaultOptions: option.DefaultRule{ + // ClashMode: "Direct", + // Outbound: OutboundDirectTag, + // }, + // }, + // { + // Type: C.RuleTypeDefault, + // DefaultOptions: option.DefaultRule{ + // ClashMode: "Global", + // Outbound: OutboundMainProxyTag, + // }, + // }, } + + if opt.BypassLAN { + routeRules = append( + routeRules, + option.Rule{ + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultRule{ + // GeoIP: []string{"private"}, + IPIsPrivate: true, + Outbound: OutboundBypassTag, + }, + }, + ) + } + + for _, rule := range opt.Rules { + routeRule := rule.MakeRule() + switch rule.Outbound { + case "bypass": + routeRule.Outbound = OutboundBypassTag + case "block": + routeRule.Outbound = OutboundBlockTag + case "proxy": + routeRule.Outbound = OutboundDNSTag + } + + if routeRule.IsValid() { + routeRules = append( + routeRules, + option.Rule{ + Type: C.RuleTypeDefault, + DefaultOptions: routeRule, + }, + ) + } + + dnsRule := rule.MakeDNSRule() + switch rule.Outbound { + case "bypass": + dnsRule.Server = DNSDirectTag + case "block": + dnsRule.Server = DNSBlockTag + dnsRule.DisableCache = true + case "proxy": + if opt.EnableFakeDNS { + fakeDnsRule := dnsRule + fakeDnsRule.Server = DNSFakeTag + fakeDnsRule.Inbound = []string{InboundTUNTag, InboundMixedTag} + dnsRules = append(dnsRules, fakeDnsRule) + } + dnsRule.Server = DNSRemoteTag + } + dnsRules = append(dnsRules, dnsRule) + } + + var dnsCPttl uint32 = 3000 + parsedURL, err := url.Parse(opt.ConnectionTestUrl) + if err == nil { + dnsRules = append(dnsRules, option.DefaultDNSRule{ + Domain: []string{parsedURL.Host}, + Server: DNSRemoteTag, + RewriteTTL: &dnsCPttl, + DisableCache: false, + }) + } + + if opt.BlockAds { + rulesets = append(rulesets, option.RuleSet{ + Type: C.RuleSetTypeRemote, + Tag: "geosite-ads", + Format: C.RuleSetFormatBinary, + RemoteOptions: option.RemoteRuleSet{ + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", + UpdateInterval: option.Duration(5 * time.Hour * 24), + }, + }) + rulesets = append(rulesets, option.RuleSet{ + Type: C.RuleSetTypeRemote, + Tag: "geosite-malware", + Format: C.RuleSetFormatBinary, + RemoteOptions: option.RemoteRuleSet{ + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", + UpdateInterval: option.Duration(5 * time.Hour * 24), + }, + }) + rulesets = append(rulesets, option.RuleSet{ + Type: C.RuleSetTypeRemote, + Tag: "geosite-phishing", + Format: C.RuleSetFormatBinary, + RemoteOptions: option.RemoteRuleSet{ + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", + UpdateInterval: option.Duration(5 * time.Hour * 24), + }, + }) + rulesets = append(rulesets, option.RuleSet{ + Type: C.RuleSetTypeRemote, + Tag: "geosite-cryptominers", + Format: C.RuleSetFormatBinary, + RemoteOptions: option.RemoteRuleSet{ + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", + UpdateInterval: option.Duration(5 * time.Hour * 24), + }, + }) + rulesets = append(rulesets, option.RuleSet{ + Type: C.RuleSetTypeRemote, + Tag: "geoip-phishing", + Format: C.RuleSetFormatBinary, + RemoteOptions: option.RemoteRuleSet{ + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", + UpdateInterval: option.Duration(5 * time.Hour * 24), + }, + }) + rulesets = append(rulesets, option.RuleSet{ + Type: C.RuleSetTypeRemote, + Tag: "geoip-malware", + Format: C.RuleSetFormatBinary, + RemoteOptions: option.RemoteRuleSet{ + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", + UpdateInterval: option.Duration(5 * time.Hour * 24), + }, + }) + + routeRules = append(routeRules, option.Rule{ + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultRule{ + RuleSet: []string{ + "geosite-ads", + "geosite-malware", + "geosite-phishing", + "geosite-cryptominers", + "geoip-malware", + "geoip-phishing", + }, + Outbound: OutboundBlockTag, + }, + }) + + } + if opt.Region != "other" { + dnsRules = append(dnsRules, option.DefaultDNSRule{ + RuleSet: []string{ + "geoip-" + opt.Region, + "geosite-" + opt.Region, + }, + Server: DNSDirectTag, + }) + dnsRules = append(dnsRules, option.DefaultDNSRule{ + DomainSuffix: []string{"." + opt.Region}, + Server: DNSDirectTag, + }) + rulesets = append(rulesets, option.RuleSet{ + Type: C.RuleSetTypeRemote, + Tag: "geoip-" + opt.Region, + Format: C.RuleSetFormatBinary, + RemoteOptions: option.RemoteRuleSet{ + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", + UpdateInterval: option.Duration(5 * time.Hour * 24), + }, + }) + rulesets = append(rulesets, option.RuleSet{ + Type: C.RuleSetTypeRemote, + Tag: "geosite-" + opt.Region, + Format: C.RuleSetFormatBinary, + RemoteOptions: option.RemoteRuleSet{ + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", + UpdateInterval: option.Duration(5 * time.Hour * 24), + }, + }) + + routeRules = append(routeRules, option.Rule{ + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultRule{ + RuleSet: []string{ + "geoip-" + opt.Region, + "geosite-" + opt.Region, + }, + Outbound: OutboundDirectTag, + }, + }) + + routeRules = append(routeRules, option.Rule{ + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultRule{ + DomainSuffix: []string{"." + opt.Region}, + Outbound: OutboundDirectTag, + }, + }) + + } + options.Route = &option.RouteOptions{ + Rules: routeRules, + Final: OutboundMainProxyTag, + AutoDetectInterface: true, + OverrideAndroidVPN: true, + RuleSet: rulesets, + // GeoIP: &option.GeoIPOptions{ + // Path: opt.GeoIPPath, + // }, + // Geosite: &option.GeositeOptions{ + // Path: opt.GeoSitePath, + // }, + } + if opt.EnableDNSRouting { + for _, dnsRule := range dnsRules { + if dnsRule.IsValid() { + options.DNS.Rules = append( + options.DNS.Rules, + option.DNSRule{ + Type: C.RuleTypeDefault, + DefaultOptions: dnsRule, + }, + ) + } + } + } + +} + func patchHiddifyWarpFromConfig(out option.Outbound, opt ConfigOptions) option.Outbound { if opt.Warp.EnableWarp && opt.Warp.Mode == "proxy_over_warp" { if out.DirectOptions.Detour == "" { diff --git a/go.mod b/go.mod index 25250d4..5730db3 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,8 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) +require github.com/akavel/rsrc v0.10.2 // indirect + require ( berty.tech/go-libtor v1.0.385 // indirect github.com/ajg/form v1.5.1 // indirect @@ -44,7 +46,7 @@ require ( github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/yamux v0.1.1 // indirect - github.com/hiddify/ray2sing v0.0.0-20240802071553-e5ba91dc16e6 + github.com/hiddify/ray2sing v0.0.0-20240804185422-f340989b59a0 github.com/imkira/go-observer/v2 v2.0.0-20230629064422-8e0b61f11f1b // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2 // indirect @@ -126,4 +128,4 @@ replace github.com/sagernet/wireguard-go => github.com/hiddify/wireguard-go v0.0 replace github.com/bepass-org/warp-plus => github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d -replace github.com/hiddify/ray2sing => github.com/hiddify/ray2sing v0.0.0-20240802071553-e5ba91dc16e6 +// replace github.com/hiddify/ray2sing => github.com/hiddify/ray2sing v0.0.0-20240802071553-e5ba91dc16e6 diff --git a/go.sum b/go.sum index 7c41195..141e621 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,8 @@ github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0 h1:Wo41lDOevRJS github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0/go.mod h1:FVGavL/QEBQDcBpr3fAojoK17xX5k9bicBphrOpP7uM= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= +github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= @@ -102,8 +104,8 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hiddify/hiddify-sing-box v1.8.9-0.20240802064124-d8fa585fd411 h1:EGEYgzj5zUW46cxwumpRs0yixPT3yO7/p4kgJujjiro= github.com/hiddify/hiddify-sing-box v1.8.9-0.20240802064124-d8fa585fd411/go.mod h1:2wBDpGJbCEPXFy8jHkFbD2TAwxxUjKoMLXF2HTzhHfU= -github.com/hiddify/ray2sing v0.0.0-20240802071553-e5ba91dc16e6 h1:eB6BAfno4LlqQ6WSORr70LphHNu9XKmv5jr1AzRvy5M= -github.com/hiddify/ray2sing v0.0.0-20240802071553-e5ba91dc16e6/go.mod h1:Qp3mFdKsJZ5TwBYLREgWp8n2O6dgmNt3aAoX+xpvnsM= +github.com/hiddify/ray2sing v0.0.0-20240804185422-f340989b59a0 h1:O/BeurchSCEmZxRbnQNcv7+8dwNxkfMU6hGVNwzDo0A= +github.com/hiddify/ray2sing v0.0.0-20240804185422-f340989b59a0/go.mod h1:Qp3mFdKsJZ5TwBYLREgWp8n2O6dgmNt3aAoX+xpvnsM= github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d h1:vRGKh9ou+/vQGfVYa8MczhbIVjHxlP52OWwrDWO77RA= github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d/go.mod h1:uSRUbr1CcvFrEV69FTvuJFwpzEmwO8N4knb6+Zq3Ys4= github.com/hiddify/wireguard-go v0.0.0-20240727191222-383c1da14ff1 h1:xdbHlZtzs+jijAxy85qal835GglwmjohA/srHT8gm9s= diff --git a/v2/custom.go b/v2/custom.go index a41d1cd..7f8da21 100644 --- a/v2/custom.go +++ b/v2/custom.go @@ -55,10 +55,11 @@ func Start(in *pb.StartRequest) (*pb.CoreInfoResponse, error) { Log(pb.LogLevel_INFO, pb.LogType_CORE, "Starting") if CoreState != pb.CoreState_STOPPED { Log(pb.LogLevel_INFO, pb.LogType_CORE, "Starting0000") - return &pb.CoreInfoResponse{ - CoreState: CoreState, - MessageType: pb.MessageType_INSTANCE_NOT_STOPPED, - }, fmt.Errorf("instance not stopped") + Stop() + // return &pb.CoreInfoResponse{ + // CoreState: CoreState, + // MessageType: pb.MessageType_INSTANCE_NOT_STOPPED, + // }, fmt.Errorf("instance not stopped") } Log(pb.LogLevel_DEBUG, pb.LogType_CORE, "Starting Core") SetCoreStatus(pb.CoreState_STARTING, pb.MessageType_EMPTY, "")