mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 13:04:02 +03:00
Merge pull request #344 from 9seconds/blocked-telegram
Make auto updating optional
This commit is contained in:
@@ -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"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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
@@ -349,8 +349,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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user