Skip to content

Commit

Permalink
fix local ip v4 vs v6 issues and fix arbitrary ipv6 port
Browse files Browse the repository at this point in the history
  • Loading branch information
neelayjunnarkar committed Nov 4, 2024
1 parent b759e29 commit 72b66fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions insanity-native-tui-app/src/connection_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,14 @@ impl ConnectionManagerBuilder {
VeqSocket::bind_with_keypair(&v4_addr.to_string(), keypair).await?
}
IpVersion::Ipv6 => {
let v6_addr = SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, self.listen_port + 1, 0, 0);
let v6_addr = SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, self.listen_port, 0, 0);
VeqSocket::bind_with_keypair(&v6_addr.to_string(), keypair).await?
}
IpVersion::Dualstack => {
let v4_addr = SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, self.listen_port);
let v6_addr = SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, self.listen_port + 1, 0, 0);
// TODO: maybe have a better way for specifying both ipv4 and ipv6 listen ports simultaneously.
let ipv6_listen_port = if self.listen_port == 0 { 0 } else { self.listen_port + 1 };
let v6_addr = SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, ipv6_listen_port, 0, 0);
VeqSocket::dualstack_with_keypair(v4_addr, v6_addr, keypair).await?
}
};
Expand Down

0 comments on commit 72b66fd

Please sign in to comment.