Fetch DC ips from Telegram

This commit is contained in:
9seconds
2026-02-15 23:56:53 +01:00
parent 301bde88ac
commit 852ca713c8
9 changed files with 262 additions and 101 deletions
+4 -1
View File
@@ -144,6 +144,7 @@ func (p *Proxy) Shutdown() {
p.ctxCancel()
p.streamWaitGroup.Wait()
p.workerPool.Release()
p.telegram.Shutdown()
p.allowlist.Shutdown()
p.blocklist.Shutdown()
@@ -292,7 +293,7 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) {
return nil, fmt.Errorf("invalid settings: %w", err)
}
tg, err := telegram.New(opts.Network, opts.getPreferIP(), opts.UseTestDCs)
tg, err := telegram.New(opts.Network, opts.getPreferIP())
if err != nil {
return nil, fmt.Errorf("cannot build telegram dialer: %w", err)
}
@@ -314,6 +315,8 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) {
telegram: tg,
}
go tg.Run(proxy.logger.Named("telegram"), 0)
pool, err := ants.NewPoolWithFunc(opts.getConcurrency(),
func(arg interface{}) {
proxy.ServeConn(arg.(essentials.Conn)) //nolint: forcetypeassert