feat: allow custom ECH domain

Allowing customize the query domain for ECH, instead of leaking the ECH domain to DNS, can effectively prevent DNS leakage. This is highly necessary for most users who rely on default DNS configurations.
This commit is contained in:
Bblythe 2025-12-03 12:17:22 +08:00 committed by GitHub
parent d8dcaa7500
commit 3dd5068675
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,6 +12,7 @@ import (
type ECHOptions struct {
Enable bool `proxy:"enable,omitempty" obfs:"enable,omitempty"`
Config string `proxy:"config,omitempty" obfs:"config,omitempty"`
Domain string `proxy:"domain,omitempty" obfs:"domain,omitempty"`
}
func (o ECHOptions) Parse() (*ech.Config, error) {
@ -28,6 +29,9 @@ func (o ECHOptions) Parse() (*ech.Config, error) {
return list, nil
}
} else {
if o.Domain != "" {
serverName = o.Domain
}
echConfig.GetEncryptedClientHelloConfigList = func(ctx context.Context, serverName string) ([]byte, error) {
return resolver.ResolveECHWithResolver(ctx, serverName, resolver.ProxyServerHostResolver)
}