PDGGK opened a new pull request, #170: URL: https://github.com/apache/iotdb-client-go/pull/170
## Problem The cluster session parses node URLs with `strings.Split(url, ":")`, reading `[0]` as host and `[1]` as port. This mis-parses an IPv6 endpoint: `[::1]:6667` resolves to host `[` and an empty port instead of host `::1` / port `6667`. The client's own output path already brackets IPv6 via `net.JoinHostPort`, so the input and output paths are inconsistent. ## Fix Parse node URLs with `net.SplitHostPort` via a new `parseNodeURL` helper, which accepts the bracketed `[ipv6]:port` form (consistent with apache/iotdb#18162) in addition to IPv4 and hostnames, and rejects malformed URLs with an error instead of silently mis-parsing them. A bare (unbracketed) IPv6 address with a port is ambiguous and rejected; the `[ipv6]:port` form must be used. Wildcard-address filtering (the other half of #18162) is not applicable to the Go client: it does not connect to server-provided redirect endpoints - it treats `RedirectionRecommend` as success and keeps its current connection - unlike the Java/Python/C++ node-discovery and redirection paths. ## Tests `TestParseNodeURL` covers IPv4, hostname, and bracketed IPv6 (`[::1]:6667`, `[2001:db8::1]:6667`), plus malformed inputs (bare IPv6, missing port, unbalanced bracket, empty host/port). Parsing is unit-tested including the `[::1]` loopback address; a live IPv6-loopback connection test (as in #18162) would need an IPv6-capable test server, which I'm happy to add as a follow-up if the client CI supports it. `go build ./...` and `go test ./client/` pass. Follows the dev@ "[DISCUSS] Improve IPv6 endpoint support" thread; one focused PR per client as @HTHou suggested. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
