Make auto updating optional

This commit is contained in:
9seconds
2026-02-26 13:35:05 +01:00
parent 9c122f942f
commit 189dce07c6
8 changed files with 26 additions and 2 deletions
+6
View File
@@ -57,6 +57,9 @@ var defaultDCAddrSet = dcAddrSet{
5: {
{Network: "tcp4", Address: "149.154.171.5:443"},
},
203: {
{Network: "tcp4", Address: "91.105.192.100:443"},
},
},
v6: map[int][]Addr{
1: {
@@ -74,5 +77,8 @@ var defaultDCAddrSet = dcAddrSet{
5: {
{Network: "tcp6", Address: "[2001:b28:f23f:f005::a]:443"},
},
203: {
{Network: "tcp6", Address: "[2a0a:f280:0203:000a:5000:0000:0000:0100]:443"},
},
},
}
+2
View File
@@ -41,6 +41,7 @@ func (suite *ViewTestSuite) TestGetV4() {
},
203: {
{Network: "tcp4", Address: "127.0.0.2:443"},
{Network: "tcp4", Address: "91.105.192.100:443"},
},
2: {
{Network: "tcp4", Address: "149.154.167.51:443"},
@@ -60,6 +61,7 @@ func (suite *ViewTestSuite) TestGetV6() {
111: {},
203: {
{Network: "tcp6", Address: "xxx"},
{Network: "tcp6", Address: "[2a0a:f280:0203:000a:5000:0000:0000:0100]:443"},
},
1: {
{Network: "tcp6", Address: "[2001:b28:f23d:f001::a]:443"},
+4 -2
View File
@@ -346,8 +346,10 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) {
domainFrontingProxyProtocol: opts.DomainFrontingProxyProtocol,
}
proxy.configUpdater.Run(ctx, dc.PublicConfigUpdateURLv4, "tcp4")
proxy.configUpdater.Run(ctx, dc.PublicConfigUpdateURLv6, "tcp6")
if opts.AutoUpdate {
proxy.configUpdater.Run(ctx, dc.PublicConfigUpdateURLv4, "tcp4")
proxy.configUpdater.Run(ctx, dc.PublicConfigUpdateURLv6, "tcp6")
}
pool, err := ants.NewPoolWithFunc(opts.getConcurrency(),
func(arg any) {
+6
View File
@@ -85,6 +85,12 @@ type ProxyOpts struct {
// This is an optional setting.
PreferIP string
// AutoUpdate defines if it is required to auto update proxy list from
// Telegram instead of relying on a hardcoded list.
//
// This is an optional setting.
AutoUpdate bool
// DomainFrontingPort is a port we use to connect to a fronting domain.
//
// This is required because secret does not specify a port. It specifies a