From f0efc0cfde046e899f7a5c869ac583031c0cfe1f Mon Sep 17 00:00:00 2001 From: RPRX <63339210+rprx@users.noreply.github.com> Date: Fri, 15 Jan 2021 09:43:39 +0000 Subject: [PATCH] As substring to match in VLESS fallbacks SNI shunt --- proxy/vless/inbound/inbound.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/proxy/vless/inbound/inbound.go b/proxy/vless/inbound/inbound.go index 0cd0815a..1dbbd32b 100644 --- a/proxy/vless/inbound/inbound.go +++ b/proxy/vless/inbound/inbound.go @@ -226,14 +226,14 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i } if len(napfb) > 1 || napfb[""] == nil { - if napfb[name] == nil { - generic := "*" - if index := strings.IndexByte(name, '.'); index != -1 { - generic += name[index:] - } - if napfb[generic] != nil { - name = generic + if name != "" && napfb[name] == nil { + match := "" + for n := range napfb { + if n != "" && strings.Contains(name, n) && len(n) > len(match) { + match = n + } } + name = match } }