1 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
2 // manager, WARC/geminispace browser
3 // Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, version 3 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 "go.stargrave.org/tofuproxy/caches"
23 "go.stargrave.org/tofuproxy/warc"
26 func Start(fifos string) {
27 go logger(LogCert, filepath.Join(fifos, "log-cert"))
28 go logger(LogDANE, filepath.Join(fifos, "log-dane"))
29 go logger(LogErr, filepath.Join(fifos, "log-err"))
30 go logger(LogHTTPAuth, filepath.Join(fifos, "log-http-auth"))
31 go logger(LogNonOK, filepath.Join(fifos, "log-non-ok"))
32 go logger(LogOK, filepath.Join(fifos, "log-ok"))
33 go logger(LogRedir, filepath.Join(fifos, "log-redir"))
34 go logger(LogReq, filepath.Join(fifos, "log-req"))
35 go logger(LogTLS, filepath.Join(fifos, "log-tls"))
36 go logger(LogTLSAuth, filepath.Join(fifos, "log-tls-auth"))
37 go logger(LogVarious, filepath.Join(fifos, "log-various"))
38 go logger(LogWARC, filepath.Join(fifos, "log-warc"))
40 go listAccepted(filepath.Join(fifos, "list-accepted"))
41 go listHTTPAuth(filepath.Join(fifos, "list-http-auth"))
42 go listRejected(filepath.Join(fifos, "list-rejected"))
43 go listRestricted(filepath.Join(fifos, "list-restricted"))
44 go listSpies(filepath.Join(fifos, "list-spies"))
45 go listTLSAuth(filepath.Join(fifos, "list-tls-auth"))
46 go listWARCs(filepath.Join(fifos, "list-warcs"))
49 &caches.AcceptedM, func(host string) { delete(caches.Accepted, host) },
50 filepath.Join(fifos, "del-accepted"),
53 &caches.HTTPAuthCacheM, func(host string) { delete(caches.HTTPAuthCache, host) },
54 filepath.Join(fifos, "del-http-auth"),
57 &caches.RejectedM, func(host string) { delete(caches.Rejected, host) },
58 filepath.Join(fifos, "del-rejected"),
61 go addRestricted(filepath.Join(fifos, "add-restricted"))
63 go addSpy(filepath.Join(fifos, "add-spies"))
65 &caches.SpiesM, func(host string) {
66 for i, spy := range caches.Spies {
68 caches.Spies[i] = caches.Spies[len(caches.Spies)-1]
69 caches.Spies = caches.Spies[:len(caches.Spies)-1]
74 filepath.Join(fifos, "del-spies"),
77 go addWARC(filepath.Join(fifos, "add-warcs"))
79 &warc.WARCsM, func(warcPath string) {
80 delete(warc.WARCs, warcPath)
81 delete(warc.WARCsOffsets, warcPath)
83 filepath.Join(fifos, "del-warcs"),
86 go addTLSAuth(filepath.Join(fifos, "add-tls-auth"))
88 &caches.TLSAuthCacheM, func(host string) { delete(caches.TLSAuthCache, host) },
89 filepath.Join(fifos, "del-tls-auth"),