package main import ( "fmt" "server/core" "server/game" "server/packet" "time" ) func main() { // Init server server := core.New() server.SetHandler(packet.Ping, game.Ping) server.SetHandler(packet.Login, game.Login) // Show statistics ticker := time.NewTicker(time.Second) go func() { for { select { case <-ticker.C: fmt.Printf("%d packets per second, %d clients\n", server.PacketCount(), game.Clients.Count()) server.ResetPacketCount() } } }() // Start listening server.Run(4242) }