/*
-tofuproxy -- HTTP proxy with TLS certificates management
+tofuproxy -- flexible HTTP proxy, TLS terminator, X.509 certificates
+ manager, WARC/Gemini browser
Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
"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
}
) (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