iplist/iplist.go | 4 +++- diff --git a/iplist/iplist.go b/iplist/iplist.go index 4827f871949123ce3f9e2ec3cf33dfe3770da54a..5467c33055f177011307172e413526ebbf67c10d 100644 --- a/iplist/iplist.go +++ b/iplist/iplist.go @@ -50,6 +50,8 @@ } return } +var p2pBlocklistLineRe = regexp.MustCompile(`(.*):([\d.]+)-([\d.]+)`) + // Parse a line of the PeerGuardian Text Lists (P2P) Format. Returns !ok but // no error if a line doesn't contain a range but isn't erroneous, such as // comment and blank lines. @@ -58,7 +60,7 @@ l = strings.TrimSpace(l) if l == "" || strings.HasPrefix(l, "#") { return } - sms := regexp.MustCompile(`(.*):([\d.]+)-([\d.]+)`).FindStringSubmatch(l) + sms := p2pBlocklistLineRe.FindStringSubmatch(l) if sms == nil { err = fmt.Errorf("error parsing %q", l) return