toWhitelist gets base domain
parent
6ee99fbc5c
commit
35d96e4979
6
main.go
6
main.go
|
|
@ -134,6 +134,12 @@ func fixScheme(u *url.URL) {
|
|||
func toWhitelist(okay []string, host string) bool {
|
||||
host = strings.Split(host, ":")[0]
|
||||
host = strings.Replace(host, "www.", "", -1)
|
||||
host = strings.Replace(host, "http://", "", -1)
|
||||
host = strings.Replace(host, "https://", "", -1)
|
||||
hosts := strings.Split(host, ".")
|
||||
if len(hosts) > 1 {
|
||||
host = hosts[len(hosts)-2] + "." + hosts[len(hosts)-1]
|
||||
}
|
||||
for i := range okay {
|
||||
if strings.Contains(okay[i], host) {
|
||||
return true
|
||||
|
|
|
|||
Loading…
Reference in New Issue