Skip to content

Commit

Permalink
fix: case wildcard is cname
Browse files Browse the repository at this point in the history
  • Loading branch information
sunggun-yu committed Jul 11, 2024
1 parent eb3772a commit ad8ed2f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/dnslookup/dnslookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ func GetDNSRecords(hostname string) []models.DNSRecord {
currentHost := hostname
isWildcard := false

if strings.HasPrefix(hostname, "*.") {
randomSubdomain := randomHostname()
currentHost = randomSubdomain + hostname[1:]
isWildcard = true
}

// CNAME lookup
cname, err := net.LookupCNAME(currentHost)
if err == nil && cname != currentHost+"." {
Expand All @@ -42,6 +36,12 @@ func GetDNSRecords(hostname string) []models.DNSRecord {
currentHost = cname
}

if strings.HasPrefix(currentHost, "*.") {
randomSubdomain := randomHostname()
currentHost = randomSubdomain + hostname[1:]
isWildcard = true
}

// A and AAAA lookup
ips, err := net.LookupIP(currentHost)

Expand Down

0 comments on commit ad8ed2f

Please sign in to comment.