2 tofuproxy -- flexible HTTP/WARC proxy with TLS certificates management
3 Copyright (C) 2021 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/>.
23 "go.stargrave.org/tofuproxy/caches"
24 "go.stargrave.org/tofuproxy/warc"
27 func Start(fifos string) {
28 go logger(LogCert, filepath.Join(fifos, "log-cert"))
29 go logger(LogDANE, filepath.Join(fifos, "log-dane"))
30 go logger(LogErr, filepath.Join(fifos, "log-err"))
31 go logger(LogHTTPAuth, filepath.Join(fifos, "log-http-auth"))
32 go logger(LogNonOK, filepath.Join(fifos, "log-non-ok"))
33 go logger(LogOK, filepath.Join(fifos, "log-ok"))
34 go logger(LogRedir, filepath.Join(fifos, "log-redir"))
35 go logger(LogReq, filepath.Join(fifos, "log-req"))
36 go logger(LogTLS, filepath.Join(fifos, "log-tls"))
37 go logger(LogTLSAuth, filepath.Join(fifos, "log-tls-auth"))
38 go logger(LogVarious, filepath.Join(fifos, "log-various"))
39 go logger(LogWARC, filepath.Join(fifos, "log-warc"))
41 go listAccepted(filepath.Join(fifos, "list-accepted"))
42 go listHTTPAuth(filepath.Join(fifos, "list-http-auth"))
43 go listRejected(filepath.Join(fifos, "list-rejected"))
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 &caches.TLSAuthCacheM, func(host string) { delete(caches.TLSAuthCache, host) },
62 filepath.Join(fifos, "del-tls-auth"),
65 go addSpy(filepath.Join(fifos, "add-spies"))
67 &caches.SpiesM, func(host string) {
68 for i, spy := range caches.Spies {
70 caches.Spies[i] = caches.Spies[len(caches.Spies)-1]
71 caches.Spies = caches.Spies[:len(caches.Spies)-1]
76 filepath.Join(fifos, "del-spies"),
79 go addWARC(filepath.Join(fifos, "add-warcs"))
81 &warc.WARCsM, func(warcPath string) {
82 delete(warc.WARCs, warcPath)
83 delete(warc.WARCsOffsets, warcPath)
85 filepath.Join(fifos, "del-warcs"),