diff --git a/docs/config.yaml b/docs/config.yaml index a68b6840c..478a7fdaf 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -1805,7 +1805,7 @@ listeners: listen: 0.0.0.0 # routing-mark: 0 # 为监听socket设置routing-mark(仅支持linux) psk: your-password - version: 4 # 仅支持 4/5 + version: 4 # 支持 1/2/3/4/5 udp: true # UDP over TCP tunnel,默认 true # obfs-opts: # mode: http # 可选:http / tls diff --git a/listener/inbound/snell.go b/listener/inbound/snell.go index 1efdacd2b..cf90cd58f 100644 --- a/listener/inbound/snell.go +++ b/listener/inbound/snell.go @@ -43,7 +43,7 @@ func NewSnell(options *SnellOption) (*Snell, error) { if options.Version == 0 { options.Version = 4 } - if options.Version != 4 && options.Version != 5 { + if options.Version < 1 || options.Version > 5 { return nil, fmt.Errorf("snell inbound version %d is not supported", options.Version) } diff --git a/listener/inbound/snell_test.go b/listener/inbound/snell_test.go index d21e1f3f9..6a5770a13 100644 --- a/listener/inbound/snell_test.go +++ b/listener/inbound/snell_test.go @@ -60,6 +60,9 @@ func TestInboundSnell(t *testing.T) { name string version int }{ + {"v1", 1}, + //{"v2", 2}, + {"v3", 3}, {"v4", 4}, {"v5", 5}, } diff --git a/listener/snell/server.go b/listener/snell/server.go index ef5d9092b..84b63ac59 100644 --- a/listener/snell/server.go +++ b/listener/snell/server.go @@ -41,7 +41,9 @@ func New(config LC.SnellServer, lc C.InboundListenConfig, tunnel C.Tunnel, addit if config.Version == 0 { config.Version = snell.Version4 } - if config.Version != snell.Version4 && config.Version != snell.Version5 { + switch config.Version { + case snell.Version1, snell.Version2, snell.Version3, snell.Version4, snell.Version5: + default: return nil, fmt.Errorf("snell inbound version %d is not supported", config.Version) } if config.Psk == "" {