From 55012546584aab34cdb86f02eef07e82dfb6cff3 Mon Sep 17 00:00:00 2001 From: Hiddify <114227601+hiddify-com@users.noreply.github.com> Date: Sat, 2 Dec 2023 16:14:24 +0000 Subject: [PATCH] chg: modifing padding to unified format --- common/tls/utls_client.go | 9 ++++++++- option/tls.go | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/tls/utls_client.go b/common/tls/utls_client.go index c00918fe81..e57f7dc0eb 100644 --- a/common/tls/utls_client.go +++ b/common/tls/utls_client.go @@ -205,7 +205,14 @@ func NewUTLSClient(ctx context.Context, serverAddress string, options option.Out if err != nil { return nil, err } - return &UTLSClientConfig{config: &tlsConfig, paddingSize: options.PaddingSize, id: id}, nil + if options.PaddingSize{ + padding_size, err := option.ParseIntRange(options.PaddingSize) + if err != nil { + return nil, E.Cause(err, "invalid Padding Size supplied") + } + return &UTLSClientConfig{config: &tlsConfig, paddingSize: padding_size, id: id}, nil + } + return &UTLSClientConfig{config: &tlsConfig, id: id}, nil } var ( diff --git a/option/tls.go b/option/tls.go index aac24b4309..4f6bb2dc7d 100644 --- a/option/tls.go +++ b/option/tls.go @@ -23,7 +23,7 @@ type OutboundTLSOptions struct { MixedCaseSNI bool `json:"mixedcase_sni,omitempty"` ServerName string `json:"server_name,omitempty"` Insecure bool `json:"insecure,omitempty"` - PaddingSize [2]int `json:"padding_size,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"`