Browse Source

Make necessary maps in non-empty names before copy

RPRX 4 years ago
parent
commit
88f6537540
1 changed files with 11 additions and 3 deletions
  1. 11 3
      proxy/vless/inbound/inbound.go

+ 11 - 3
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