From 0f0f1188271bf1f8f36cd5aef0a87a4c95a73df8 Mon Sep 17 00:00:00 2001 From: WofWca Date: Thu, 5 Sep 2024 15:34:36 +0400 Subject: [PATCH] improvement(proxy): don't panic on invalid relayURL Though prior to this change the panic could only happen if the default relayURL set by the proxy is invalid, since `datachannelHandler` is only called after a succesful `checkIsRelayURLAcceptable()`, which ensures that it _is_ valid. But in the case of invalid default relay URL, a warning is printed already. --- proxy/lib/snowflake.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go index f168ec0..809a6cb 100644 --- a/proxy/lib/snowflake.go +++ b/proxy/lib/snowflake.go @@ -360,7 +360,8 @@ func (sf *SnowflakeProxy) datachannelHandler(conn *webRTCConn, remoteAddr net.Ad u, err := url.Parse(relayURL) if err != nil { - log.Fatalf("invalid relay url: %s", err) + log.Printf("invalid relay url: %s", err) + return } if remoteAddr != nil {