Trivial fixes in core/pkg/net

- Simplify util method IsIPV6
- Skip ';'-prefixed lines in /etc/resolv.conf as comment
This commit is contained in:
Anfernee Gui 2017-08-22 10:41:07 -07:00
parent a392f29956
commit 99227da063
3 changed files with 5 additions and 9 deletions

View file

@ -16,15 +16,9 @@ limitations under the License.
package net
import (
_net "net"
"strings"
)
import _net "net"
// IsIPV6 checks if the input contains a valid IPV6 address
func IsIPV6(ip _net.IP) bool {
if dp := strings.Index(ip.String(), ":"); dp != -1 {
return true
}
return false
return ip.To4() == nil
}