From 11b88d802ef5630c9d680e5d07cc53c5e277726c Mon Sep 17 00:00:00 2001 From: problematicconsumer Date: Sat, 2 Dec 2023 19:45:48 +0330 Subject: [PATCH] Add initial tls tricks --- shared/config.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/shared/config.go b/shared/config.go index 7683b2c..52fc52a 100644 --- a/shared/config.go +++ b/shared/config.go @@ -15,6 +15,7 @@ import ( ) type ConfigOptions struct { + TLSTricks TLSTricks ExecuteAsIs bool `json:"execute-config-as-is"` LogLevel string `json:"log-level"` ResolveDestination bool `json:"resolve-destination"` @@ -42,6 +43,13 @@ type ConfigOptions struct { Rules []Rule `json:"rules"` } +type TLSTricks struct { + EnableTLSFragment bool `json:"enable-tls-fragment"` + TLSFragmentSize string `json:"tls-fragment-size"` + TLSFragmentSleep string `json:"tls-fragment-sleep"` + EnableMixedSNICase bool `json:"enable-mixed-sni-case"` +} + func BuildConfigJson(configOpt ConfigOptions, input option.Options) (string, error) { options := BuildConfig(configOpt, input) var buffer bytes.Buffer @@ -355,6 +363,17 @@ func BuildConfig(configOpt ConfigOptions, input option.Options) option.Options { directDNSDomains = append(directDNSDomains, fmt.Sprintf("full:%s", server)) } } + if value, ok := obj["tls"]; ok { + tls := value.(map[string]interface{}) + tls["mixedcase_sni"] = configOpt.TLSTricks.EnableMixedSNICase + } + modifiedJson, err := json.Marshal(obj) + if err == nil { + err = out.UnmarshalJSON(modifiedJson) + if err != nil { + fmt.Println("error: ", err) + } + } } }