Henauxg / bevy_quinnet

A Client/Server game networking plugin using QUIC, for the Bevy game engine.
Apache License 2.0
233 stars 14 forks source link

[Bug] No way to specify IPv6 address in client `ConnectionConfiguration` #9

Closed Kneelawk closed 1 year ago

Kneelawk commented 1 year ago

The Issue

Attempting to specify an IPv6 address to a client-side ConnectionConfiguration, results in errors no matter how the address is formatted.

Specifying a simple IPv6 address like ::1 causes an AddrParseError(Socket) because the IP address and port are simply concatenated with a : between them, then fed into the SocketAddr parser. However, the SocketAddr parser expects IPv6 addresses to be surrounded with square brackets, like so: [::1]. Here is the full error reported:

thread 'tokio-runtime-worker' panicked at 'Failed to parse server address: AddrParseError(Socket)', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_quinnet-0.3.0/src/client/connection.rs:378:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying a bracketed IPv6 address like [::1] causes an InvalidDnsName("[::1]") because the address is ultimately fed into an IpAddr parser when bevy_quinnet attempts to connect its Endpoint and the IpAddr parser expects IPv6 address to not be bracketed. Here is the full error reporteed:

thread 'tokio-runtime-worker' panicked at 'Failed to connect: configuration error: InvalidDnsName("[::1]")', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_quinnet-0.3.0/src/client/connection.rs:389:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Versions

Henauxg commented 1 year ago

Thank you, I have a fix on a local branch but I'm not yet sure of the best way to expose it. I will update this in a few days.