Skip to content

Commit

Permalink
chg: modifing padding to unified format
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Dec 2, 2023
1 parent cc54b51 commit 5501254
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion common/tls/utls_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{

Check failure on line 208 in common/tls/utls_client.go

View workflow job for this annotation

GitHub Actions / Debug build (Go 1.20)

non-boolean condition in if statement
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

Check failure on line 213 in common/tls/utls_client.go

View workflow job for this annotation

GitHub Actions / Debug build (Go 1.20)

cannot use padding_size (variable of type []uint64) as [2]int value in struct literal
}
return &UTLSClientConfig{config: &tlsConfig, id: id}, nil
}

var (
Expand Down
2 changes: 1 addition & 1 deletion option/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 5501254

Please sign in to comment.