From 4ab3ef9e0fa0f1722648ade97b6fa921335a9ab6 Mon Sep 17 00:00:00 2001
From: Maxb <bittmanmax@gmail.com>
Date: Tue, 23 Jul 2024 09:37:49 -0700
Subject: [PATCH] Add ability to start obfsvpn server in TCP mode

---
 README.md                               |  1 +
 images/obfsvpn/scripts/start_obfsvpn.sh | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/README.md b/README.md
index b9aadee..487bd6c 100644
--- a/README.md
+++ b/README.md
@@ -153,6 +153,7 @@ Before you can run a obfsvpn server container you need to make sure to set the f
 | `OBFS4_DATA_DIR` | same as `OBFSVPN_STATE`  | ./test_data |
 | `HOP_PT` | run server in hopping pt mode  | 1 if true |
 | `KCP` | run server in KCP transport mode  | 1 if true |
+| `TCP` | run server in w/ tcp as the protocol the server accepts for proxying traffic  | 1 if true |
 
 ### Integration testing
 
diff --git a/images/obfsvpn/scripts/start_obfsvpn.sh b/images/obfsvpn/scripts/start_obfsvpn.sh
index 1d0d61c..0ae388f 100755
--- a/images/obfsvpn/scripts/start_obfsvpn.sh
+++ b/images/obfsvpn/scripts/start_obfsvpn.sh
@@ -85,6 +85,17 @@ elif [[ "$KCP" == "1" ]]; then
         --config "${OBFS4_KEY_FILE:-$OBFS4_DATA_DIR/obfs4.json}" \
         --persist="${PERSIST_BRIDGE_STATE:-false}" \
         -v
+
+elif [[ "$TCP" == "1" ]]; then
+    # start the obfsvpn server in obfs4 mode w/ tcp as the protocol the server accepts for proxying traffic.
+    ./obfsvpn-server \
+        --addr "${OBFS4_HOST}" \
+        --port "${OBFS4_PORT}" \
+        --remote "${OPENVPN_HOST}:${OPENVPN_PORT}" \
+        --state "$OBFS4_DATA_DIR" \
+        --config "${OBFS4_KEY_FILE:-$OBFS4_DATA_DIR/obfs4.json}" \
+        --persist="${PERSIST_BRIDGE_STATE:-false}" \
+        -v
 else
      # start the obfsvpn server in regular obfs4 mode
     ./obfsvpn-server \
-- 
GitLab