summaryrefslogtreecommitdiff
path: root/server/main.go
diff options
context:
space:
mode:
authoratanarjuat <atanarjuat@example.org>2022-05-23 09:18:50 +0000
committeratanarjuat <atanarjuat@example.com>2022-05-23 11:19:27 +0200
commitce4b0fb6fb69ffc61bc4fb21b508a6a23b811d55 (patch)
treec6372cce3052448aa48a48a03a7bc2660e004159 /server/main.go
parent0da16a351753eb1bd9b807a01d1b419711226b70 (diff)
add kcp
Diffstat (limited to 'server/main.go')
-rw-r--r--server/main.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/main.go b/server/main.go
index 3ade4dc..f8b7d85 100644
--- a/server/main.go
+++ b/server/main.go
@@ -97,8 +97,13 @@ func main() {
logger.Printf("DEBUG: %v", listenConfig)
- // TODO: pass kcp mode
- ln, err := listenConfig.Listen(ctx, "tcp", addr)
+ var network string
+ if os.Getenv("KCP") == "1" {
+ network = "kcp"
+ } else {
+ network = "tcp"
+ }
+ ln, err := listenConfig.Listen(ctx, network, addr)
if err != nil {
logger.Fatalf("error binding to %s: %v", addr, err)