containers / gvisor-tap-vsock

A new network stack based on gVisor
Apache License 2.0
263 stars 49 forks source link

make code ipv6 safe #55

Open Luap99 opened 3 years ago

Luap99 commented 3 years ago

In many places strings.Split(remote, ":") is used to split the ip and port. This does not work for ipv6 addresses.

https://github.com/containers/gvisor-tap-vsock/blob/9d8e7a5c6c5ac56290da3d78c5cd65cc59fff98a/pkg/services/forwarder/ports.go#L53-L56

To make this work with ipv6 addresses net.SplitHostPort should be used, https://pkg.go.dev/net#SplitHostPort. To combine a port with a ip address use net.JoinHostPort, https://pkg.go.dev/net#JoinHostPort

guillaumerose commented 3 years ago

Very good point! ipv6 also deserves e2e tests I guess.