0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-06-12 11:29:36 +03:00

Make necessary maps in non-empty names before copy

This commit is contained in:
RPRX
2021-01-15 11:36:31 +00:00
committed by GitHub
parent f0efc0cfde
commit 88f6537540

View File

@ -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