Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbr0wn committed Dec 6, 2024
1 parent 02a1821 commit 5d78c8b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions domaincheck/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ func CheckDNS(domain string) DNS {
}

func DomainRedirectCheck(domain string) (bool, string) {
// Clean up the domain input
domain = strings.TrimPrefix(domain, "http://")
domain = strings.TrimPrefix(domain, "https://")
domain = strings.TrimSpace(domain)
domain = cleanDomain(domain)

// Initialize final redirect location
var finalLoc string
Expand Down Expand Up @@ -98,6 +95,8 @@ func PrimaryDomainCheck(domain string) (bool, string) {
var expanded bool
domain, expanded = expandShortURL(domain)

domain = cleanDomain(domain)

// Parse domain into root and subdomain
root, subdomain, err := syntax.ParseRootAndSubdomain(domain)
if err != nil {
Expand Down Expand Up @@ -139,6 +138,15 @@ func PrimaryDomainCheck(domain string) (bool, string) {
return false, primaryDomain
}

func cleanDomain(domain string) string {

domain = strings.TrimPrefix(domain, "http://")
domain = strings.TrimPrefix(domain, "https://")
domain = strings.Trim(domain, "/")
domain = strings.TrimSpace(domain)
return domain
}

func checkConnection(domain string) bool {
// Try both HTTP and HTTPS ports
for _, port := range []string{":80", ":443"} {
Expand Down

0 comments on commit 5d78c8b

Please sign in to comment.