/*
-tofuproxy -- HTTP proxy with TLS certificates management
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
+tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
+ manager, WARC/geminispace browser
+Copyright (C) 2021-2022 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
"go.cypherpunks.ru/ucspi"
"go.stargrave.org/tofuproxy"
"go.stargrave.org/tofuproxy/fifos"
+ "go.stargrave.org/tofuproxy/rounds"
+ ttls "go.stargrave.org/tofuproxy/tls"
)
func main() {
crtPath := flag.String("cert", "cert.pem", "Path to server X.509 certificate")
- prvPath := flag.String("key", "prv.pem", "Path to server PKCS#8 private key")
+ prvPath := flag.String("key", "cert.pem", "Path to server PKCS#8 private key")
bind := flag.String("bind", "[::1]:8080", "Bind address")
- certs := flag.String("certs", "certs", "Directory with pinned certificates")
+ certs := flag.String("certs", "./certs", "Directory with pinned certificates")
+ ccerts := flag.String("ccerts", "./ccerts", "Directory with client certificates")
dnsSrv := flag.String("dns", "[::1]:53", "DNS server")
fifosDir := flag.String("fifos", "fifos", "Directory with FIFOs")
notai := flag.Bool("notai", false, "Do not prepend TAI64N to logs")
+ warcOnly := flag.Bool("warc-only", false, "Server only WARC URIs")
flag.Parse()
log.SetFlags(log.Lshortfile)
}
fifos.NoTAI = *notai
- fifos.FIFOs = *fifosDir
- fifos.Init()
- tofuproxy.Certs = *certs
- tofuproxy.DNSSrv = *dnsSrv
+ fifos.Start(*fifosDir)
+ ttls.Certs = *certs
+ ttls.CCerts = *ccerts
+ ttls.DNSSrv = *dnsSrv
tofuproxy.CACert = caCert
tofuproxy.CAPrv = caPrv
+ rounds.WARCOnly = *warcOnly
ln, err := net.Listen("tcp", *bind)
if err != nil {
Handler: &tofuproxy.Handler{},
TLSNextProto: tofuproxy.TLSNextProtoS,
}
- log.Println("listening:", *bind, "certs:", *certs)
+ log.Println("listening:", *bind, "dns:", *dnsSrv, "certs:", *certs, "ccerts:", *ccerts)
if err := srv.Serve(ln); err != nil {
log.Fatalln(err)
}