Merge remote-tracking branch 'origin/master' into obfuscated2

This commit is contained in:
9seconds
2026-02-24 13:37:10 +01:00
7 changed files with 36 additions and 1 deletions
+9 -1
View File
@@ -27,6 +27,7 @@ type Proxy struct {
allowFallbackOnUnknownDC bool
tolerateTimeSkewness time.Duration
domainFrontingPort int
domainFrontingIP string
workerPool *ants.PoolWithFunc
telegram *dc.Telegram
clientObfuscatror obfuscation.Obfuscator
@@ -41,8 +42,14 @@ type Proxy struct {
}
// DomainFrontingAddress returns a host:port pair for a fronting domain.
// If DomainFrontingIP is set, it is used instead of resolving the hostname.
func (p *Proxy) DomainFrontingAddress() string {
return net.JoinHostPort(p.secret.Host, strconv.Itoa(p.domainFrontingPort))
host := p.secret.Host
if p.domainFrontingIP != "" {
host = p.domainFrontingIP
}
return net.JoinHostPort(host, strconv.Itoa(p.domainFrontingPort))
}
// ServeConn serves a connection. We do not check IP blocklist and concurrency
@@ -317,6 +324,7 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) {
eventStream: opts.EventStream,
logger: logger,
domainFrontingPort: opts.getDomainFrontingPort(),
domainFrontingIP: opts.DomainFrontingIP,
tolerateTimeSkewness: opts.getTolerateTimeSkewness(),
allowFallbackOnUnknownDC: opts.AllowFallbackOnUnknownDC,
telegram: tg,
+9
View File
@@ -93,6 +93,15 @@ type ProxyOpts struct {
// This is an optional setting.
DomainFrontingPort uint
// DomainFrontingIP is an IP address to use when connecting to the fronting
// domain instead of resolving the hostname from the secret via DNS.
//
// This is useful when DNS resolution of the fronting host is blocked.
// The hostname from the secret is still used for SNI in the TLS handshake.
//
// This is an optional setting.
DomainFrontingIP string
// AllowFallbackOnUnknownDC defines how proxy behaves if unknown DC was
// requested. If this setting is set to false, then such connection will be
// rejected. Otherwise, proxy will chose any DC.