From 10fb9afaa7c269831258b2201a7c01fe424da638 Mon Sep 17 00:00:00 2001 From: Cecylia Bocovich Date: Thu, 26 Oct 2023 16:58:28 -0400 Subject: [PATCH] Check if multiple front domains argument is empty This fixes a regression introduced in 9fdfb3d1, where the list of front domains always contained an empty string if none were supplied via the commandline options, causing rendezvous failures for both amp cache and domain fronting. This fix checks to see whether the commandline option was supplied. --- client/snowflake.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/snowflake.go b/client/snowflake.go index 6d4b05c..3b619f7 100644 --- a/client/snowflake.go +++ b/client/snowflake.go @@ -82,7 +82,9 @@ func socksAcceptLoop(ln *pt.SocksListener, config sf.ClientConfig, shutdown chan config.AmpCacheURL = arg } if arg, ok := conn.Req.Args.Get("fronts"); ok { - config.FrontDomains = strings.Split(strings.TrimSpace(arg), ",") + if arg != "" { + config.FrontDomains = strings.Split(strings.TrimSpace(arg), ",") + } } else if arg, ok := conn.Req.Args.Get("front"); ok { config.FrontDomains = strings.Split(strings.TrimSpace(arg), ",") } @@ -210,7 +212,11 @@ func main() { log.Printf("snowflake-client %s\n", version.GetVersion()) iceAddresses := strings.Split(strings.TrimSpace(*iceServersCommas), ",") - frontDomains := strings.Split(strings.TrimSpace(*frontDomainsCommas), ",") + + var frontDomains []string + if *frontDomainsCommas != "" { + frontDomains = strings.Split(strings.TrimSpace(*frontDomainsCommas), ",") + } // Maintain backwards compatability with legacy commandline option if (len(frontDomains) == 0) && (*frontDomain != "") {