diff --git a/config/outbound.go b/config/outbound.go index fbd7a3f..1037ffa 100644 --- a/config/outbound.go +++ b/config/outbound.go @@ -35,18 +35,29 @@ func patchOutboundTLSTricks(base option.Outbound, configOpt ConfigOptions, obj o } var tls *option.OutboundTLSOptions + var transport *option.V2RayTransportOptions if base.VLESSOptions.OutboundTLSOptionsContainer.TLS != nil { tls = base.VLESSOptions.OutboundTLSOptionsContainer.TLS + transport = base.VLESSOptions.Transport } else if base.TrojanOptions.OutboundTLSOptionsContainer.TLS != nil { tls = base.TrojanOptions.OutboundTLSOptionsContainer.TLS + transport = base.TrojanOptions.Transport } else if base.VMessOptions.OutboundTLSOptionsContainer.TLS != nil { tls = base.VMessOptions.OutboundTLSOptionsContainer.TLS + transport = base.VMessOptions.Transport } - if tls == nil || !tls.Enabled { + + if base.Type == C.TypeDirect { + return patchOutboundFragment(base, configOpt, obj) + } + + if tls == nil || !tls.Enabled || transport == nil { + return obj + } + if transport.Type != C.V2RayTransportTypeWebsocket && transport.Type != C.V2RayTransportTypeGRPC { return obj } - obj = patchOutboundFragment(base, configOpt, obj) if tls, ok := obj["tls"].(map[string]interface{}); ok { tlsTricks := option.TLSTricksOptions{ MixedCaseSNI: configOpt.TLSTricks.EnableMixedSNICase, diff --git a/go.mod b/go.mod index 24fe2ee..f12cf37 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/hiddify/libcore go 1.21.5 require ( - github.com/hiddify/ray2sing v0.0.0-20240126124612-8e00e77ec754 + github.com/hiddify/ray2sing v0.0.0-20240127015415-b0b85dcbf102 github.com/sagernet/gomobile v0.1.1 github.com/sagernet/sing v0.3.0 github.com/sagernet/sing-box v1.8.4 diff --git a/go.sum b/go.sum index 75d8333..db42817 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,8 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hiddify/hiddify-sing-box v1.7.9-0.20240126132136-307f29d4ab05 h1:Lu1VgoEDqQRMsEENwDVs+SMK16hLTie6DI+P8txZLMM= github.com/hiddify/hiddify-sing-box v1.7.9-0.20240126132136-307f29d4ab05/go.mod h1:B74zKdMcH3ZEmCi2OUqJTvEXCNtNQjivUEQ20y/5XQM= -github.com/hiddify/ray2sing v0.0.0-20240126124612-8e00e77ec754 h1:OS1xPGAR34zQ2btXGa2ZVpI0nXQnkB6meI1hXkQvgJM= -github.com/hiddify/ray2sing v0.0.0-20240126124612-8e00e77ec754/go.mod h1:zYKnf7EoPqrk7JOMO9BApTXxfH0sva8AKfoFywN7uuA= +github.com/hiddify/ray2sing v0.0.0-20240127015415-b0b85dcbf102 h1:4vKmPE8AyvsBYuZmjGkPnsju8ZzVxEjC9I96uqxX5+o= +github.com/hiddify/ray2sing v0.0.0-20240127015415-b0b85dcbf102/go.mod h1:zYKnf7EoPqrk7JOMO9BApTXxfH0sva8AKfoFywN7uuA= github.com/hiddify/wireguard-go v0.0.0-20240125143346-481d18d77fe1 h1:neOb+wzHbWLNZ2sHFEV4+GTuqORO7/MndQLFW8FjUY8= github.com/hiddify/wireguard-go v0.0.0-20240125143346-481d18d77fe1/go.mod h1:K4J7/npM+VAMUeUmTa2JaA02JmyheP0GpRBOUvn3ecc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=