fix nameserver regex.

This commit is contained in:
Liang-Chi Hsieh 2013-11-12 10:53:34 +08:00
parent d589cc3622
commit 1e5ba57de3

View file

@ -944,7 +944,7 @@ func StripComments(input []byte, commentMarker []byte) []byte {
func GetNameserversAsCIDR(resolvConf []byte) []string {
var parsedResolvConf = StripComments(resolvConf, []byte("#"))
nameservers := []string{}
re := regexp.MustCompile(`^\s*nameserver\s*(([0-9]\.){3}([0-9]))\s*$`)
re := regexp.MustCompile(`^\s*nameserver\s*(([0-9]+\.){3}([0-9]+))\s*$`)
for _, line := range bytes.Split(parsedResolvConf, []byte("\n")) {
var ns = re.FindSubmatch(line)
if len(ns) > 0 {