Server TLS
Start server without TLS by default
This commit is contained in:
parent
afb29670c8
commit
beab244bce
12
server.go
12
server.go
@ -247,12 +247,14 @@ func StartServer() {
|
|||||||
// certFile = fullchain.pem
|
// certFile = fullchain.pem
|
||||||
// keyFile = privkey.pem
|
// keyFile = privkey.pem
|
||||||
|
|
||||||
// comment the following block to disable TLS
|
// uncomment the following block to enable TLS; edit cert files first
|
||||||
|
/*
|
||||||
cert, err := tls.LoadX509KeyPair("/etc/letsencrypt/live/mg25ot4aggt8dprv.myfritz.net/fullchain.pem", "/etc/letsencrypt/live/mg25ot4aggt8dprv.myfritz.net/privkey.pem")
|
cert, err := tls.LoadX509KeyPair("/etc/letsencrypt/live/mg25ot4aggt8dprv.myfritz.net/fullchain.pem", "/etc/letsencrypt/live/mg25ot4aggt8dprv.myfritz.net/privkey.pem")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("/ws", webSocketHandler)
|
mux.HandleFunc("/ws", webSocketHandler)
|
||||||
@ -260,10 +262,10 @@ func StartServer() {
|
|||||||
srv := nbhttp.NewServer(nbhttp.Config{
|
srv := nbhttp.NewServer(nbhttp.Config{
|
||||||
Network: "tcp",
|
Network: "tcp",
|
||||||
Handler: mux,
|
Handler: mux,
|
||||||
// comment the following 2 lines and uncomment "Addrs" to start server without TLS
|
// uncomment the following 2 lines and comment "Addrs" to start server with TLS
|
||||||
AddrsTLS: []string{cfg.Settings.ListenAddress},
|
//AddrsTLS: []string{cfg.Settings.ListenAddress},
|
||||||
TLSConfig: &tls.Config{Certificates: []tls.Certificate{cert}},
|
//TLSConfig: &tls.Config{Certificates: []tls.Certificate{cert}},
|
||||||
//Addrs: []string{cfg.Settings.ListenAddress},
|
Addrs: []string{cfg.Settings.ListenAddress},
|
||||||
})
|
})
|
||||||
|
|
||||||
err = srv.Start()
|
err = srv.Start()
|
||||||
|
Loading…
Reference in New Issue
Block a user