remove TLS support (should be provided by a reverse proxy)
--HG-- branch : nmdc-ircfrontend
This commit is contained in:
parent
9b5c010e1a
commit
570662cdcc
33
main.go
33
main.go
@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
@ -9,8 +8,6 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
tlsKeyFile = flag.String("tls-key", "tls.key", "The private key file used for TLS")
|
||||
tlsCertFile = flag.String("tls-cert", "tls.crt", "The certificate file used for TLS")
|
||||
ircAddress = flag.String("irc-address", ":6697", "The address:port to bind to and listen for clients on")
|
||||
serverName = flag.String("irc-servername", "rosella", "Server name displayed to clients")
|
||||
authFile = flag.String("irc-authfile", "", "File containing usernames and passwords of operators.")
|
||||
@ -71,34 +68,8 @@ func main() {
|
||||
server.motd = string(data[:size])
|
||||
}
|
||||
|
||||
tlsConfig := new(tls.Config)
|
||||
|
||||
tlsConfig.PreferServerCipherSuites = true
|
||||
tlsConfig.CipherSuites = []uint16{
|
||||
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA}
|
||||
|
||||
cert, err := tls.LoadX509KeyPair(*tlsCertFile, *tlsKeyFile)
|
||||
listener, err := net.Listen("tcp", *ircAddress)
|
||||
if err != nil {
|
||||
log.Printf("Error loading tls certificate and key files.")
|
||||
log.Printf(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Loaded certificate and key successfully.")
|
||||
|
||||
tlsConfig.Certificates = []tls.Certificate{cert}
|
||||
|
||||
//Fills out tlsConfig.NameToCertificate
|
||||
tlsConfig.BuildNameToCertificate()
|
||||
|
||||
tlsListener, err := tls.Listen("tcp", *ircAddress, tlsConfig)
|
||||
if err != nil {
|
||||
log.Printf("Could not open tls listener.")
|
||||
log.Printf(err.Error())
|
||||
return
|
||||
}
|
||||
@ -108,7 +79,7 @@ func main() {
|
||||
log.Printf("Listening on %s", *ircAddress)
|
||||
|
||||
for {
|
||||
conn, err := tlsListener.Accept()
|
||||
conn, err := listener.Accept()
|
||||
if err != nil {
|
||||
log.Printf("Error accepting connection.")
|
||||
log.Printf(err.Error())
|
||||
|
Loading…
Reference in New Issue
Block a user