diff options
author | atanarjuat <atanarjuat@example.org> | 2022-05-23 09:18:50 +0000 |
---|---|---|
committer | atanarjuat <atanarjuat@example.com> | 2022-05-23 11:19:27 +0200 |
commit | ce4b0fb6fb69ffc61bc4fb21b508a6a23b811d55 (patch) | |
tree | c6372cce3052448aa48a48a03a7bc2660e004159 /server | |
parent | 0da16a351753eb1bd9b807a01d1b419711226b70 (diff) |
add kcp
Diffstat (limited to 'server')
-rw-r--r-- | server/Makefile | 5 | ||||
-rw-r--r-- | server/main.go | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/server/Makefile b/server/Makefile index 853469b..02b24a9 100644 --- a/server/Makefile +++ b/server/Makefile @@ -5,7 +5,10 @@ build: go build run: - sudo ./obfsproxy -addr ${LHOST} -vpn ${RHOST} -state test_data -c test_data/obfs4.json + sudo ./server -addr ${LHOST} -vpn ${RHOST} -state test_data -c test_data/obfs4.json + +run-kcp: + sudo KCP=1 ./server -addr ${LHOST} -vpn ${RHOST} -state test_data -c test_data/obfs4.json stop: pkill -9 obfsproxy 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) |