more lint driven refactoring

This commit is contained in:
evilsocket 2018-04-26 12:19:52 +02:00
parent 0de6f3a76e
commit 1afab5d7be
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
7 changed files with 19 additions and 26 deletions

View file

@ -133,7 +133,7 @@ func buildEndpointFromInterface(iface net.Interface) (*Endpoint, error) {
for _, a := range addrs {
address := a.String()
if IPv4Validator.MatchString(address) {
if strings.IndexRune(address, '/') == -1 {
if strings.ContainsRune(address, '/') {
// plain ip
e.SetIP(address)
} else {
@ -201,7 +201,7 @@ func FindInterface(name string) (*Endpoint, error) {
for _, address := range addrs {
ip := address.String()
if strings.Contains(ip, "127.0.0.1") == false && IPv4Validator.MatchString(ip) {
if !strings.Contains(ip, "127.0.0.1") && IPv4Validator.MatchString(ip) {
return buildEndpointFromInterface(iface)
}
}