mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-13 21:54:13 +08:00
Add ech_config options
This commit is contained in:
parent
e02317a348
commit
314edaa170
@ -14,7 +14,7 @@ import (
|
|||||||
cftls "github.com/sagernet/cloudflare-tls"
|
cftls "github.com/sagernet/cloudflare-tls"
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
"github.com/sagernet/sing-dns"
|
dns "github.com/sagernet/sing-dns"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
|
||||||
mDNS "github.com/miekg/dns"
|
mDNS "github.com/miekg/dns"
|
||||||
@ -179,13 +179,16 @@ func NewECHClient(router adapter.Router, serverAddress string, options option.Ou
|
|||||||
}
|
}
|
||||||
tlsConfig.ClientECHConfigs = clientConfig
|
tlsConfig.ClientECHConfigs = clientConfig
|
||||||
} else {
|
} else {
|
||||||
tlsConfig.GetClientECHConfigs = fetchECHClientConfig(router)
|
tlsConfig.GetClientECHConfigs = fetchECHClientConfig(router, options.ECH.EchDomain)
|
||||||
}
|
}
|
||||||
return &ECHClientConfig{&tlsConfig}, nil
|
return &ECHClientConfig{&tlsConfig}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchECHClientConfig(router adapter.Router) func(ctx context.Context, serverName string) ([]cftls.ECHConfig, error) {
|
func fetchECHClientConfig(router adapter.Router, EchDomain string) func(ctx context.Context, serverName string) ([]cftls.ECHConfig, error) {
|
||||||
return func(ctx context.Context, serverName string) ([]cftls.ECHConfig, error) {
|
return func(ctx context.Context, serverName string) ([]cftls.ECHConfig, error) {
|
||||||
|
if EchDomain != "" {
|
||||||
|
serverName = EchDomain
|
||||||
|
}
|
||||||
message := &mDNS.Msg{
|
message := &mDNS.Msg{
|
||||||
MsgHdr: mDNS.MsgHdr{
|
MsgHdr: mDNS.MsgHdr{
|
||||||
RecursionDesired: true,
|
RecursionDesired: true,
|
||||||
|
@ -62,7 +62,8 @@
|
|||||||
"enabled": false,
|
"enabled": false,
|
||||||
"pq_signature_schemes_enabled": false,
|
"pq_signature_schemes_enabled": false,
|
||||||
"dynamic_record_sizing_disabled": false,
|
"dynamic_record_sizing_disabled": false,
|
||||||
"config": ""
|
"config": "",
|
||||||
|
"ech_domain": ""
|
||||||
},
|
},
|
||||||
"utls": {
|
"utls": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
|
@ -62,7 +62,8 @@
|
|||||||
"enabled": false,
|
"enabled": false,
|
||||||
"pq_signature_schemes_enabled": false,
|
"pq_signature_schemes_enabled": false,
|
||||||
"dynamic_record_sizing_disabled": false,
|
"dynamic_record_sizing_disabled": false,
|
||||||
"config": ""
|
"config": "",
|
||||||
|
"ech_domain": ""
|
||||||
},
|
},
|
||||||
"utls": {
|
"utls": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
|
@ -50,6 +50,7 @@ type OutboundECHOptions struct {
|
|||||||
PQSignatureSchemesEnabled bool `json:"pq_signature_schemes_enabled,omitempty"`
|
PQSignatureSchemesEnabled bool `json:"pq_signature_schemes_enabled,omitempty"`
|
||||||
DynamicRecordSizingDisabled bool `json:"dynamic_record_sizing_disabled,omitempty"`
|
DynamicRecordSizingDisabled bool `json:"dynamic_record_sizing_disabled,omitempty"`
|
||||||
Config string `json:"config,omitempty"`
|
Config string `json:"config,omitempty"`
|
||||||
|
EchDomain string `json:"ech_domain,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OutboundUTLSOptions struct {
|
type OutboundUTLSOptions struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user