From 88f6537540be9a37bc71123d04738de74041d00b Mon Sep 17 00:00:00 2001 From: RPRX <63339210+rprx@users.noreply.github.com> Date: Fri, 15 Jan 2021 11:36:31 +0000 Subject: [PATCH] Make necessary maps in non-empty names before copy --- proxy/vless/inbound/inbound.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/proxy/vless/inbound/inbound.go b/proxy/vless/inbound/inbound.go index 1dbbd32b..264f1e1f 100644 --- a/proxy/vless/inbound/inbound.go +++ b/proxy/vless/inbound/inbound.go @@ -109,6 +109,17 @@ func New(ctx context.Context, config *Config, dc dns.Client) (*Handler, error) { } */ } + if handler.fallbacks[""] != nil { + for name, apfb := range handler.fallbacks { + if name != "" { + for alpn := range handler.fallbacks[""] { + if apfb[alpn] == nil { + apfb[alpn] = make(map[string]*Fallback) + } + } + } + } + } for _, apfb := range handler.fallbacks { if apfb[""] != nil { for alpn, pfb := range apfb { @@ -126,9 +137,6 @@ func New(ctx context.Context, config *Config, dc dns.Client) (*Handler, error) { for name, apfb := range handler.fallbacks { if name != "" { for alpn, pfb := range handler.fallbacks[""] { - if apfb[alpn] == nil { - apfb[alpn] = make(map[string]*Fallback) - } for path, fb := range pfb { if apfb[alpn][path] == nil { apfb[alpn][path] = fb