From 6f9de2d96fc29b4d716036b1d4165af07f82a27c Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Thu, 24 Dec 2020 13:47:56 +0800 Subject: [PATCH] Fix: snell should support the config without obfs --- adapters/outbound/shadowsocks.go | 2 +- adapters/outbound/snell.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/adapters/outbound/shadowsocks.go b/adapters/outbound/shadowsocks.go index 68c907e2..2028df74 100644 --- a/adapters/outbound/shadowsocks.go +++ b/adapters/outbound/shadowsocks.go @@ -40,7 +40,7 @@ type ShadowSocksOption struct { } type simpleObfsOption struct { - Mode string `obfs:"mode"` + Mode string `obfs:"mode,omitempty"` Host string `obfs:"host,omitempty"` } diff --git a/adapters/outbound/snell.go b/adapters/outbound/snell.go index edc0ddd7..8cd2cdb1 100644 --- a/adapters/outbound/snell.go +++ b/adapters/outbound/snell.go @@ -87,7 +87,10 @@ func NewSnell(option SnellOption) (*Snell, error) { return nil, fmt.Errorf("snell %s initialize obfs error: %w", addr, err) } - if obfsOption.Mode != "tls" && obfsOption.Mode != "http" { + switch obfsOption.Mode { + case "tls", "http", "": + break + default: return nil, fmt.Errorf("snell %s obfs mode error: %s", addr, obfsOption.Mode) }