Skip to content

Conversation

@pjperez
Copy link

@pjperez pjperez commented Jan 16, 2026

The -ip parameter for server mode failed to accept IPv6 addresses, returning errors like "too many colons in address" or "Invalid IP address".

Root cause: The code concatenated IP and port directly (e.g., "2001:db8::1:8888"),
which is invalid for IPv6. IPv6 addresses must be bracketed: "[2001:db8::1]:8888".

Changes:

  • Added formatListenAddress() helper function in utils.go to properly format listen addresses for both IPv4 and IPv6
  • Updated IP validation in ethr.go to accept bracketed IPv6 addresses
  • Updated TCP and UDP servers in server.go to use the helper function

Behavior:

  • IPv4: Works as before (e.g., "127.0.0.1:8888")
  • IPv6: Now works correctly (e.g., "[::1]:8888")
  • Empty IP: Works as before (":8888" for all interfaces)

Backward compatibility: Fully maintained. No changes to client behavior, protocol, or command-line flags.

Testing:

  • IPv4 server binding works
  • IPv6 server binding works (with and without brackets)
  • IPv6 client-server communication works
  • All existing functionality preserved

Fixes #178

The `-ip` parameter for server mode failed to accept IPv6 addresses,
returning errors like "too many colons in address" or "Invalid IP address".

Root cause: The code concatenated IP and port directly (e.g., "2001:db8::1:8888"),
which is invalid for IPv6. IPv6 addresses must be bracketed: "[2001:db8::1]:8888".

Changes:
- Added formatListenAddress() helper function in utils.go to properly format
  listen addresses for both IPv4 and IPv6
- Updated IP validation in ethr.go to accept bracketed IPv6 addresses
- Updated TCP and UDP servers in server.go to use the helper function

Behavior:
- IPv4: Works as before (e.g., "127.0.0.1:8888")
- IPv6: Now works correctly (e.g., "[::1]:8888")
- Empty IP: Works as before (":8888" for all interfaces)

Backward compatibility: Fully maintained. No changes to client behavior,
protocol, or command-line flags.

Testing:
- IPv4 server binding works
- IPv6 server binding works (with and without brackets)
- IPv6 client-server communication works
- All existing functionality preserved

Fixes microsoft#178
@pjperez
Copy link
Author

pjperez commented Jan 16, 2026

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server ip parameter does not accept IPv6 addresses, but says it should:

1 participant