nmdc-ircfrontend/main.go
. e866451b7a remove support for multiple channels
--HG--
branch : nmdc-ircfrontend
2016-05-02 19:23:15 +12:00

49 lines
920 B
Go

package main
import (
"flag"
"log"
"net"
)
var (
ircAddress = flag.String("bind", ":6697", "The address:port to bind to and listen for clients on")
dcAddress = flag.String("upstream", "127.0.0.1:411", "Upstream NMDC server")
serverName = flag.String("servername", "nmdc-ircfrontend", "Server name displayed to clients")
)
func main() {
flag.Parse()
log.Println("Starting server...")
server := NewServer(*serverName)
if len(server.name) == 0 {
log.Println("Please specify the -servername parameter.")
return
}
server.motd = "Connected to " + *serverName
listener, err := net.Listen("tcp", *ircAddress)
if err != nil {
log.Printf(err.Error())
return
}
go server.Run()
log.Printf("Listening on %s", *ircAddress)
for {
conn, err := listener.Accept()
if err != nil {
log.Printf("Error accepting connection (%s)", err.Error())
continue
}
server.HandleConnection(conn)
}
}