// tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU // manager, WARC/geminispace browser // Copyright (C) 2021-2024 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/caches" "go.stargrave.org/tofuproxy/fifos" ) func IsSpy(host string) bool { caches.SpiesM.RLock() defer caches.SpiesM.RUnlock() for _, spy := range caches.Spies { if strings.HasSuffix(host, spy) { return true } } return false } func RoundDenySpy( host string, resp *http.Response, w http.ResponseWriter, req *http.Request, ) (bool, error) { if IsSpy(host) { http.NotFound(w, req) fifos.LogVarious <- fmt.Sprintf("%s %s\tdeny spy", req.Method, req.URL) return false, nil } return true, nil }