Skip to content
Permalink
Browse files

Account for multiple colon's in dns key (IPv6 PTR) and naive check th…

…at qtype matches A-Z (#441)
  • Loading branch information...
pysysops authored and aelsabbahy committed May 12, 2019
1 parent b68e64f commit 33d7dbceffe4a684ad1e9271bae31568a5463fe5
Showing with 7 additions and 3 deletions.
  1. +7 −3 system/dns.go
@@ -3,6 +3,7 @@ package system
import (
"fmt"
"net"
"regexp"
"sort"
"strconv"
"strings"
@@ -35,12 +36,15 @@ type DefDNS struct {
func NewDefDNS(host string, system *System, config util.Config) DNS {
var h string
var t string
if len(strings.Split(host, ":")) > 1 {
h = strings.Split(host, ":")[1]
t = strings.Split(host, ":")[0]

splitHost := strings.SplitN(host, ":", 2)
if len(splitHost) == 2 && regexp.MustCompile(`^[A-Z]+$`).MatchString(splitHost[0]) {
h = splitHost[1]
t = splitHost[0]
} else {
h = host
}

return &DefDNS{
host: h,
Timeout: config.Timeout,

0 comments on commit 33d7dbc

Please sign in to comment.
You can’t perform that action at this time.