Merge pull request #26 from tilosp/ipv6

This commit is contained in:
Aram 🍐 2021-12-20 15:01:35 -05:00 committed by GitHub
commit 3b4071c823
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,10 +37,13 @@ impl WireGuardTunnel {
pub async fn new(config: &Config) -> anyhow::Result<Self> {
let source_peer_ip = config.source_peer_ip;
let peer = Self::create_tunnel(config)?;
let udp = UdpSocket::bind("0.0.0.0:0")
let endpoint = config.endpoint_addr;
let udp = UdpSocket::bind(match endpoint {
SocketAddr::V4(_) => "0.0.0.0:0",
SocketAddr::V6(_) => "[::]:0",
})
.await
.with_context(|| "Failed to create UDP socket for WireGuard connection")?;
let endpoint = config.endpoint_addr;
let virtual_port_ip_tx = Default::default();
Ok(Self {