mirror of
https://github.com/aramperes/onetun.git
synced 2025-09-08 23:58:31 -04:00
Simplify IP version detection
This commit is contained in:
parent
1680b17c47
commit
9bd7ec2cca
1 changed files with 1 additions and 3 deletions
|
@ -238,9 +238,7 @@ impl Config {
|
|||
let endpoint_bind_addr = if let Some(addr) = matches.value_of("endpoint-bind-addr") {
|
||||
let addr = parse_addr(Some(addr)).with_context(|| "Invalid host address")?;
|
||||
// Make sure the host address and endpoint address are the same IP version
|
||||
if addr.ip().is_ipv6() != endpoint_addr.ip().is_ipv6()
|
||||
|| (addr.ip().is_ipv4() != endpoint_addr.ip().is_ipv4())
|
||||
{
|
||||
if addr.ip().is_ipv4() != endpoint_addr.ip().is_ipv4() {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Endpoint and bind addresses must be the same IP version"
|
||||
));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue