feat(mochi): allows broker to run with and without tls at the same time

This commit is contained in:
Leandro Farias Machado 2023-05-28 19:22:44 -03:00
parent 363849ba4e
commit bae078b734

View File

@ -140,20 +140,19 @@ func main() {
}
}
log.Println("Mqtt Broker is running with TLS")
} else {
if *tcpAddr != "" {
//tcp := listeners.NewTCP("t1", *tcpAddr, &listeners.Config{
// TLSConfig: tlsConfig,
//})
tcp := listeners.NewTCP("t1", *tcpAddr, nil)
err := server.AddListener(tcp)
if err != nil {
log.Fatal(err)
}
}
log.Println("Mqtt Broker is running without TLS, (it's dangerous)")
log.Println("Mqtt Broker is running with TLS at port 8883")
}
if *tcpAddr != "" {
//tcp := listeners.NewTCP("t1", *tcpAddr, &listeners.Config{
// TLSConfig: tlsConfig,
//})
tcp := listeners.NewTCP("t1", *tcpAddr, nil)
err := server.AddListener(tcp)
if err != nil {
log.Fatal(err)
}
}
log.Println("Mqtt Broker is running without TLS at port 1883")
if *wsAddr != "" {
ws := listeners.NewWebsocket("ws1", *wsAddr, nil)