From d8ca6d22224893fb6286495033c72e7d7be3f9af Mon Sep 17 00:00:00 2001 From: delthas Date: Fri, 8 Apr 2022 22:33:37 +0200 Subject: [PATCH] Enable resetting a BOUNCER NETWORK port When a client sends BOUNCER CHANGENETWORK with no value (or an empty port value), this means it wants to reset the port value to its default value. Previously we considered an empty port as an actual valid, empty port value, which would then be used to connect to the server (dial 'example.com:' (ie 'example.com:0'), which failed. --- downstream.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/downstream.go b/downstream.go index d90de79..bef6adf 100644 --- a/downstream.go +++ b/downstream.go @@ -148,17 +148,17 @@ func getNetworkAttrs(network *network) irc.Tags { } func networkAddrFromAttrs(attrs irc.Tags) string { - host, ok := attrs.GetTag("host") - if !ok { + host := string(attrs["host"]) + if host == "" { return "" } addr := host - if port, ok := attrs.GetTag("port"); ok { + if port := string(attrs["port"]); port != "" { addr += ":" + port } - if tlsStr, ok := attrs.GetTag("tls"); ok && tlsStr == "0" { + if tlsStr := string(attrs["tls"]); tlsStr == "0" { addr = "irc+insecure://" + tlsStr }