2024-03-21 21:36:25 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
2024-03-22 17:12:44 +00:00
|
|
|
|
2024-03-22 18:38:19 +00:00
|
|
|
"krzyzanowski.dev/p2pchat/client"
|
|
|
|
"krzyzanowski.dev/p2pchat/server"
|
2024-03-21 21:36:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
args := os.Args[1:]
|
|
|
|
|
|
|
|
if len(args) != 1 {
|
|
|
|
log.Fatalln("You must provide only one argument which is type of " +
|
|
|
|
"application: 'server' or 'client'")
|
|
|
|
}
|
|
|
|
|
|
|
|
runType := args[0]
|
|
|
|
|
|
|
|
if runType == "client" {
|
2024-03-22 18:38:19 +00:00
|
|
|
client.RunClient()
|
2024-03-21 21:36:25 +00:00
|
|
|
} else if runType == "server" {
|
2024-03-22 18:38:19 +00:00
|
|
|
server.RunServer()
|
2024-03-21 21:36:25 +00:00
|
|
|
} else {
|
|
|
|
log.Fatalf("Unknown run type %s\n", runType)
|
|
|
|
}
|
|
|
|
}
|