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