2023-09-19 20:18:20 +00:00
|
|
|
package main
|
|
|
|
|
2023-09-21 17:10:27 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"flag"
|
|
|
|
"os"
|
|
|
|
)
|
2023-09-19 20:18:20 +00:00
|
|
|
|
2023-09-21 17:10:27 +00:00
|
|
|
type Server interface {
|
|
|
|
Run()
|
|
|
|
}
|
|
|
|
|
2023-09-19 20:18:20 +00:00
|
|
|
func main() {
|
2023-09-21 17:10:27 +00:00
|
|
|
var challenge int
|
2023-11-26 20:19:00 +00:00
|
|
|
flag.IntVar(&challenge, "challenge",11, "Challenge number")
|
2023-09-21 17:10:27 +00:00
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
var port uint16
|
|
|
|
port = 13370
|
|
|
|
var server Server
|
|
|
|
switch challenge {
|
|
|
|
case 0:
|
|
|
|
server = NewEchoServer(port);
|
|
|
|
case 1:
|
|
|
|
server = NewPrimeServer(port);
|
2023-09-22 19:22:51 +00:00
|
|
|
case 2:
|
|
|
|
server = NewMeansServer(port);
|
2023-09-24 14:01:57 +00:00
|
|
|
case 3:
|
|
|
|
server = NewChatServer(port);
|
2023-09-24 19:33:20 +00:00
|
|
|
case 4:
|
|
|
|
server = NewDatabaseServer(port);
|
2023-09-26 20:39:30 +00:00
|
|
|
case 5:
|
|
|
|
server = NewProxyServer(port);
|
|
|
|
case 6:
|
|
|
|
server = NewSpeedServer(port);
|
2023-11-16 17:49:14 +00:00
|
|
|
case 7:
|
|
|
|
server = NewReverseServer(port);
|
2023-11-18 09:59:36 +00:00
|
|
|
case 8:
|
|
|
|
server = NewSecureServer(port);
|
2023-11-23 18:37:01 +00:00
|
|
|
case 9:
|
|
|
|
server = NewJobServer(port);
|
2023-11-23 21:38:07 +00:00
|
|
|
case 10:
|
|
|
|
server = NewVcsServer(port);
|
2023-11-26 20:19:00 +00:00
|
|
|
case 11:
|
|
|
|
server = NewPestServer(port);
|
2023-09-21 17:10:27 +00:00
|
|
|
default:
|
|
|
|
fmt.Printf("Unknown challenge\n")
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
server.Run()
|
2023-09-19 20:18:20 +00:00
|
|
|
}
|