diff --git a/common/tls/ech_client.go b/common/tls/ech_client.go index 0d9228273e..6c03c389aa 100644 --- a/common/tls/ech_client.go +++ b/common/tls/ech_client.go @@ -101,7 +101,7 @@ func NewECHClient(ctx context.Context, serverAddress string, options option.Outb if options.DisableSNI { tlsConfig.ServerName = "127.0.0.1" } else { - if options.MixedCaseSNI { + if options.TLSTricks != nil && options.TLSTricks.MixedCaseSNI { tlsConfig.ServerName = randomizeCase(tlsConfig.ServerName) } else { tlsConfig.ServerName = serverName diff --git a/common/tls/std_client.go b/common/tls/std_client.go index 1a645cfc00..b66be96239 100644 --- a/common/tls/std_client.go +++ b/common/tls/std_client.go @@ -64,7 +64,7 @@ func NewSTDClient(ctx context.Context, serverAddress string, options option.Outb if options.DisableSNI { tlsConfig.ServerName = "127.0.0.1" } else { - if options.MixedCaseSNI { + if options.TLSTricks != nil && options.TLSTricks.MixedCaseSNI { tlsConfig.ServerName = randomizeCase(tlsConfig.ServerName) } else { tlsConfig.ServerName = serverName diff --git a/common/tls/utls_client.go b/common/tls/utls_client.go index ce5b8083ae..6d80398ec3 100644 --- a/common/tls/utls_client.go +++ b/common/tls/utls_client.go @@ -139,7 +139,7 @@ func NewUTLSClient(ctx context.Context, serverAddress string, options option.Out return nil, E.New("missing server_name or insecure=true") } - if options.MixedCaseSNI { + if options.TLSTricks.MixedCaseSNI { serverName = randomizeCase(serverName) } @@ -205,14 +205,20 @@ func NewUTLSClient(ctx context.Context, serverAddress string, options option.Out if err != nil { return nil, err } - if options.PaddingSize != "" { - padding_size, err := option.ParseIntRange(options.PaddingSize) + if options.TLSTricks != nil && options.TLSTricks.PaddingMode == "random" { + padding_size, err := option.ParseIntRange(options.TLSTricks.PaddingSize) if err != nil { return nil, E.Cause(err, "invalid Padding Size supplied") } paddingSize2 := [2]int{int(padding_size[0]), int(padding_size[1])} return &UTLSClientConfig{config: &tlsConfig, paddingSize: paddingSize2, id: id}, nil + } + if options.TLSTricks.PaddingMode == "sni" { + + } + if options.TLSTricks.PaddingMode == "hello_client" { + } return &UTLSClientConfig{config: &tlsConfig, id: id}, nil } diff --git a/option/outbound.go b/option/outbound.go index 36ddd11ab5..f6adb3d3a4 100644 --- a/option/outbound.go +++ b/option/outbound.go @@ -140,7 +140,7 @@ type DialerOptions struct { ConnectTimeout Duration `json:"connect_timeout,omitempty"` TCPFastOpen bool `json:"tcp_fast_open,omitempty"` TCPMultiPath bool `json:"tcp_multi_path,omitempty"` - TLSFragment TLSFragmentOptions `json:"tls_fragment,omitempty"` + TLSFragment *TLSFragmentOptions `json:"tls_fragment,omitempty"` UDPFragment *bool `json:"udp_fragment,omitempty"` UDPFragmentDefault bool `json:"-"` DomainStrategy DomainStrategy `json:"domain_strategy,omitempty"` diff --git a/option/tls.go b/option/tls.go index 4f6bb2dc7d..396f3cae51 100644 --- a/option/tls.go +++ b/option/tls.go @@ -20,10 +20,8 @@ type InboundTLSOptions struct { type OutboundTLSOptions struct { Enabled bool `json:"enabled,omitempty"` DisableSNI bool `json:"disable_sni,omitempty"` - MixedCaseSNI bool `json:"mixedcase_sni,omitempty"` ServerName string `json:"server_name,omitempty"` Insecure bool `json:"insecure,omitempty"` - PaddingSize string `json:"padding_size,omitempty"` ALPN Listable[string] `json:"alpn,omitempty"` MinVersion string `json:"min_version,omitempty"` MaxVersion string `json:"max_version,omitempty"` @@ -33,6 +31,7 @@ type OutboundTLSOptions struct { ECH *OutboundECHOptions `json:"ech,omitempty"` UTLS *OutboundUTLSOptions `json:"utls,omitempty"` Reality *OutboundRealityOptions `json:"reality,omitempty"` + TLSTricks *TLSTricksOptions `json:"tls_tricks,omitempty"` } type InboundRealityOptions struct { diff --git a/option/tls_tricks.go b/option/tls_tricks.go new file mode 100644 index 0000000000..e1c88664a2 --- /dev/null +++ b/option/tls_tricks.go @@ -0,0 +1,8 @@ +package option + +type TLSTricksOptions struct { + MixedCaseSNI bool `json:"mixedcase_sni,omitempty"` + PaddingMode string `json:"padding_mode,omitempty"` + PaddingSize string `json:"padding_size,omitempty"` + PaddingSNI string `json:"padding_sni,omitempty"` +}