-
Notifications
You must be signed in to change notification settings - Fork 2
Content Blocker Detection
Prajwal Koirala edited this page Mar 1, 2022
·
1 revision
package main
import (
"fmt"
"net"
)
func main() {
// Check if a content blocker is installed.
fmt.Println(detectContentBlocker())
}
// Check if content blocker is installed.
func detectContentBlocker() bool {
contentBlockerDomains := []string{
"google-analytics.com",
"doubleclick.net",
"ads.yahoo.com",
}
trueCounter := 0
falseCounter := 0
for _, domain := range contentBlockerDomains {
_, err := net.LookupNS(domain)
if err != nil {
trueCounter = trueCounter + 1
} else {
falseCounter = falseCounter + 1
}
}
return trueCounter < falseCounter
}