mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 21:12:05 -07:00
fix: better ipv6 detection logic
This commit is contained in:
parent
8446d66d12
commit
a234c20650
5 changed files with 30 additions and 12 deletions
|
@ -196,16 +196,12 @@ func buildEndpointFromInterface(iface net.Interface) (*Endpoint, error) {
|
|||
|
||||
for _, a := range addrs {
|
||||
address := a.String()
|
||||
switch true {
|
||||
case IPv4Validator.MatchString(address):
|
||||
if IPv4Validator.MatchString(address) {
|
||||
e.SetIP(address)
|
||||
break
|
||||
case IPv4BlockValidator.MatchString(address):
|
||||
} else if IPv4BlockValidator.MatchString(address) {
|
||||
e.SetNetwork(address)
|
||||
break
|
||||
default:
|
||||
} else {
|
||||
e.SetIPv6(address)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue