mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-07-30 10:34:16 +03:00
Merge pull request #97 from v14d4n/feat/masque-configurable-sni
Make masque TLS SNI configurable via server_name
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
"congestion_controller": "bbr",
|
"congestion_controller": "bbr",
|
||||||
"cwnd": 0,
|
"cwnd": 0,
|
||||||
"tls": { // TLS fields for HTTP2
|
"tls": { // TLS fields for HTTP2
|
||||||
|
"server_name": "", // SNI; empty = default "consumer-masque.cloudflareclient.com"
|
||||||
"insecure": false,
|
"insecure": false,
|
||||||
"cipher_suites": [],
|
"cipher_suites": [],
|
||||||
"curve_preferences": [],
|
"curve_preferences": [],
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ type MASQUEOutboundOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MASQUEOutboundTLSOptions struct {
|
type MASQUEOutboundTLSOptions struct {
|
||||||
|
ServerName string `json:"server_name,omitempty"`
|
||||||
Insecure bool `json:"insecure,omitempty"`
|
Insecure bool `json:"insecure,omitempty"`
|
||||||
CipherSuites badoption.Listable[string] `json:"cipher_suites,omitempty"`
|
CipherSuites badoption.Listable[string] `json:"cipher_suites,omitempty"`
|
||||||
CurvePreferences badoption.Listable[CurvePreference] `json:"curve_preferences,omitempty"`
|
CurvePreferences badoption.Listable[CurvePreference] `json:"curve_preferences,omitempty"`
|
||||||
|
|||||||
@@ -102,7 +102,11 @@ func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextL
|
|||||||
logger.ErrorContext(ctx, E.New("failed to generate cert: ", err))
|
logger.ErrorContext(ctx, E.New("failed to generate cert: ", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tlsConfig, err := tls.NewMASQUEClient(ctx, logger, "consumer-masque.cloudflareclient.com", cert, privKey, peerPubKey, common.PtrValueOrDefault(options.TLS))
|
serverName := cloudflare.ConnectSNI
|
||||||
|
if options.TLS != nil && options.TLS.ServerName != "" {
|
||||||
|
serverName = options.TLS.ServerName
|
||||||
|
}
|
||||||
|
tlsConfig, err := tls.NewMASQUEClient(ctx, logger, serverName, cert, privKey, peerPubKey, common.PtrValueOrDefault(options.TLS))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.ErrorContext(ctx, E.New("failed to prepare TLS config: ", err))
|
logger.ErrorContext(ctx, E.New("failed to prepare TLS config: ", err))
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user