-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (31 loc) · 847 Bytes
/
main.go
File metadata and controls
37 lines (31 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"flag"
"log"
"krzyzanowski.dev/archat/client"
"krzyzanowski.dev/archat/common"
"krzyzanowski.dev/archat/server"
)
func main() {
wsapiAddr := flag.String("waddr", ":8080", "An IP address of the websocket API endpoint")
udpAddr := flag.String("uaddr", ":8081", "An IP address of the UDP hole-punching listener")
runType := flag.String("run", "client", "Either one of 'client' or 'server'")
flag.Parse()
commonSettings := common.Settings{
WsapiAddr: *wsapiAddr,
UdpAddr: *udpAddr,
}
if *runType == "client" {
settings := common.ClientSettings{
Settings: commonSettings,
}
client.RunClient(settings)
} else if *runType == "server" {
settings := common.ServerSettings{
Settings: commonSettings,
}
server.RunServer(settings)
} else {
log.Fatalf("Unknown run type %s\n", *runType)
}
}