From ba4b0b8e0fcaeb127ca1b3b4e7c7aade99f9cd1b Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Sat, 3 Sep 2022 17:29:10 +0800 Subject: [PATCH] fix auther option for socks5 handler --- config/parsing/service.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config/parsing/service.go b/config/parsing/service.go index 59db6d8..9eacab3 100644 --- a/config/parsing/service.go +++ b/config/parsing/service.go @@ -61,12 +61,16 @@ func ParseService(cfg *config.ServiceConfig) (service.Service, error) { authers = append(authers, auther) } } + var auther auth.Authenticator + if len(authers) > 0 { + auther = auth.AuthenticatorGroup(authers...) + } admissions := admissionList(cfg.Admission, cfg.Admissions...) ln := registry.ListenerRegistry().Get(cfg.Listener.Type)( listener.AddrOption(cfg.Addr), - listener.AutherOption(auth.AuthenticatorGroup(authers...)), + listener.AutherOption(auther), listener.AuthOption(parseAuth(cfg.Listener.Auth)), listener.TLSConfigOption(tlsConfig), listener.AdmissionOption(admission.AdmissionGroup(admissions...)), @@ -108,6 +112,11 @@ func ParseService(cfg *config.ServiceConfig) (service.Service, error) { } } + auther = nil + if len(authers) > 0 { + auther = auth.AuthenticatorGroup(authers...) + } + var sockOpts *chain.SockOpts if cfg.SockOpts != nil { sockOpts = &chain.SockOpts{ @@ -135,7 +144,7 @@ func ParseService(cfg *config.ServiceConfig) (service.Service, error) { h := registry.HandlerRegistry().Get(cfg.Handler.Type)( handler.RouterOption(router), - handler.AutherOption(auth.AuthenticatorGroup(authers...)), + handler.AutherOption(auther), handler.AuthOption(parseAuth(cfg.Handler.Auth)), handler.BypassOption(bypass.BypassGroup(bypassList(cfg.Bypass, cfg.Bypasses...)...)), handler.TLSConfigOption(tlsConfig),