]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - fifos/start.go
Ability to remove hosts from the states, refactoring
[tofuproxy.git] / fifos / start.go
diff --git a/fifos/start.go b/fifos/start.go
new file mode 100644 (file)
index 0000000..f37abe6
--- /dev/null
@@ -0,0 +1,43 @@
+package fifos
+
+import (
+       "path/filepath"
+
+       "go.stargrave.org/tofuproxy/caches"
+)
+
+func Start(fifos string) {
+       go logger(LogCert, filepath.Join(fifos, "log-cert"))
+       go logger(LogDANE, filepath.Join(fifos, "log-dane"))
+       go logger(LogErr, filepath.Join(fifos, "log-err"))
+       go logger(LogHTTPAuth, filepath.Join(fifos, "log-http-auth"))
+       go logger(LogNonOK, filepath.Join(fifos, "log-non-ok"))
+       go logger(LogOK, filepath.Join(fifos, "log-ok"))
+       go logger(LogRedir, filepath.Join(fifos, "log-redir"))
+       go logger(LogReq, filepath.Join(fifos, "log-req"))
+       go logger(LogTLS, filepath.Join(fifos, "log-tls"))
+       go logger(LogTLSAuth, filepath.Join(fifos, "log-tls-auth"))
+       go logger(LogVarious, filepath.Join(fifos, "log-various"))
+
+       go listAccepted(filepath.Join(fifos, "list-accepted"))
+       go listHTTPAuth(filepath.Join(fifos, "list-http-auth"))
+       go listRejected(filepath.Join(fifos, "list-rejected"))
+       go listTLSAuth(filepath.Join(fifos, "list-tls-auth"))
+
+       go del(
+               &caches.AcceptedM, func(host string) { delete(caches.Accepted, host) },
+               filepath.Join(fifos, "del-accepted"),
+       )
+       go del(
+               &caches.HTTPAuthCacheM, func(host string) { delete(caches.HTTPAuthCache, host) },
+               filepath.Join(fifos, "del-http-auth"),
+       )
+       go del(
+               &caches.RejectedM, func(host string) { delete(caches.Rejected, host) },
+               filepath.Join(fifos, "del-rejected"),
+       )
+       go del(
+               &caches.TLSAuthCacheM, func(host string) { delete(caches.TLSAuthCache, host) },
+               filepath.Join(fifos, "del-tls-auth"),
+       )
+}