mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
fix: adopt new IPv4 parsing logic
This commit is contained in:
parent
eee94e993c
commit
44a17602ed
1 changed files with 9 additions and 10 deletions
|
@ -196,17 +196,16 @@ func buildEndpointFromInterface(iface net.Interface) (*Endpoint, error) {
|
||||||
|
|
||||||
for _, a := range addrs {
|
for _, a := range addrs {
|
||||||
address := a.String()
|
address := a.String()
|
||||||
if IPv4Validator.MatchString(address) {
|
switch true {
|
||||||
if !strings.ContainsRune(address, '/') {
|
case IPv4Validator.MatchString(address):
|
||||||
// plain ip
|
|
||||||
e.SetIP(address)
|
e.SetIP(address)
|
||||||
} else {
|
break
|
||||||
// ip/bits
|
case IPv4BlockValidator.MatchString(address):
|
||||||
e.SetNetwork(address)
|
e.SetNetwork(address)
|
||||||
}
|
break
|
||||||
} else {
|
default:
|
||||||
// ipv6/xxx
|
|
||||||
e.SetIPv6(address)
|
e.SetIPv6(address)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue