/* tofuproxy -- HTTP proxy with TLS certificates management Copyright (C) 2021 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package rounds import ( "fmt" "net/http" "strings" "go.stargrave.org/tofuproxy/fifos" ) var spyDomains = []string{ "google-analytics.com", "goo.gl", "ads.google.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", "reklama-direct-yandex.ru", "yandexadexchange.net", "yandexreklama.com", "doubleclick.net", "tns-counter.ru", } func RoundDenySpy( host string, resp *http.Response, w http.ResponseWriter, req *http.Request, ) (bool, error) { for _, spy := range spyDomains { if strings.HasSuffix(host, spy) { http.NotFound(w, req) fifos.SinkOther <- fmt.Sprintf( "%s %s\t%d\tdeny spy", req.Method, req.URL.String(), http.StatusNotFound, ) return false, nil } } return true, nil }