diff --git a/decode/shadowsocks.go b/decode/shadowsocks.go index 1ee712d..6705238 100644 --- a/decode/shadowsocks.go +++ b/decode/shadowsocks.go @@ -100,7 +100,9 @@ func ParseShadowsocks(u string) (ss Shadowsocks, err error) { } } } - + if ss.TransportStream.Protocol == "" { + ss.TransportStream.Protocol = "tcp" + } if ss.TransportStream.Protocol == "websocket" { ss.TransportStream.Protocol = "ws" } diff --git a/v2rayapi/streamconfig.go b/v2rayapi/streamconfig.go index f4be9b3..e597b5e 100644 --- a/v2rayapi/streamconfig.go +++ b/v2rayapi/streamconfig.go @@ -2,6 +2,7 @@ package v2rayapi import ( "fmt" + "strings" "github.com/golang/protobuf/proto" "github.com/v2fly/v2ray-core/v5/common/serial" @@ -11,7 +12,10 @@ import ( ) func GetTransportStreamConfig(network, path, hdhost string) (conf *internet.StreamConfig, err error) { - transproto := network + transproto := strings.TrimSpace(network) + if transproto == "" { + transproto = "tcp" + } var transptl internet.TransportProtocol var protoconf proto.Message switch transproto { @@ -27,7 +31,7 @@ func GetTransportStreamConfig(network, path, hdhost string) (conf *internet.Stre transptl = internet.TransportProtocol_TCP protoconf = &tcp.Config{} default: - err = fmt.Errorf("outbound network or transport not support %s. only support tcp, ws or websocket", transproto) + err = fmt.Errorf("outbound network or transport not support (%s). only support tcp, ws or websocket", transproto) } if err != nil { return