X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=rounds%2Fspy.go;h=affc1cbce3842be190bda10e10c842866e310a4d;hb=0c0a261a6ef4fddfc34a9150005f7964cc69c420;hp=3b242f8cfd2b686a37d230c80553ee6508a3e558;hpb=cb0d759766dd7183adc00f097760fc82ff2796d0;p=tofuproxy.git diff --git a/rounds/spy.go b/rounds/spy.go index 3b242f8..affc1cb 100644 --- a/rounds/spy.go +++ b/rounds/spy.go @@ -1,5 +1,5 @@ /* -tofuproxy -- HTTP proxy with TLS certificates management +tofuproxy -- flexible HTTP/WARC proxy with TLS certificates management Copyright (C) 2021 Sergey Matveev This program is free software: you can redistribute it and/or modify @@ -22,31 +22,14 @@ import ( "net/http" "strings" + "go.stargrave.org/tofuproxy/caches" "go.stargrave.org/tofuproxy/fifos" ) -var spyDomains = []string{ - "google-analytics.com", - "goo.gl", - "ads.google.com", - "googletagmanager.com", - "facebook.com", - "facebook.net", - "fbcdn.com", - "fbcdn.net", - "advertising.yandex.ru", - "an.yandex.ru", - "awaps.yandex.ru", - "bs.yandex.ru", - "informer.yandex.ru", - "mc.yandex.ru", - "metrika.yandex.ru", - "doubleclick.net", - "tns-counter.ru", -} - func IsSpy(host string) bool { - for _, spy := range spyDomains { + caches.SpiesM.RLock() + defer caches.SpiesM.RUnlock() + for _, spy := range caches.Spies { if strings.HasSuffix(host, spy) { return true } @@ -62,12 +45,7 @@ func RoundDenySpy( ) (bool, error) { if IsSpy(host) { http.NotFound(w, req) - fifos.SinkOther <- fmt.Sprintf( - "%s %s\t%d\tdeny spy", - req.Method, - req.URL.String(), - http.StatusNotFound, - ) + fifos.LogVarious <- fmt.Sprintf("%s %s\tdeny spy", req.Method, req.URL) return false, nil } return true, nil