1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-15 17:46:55 +00:00

Work on pub/sub and peer cert setup

This commit is contained in:
Kane York 2015-10-25 03:21:50 -07:00
parent d4afc3c4c7
commit 401f66f15b
7 changed files with 478 additions and 48 deletions

View file

@ -9,8 +9,13 @@ import (
var origin *string = flag.String("origin", "localhost:8001", "Client-visible origin of the socket server")
var bindAddress *string = flag.String("listen", "", "Address to bind to, if different from origin")
var certificateFile *string = flag.String("crt", "", "SSL certificate file")
var privateKeyFile *string = flag.String("key", "", "SSL private key file")
var usessl *bool = flag.Bool("ssl", false, "Enable the use of SSL for connecting clients and backend connections")
var certificateFile *string = flag.String("crt", "ssl.crt", "CA-signed SSL certificate file")
var privateKeyFile *string = flag.String("key", "ssl.key", "SSL private key file")
var backendRootFile *string = flag.String("peerroot", "backend_issuer.pem", "Root certificate that issued client certificates for backend servers")
var backendCertFile *string = flag.String("peercrt", "backend_cert.crt", "Backend-trusted certificate, for use as a client certificate")
var backendKeyFile *string = flag.String("peerkey", "backend_cert.key", "Private key for backend-trusted certificate, for use as a client certificate")
var basicAuthPwd *string = flag.String("password", "", "Password for HTTP Basic Auth") // TODO
func main() {
flag.Parse()
@ -29,17 +34,24 @@ func main() {
SSLKeyFile: *privateKeyFile,
SSLCertificateFile: *certificateFile,
UseSSL: *certificateFile != "",
BackendRootCertFile: *backendRootFile,
BackendClientCertFile: *backendCertFile,
BackendClientKeyFile: *backendKeyFile,
SocketOrigin: *origin,
}
server.SetupServerAndHandle(conf)
httpServer := &http.Server{
Addr: *bindAddress
}
server.SetupServerAndHandle(conf, httpServer.TLSConfig)
var err error
if conf.UseSSL {
err = http.ListenAndServeTLS(*bindAddress, *certificateFile, *privateKeyFile, nil)
err = httpServer.ListenAndServeTLS(nil, nil)
} else {
err = http.ListenAndServe(*bindAddress, nil)
err = httpServer.ListenAndServe()
}
if err != nil {