Some IPv6 hostnames can start with a colon (eg '::1'). This breaks
the IRC line format.
To work around this issue, prefix the hostname with a '0'. This
changes the representation of the IP but not its value.
See: https://todo.sr.ht/~taiite/senpai/109
---
xirc/whox.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/xirc/whox.go b/xirc/whox.go
index 2e11813..ee5978c 100644
--- a/xirc/whox.go+++ b/xirc/whox.go
@@ -80,6 +80,11 @@ func (info *WHOXInfo) set(k byte, v string) {
}
func GenerateWHOXReply(prefix *irc.Prefix, nick, fields string, info *WHOXInfo) *irc.Message {
+ if strings.HasPrefix(info.Hostname, ":") {+ // The hostname cannot start with a colon as this would get parsed as a trailing parameter.+ // IPv6 addresses such as "::1" are prefixed with a zero to ensure this.