This commit is contained in:
Dennis Schwerdel 2023-10-07 00:59:50 +02:00
parent 28b1c76d70
commit 358183ef12
2 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ This project follows [semantic versioning](http://semver.org).
- [changed] Changed Rust version to 1.73.0 - [changed] Changed Rust version to 1.73.0
- [changed] Updated dependencies - [changed] Updated dependencies
- [fixed] Fix error when IPv6 is not available
### v2.3.0 (2021-12-23) ### v2.3.0 (2021-12-23)

View File

@ -22,7 +22,7 @@ pub fn mapped_addr(addr: SocketAddr) -> SocketAddr {
} }
pub fn get_ip() -> IpAddr { pub fn get_ip() -> IpAddr {
let s = UdpSocket::bind("[::]:0").unwrap(); let s = UdpSocket::bind("0.0.0.0:0").unwrap();
s.connect("8.8.8.8:0").unwrap(); s.connect("8.8.8.8:0").unwrap();
s.local_addr().unwrap().ip() s.local_addr().unwrap().ip()
} }