Skip to content

Commit

Permalink
Edited to work :P
Browse files Browse the repository at this point in the history
  • Loading branch information
aringo authored Apr 7, 2023
1 parent 89c8f36 commit 0089745
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apex.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ func main() {
apexDomains := make(map[string]bool)
for _, domain := range domains {
parts := strings.Split(domain, ".")
if len(parts) == 2 {
apexDomain := strings.Join(parts, ".")
apexDomains[apexDomain] = true
for i := len(parts) - 2; i >= 0; i-- {
apexDomain := strings.Join(parts[i:], ".")
if len(apexDomain) > 0 && apexDomain[0] != '-' {
apexDomains[apexDomain] = true
break
}
}
}

Expand Down

0 comments on commit 0089745

Please sign in to comment.