From 7cabaef17d54a5cf5b22c807c12c452ac9df84e1 Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Tue, 3 Feb 2026 00:00:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EIPv6/IPv4=E4=BA=92=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Forward-Tools/socat_tools.sh | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Forward-Tools/socat_tools.sh b/Forward-Tools/socat_tools.sh index 606308c..fe1dcae 100644 --- a/Forward-Tools/socat_tools.sh +++ b/Forward-Tools/socat_tools.sh @@ -87,12 +87,16 @@ create_service() { read -rp "目标端口: " TARGET_PORT echo "协议类型:" - echo "1) TCP (IPv4)" - echo "2) TCP (IPv6)" - echo "3) UDP (IPv4)" - echo "4) UDP (IPv6)" + echo "1) TCP (IPv4) TO TCP (IPv4)" + echo "2) TCP (IPv6) TO TCP (IPv6)" + echo "3) UDP (IPv4) TO UDP (IPv4)" + echo "4) UDP (IPv6) TO UDP (IPv6)" + echo "5) TCP (IPv4) TO TCP (IPv6)" + echo "6) TCP (IPv6) TO TCP (IPv4)" + echo "7) UDP (IPv4) TO UDP (IPv6)" + echo "8) UDP (IPv6) TO UDP (IPv4)" - read -rp "选择 (1/2/3/4): " PROTO_CHOICE + read -rp "选择 (1/2/3/4/5/6/7/8): " PROTO_CHOICE case "$PROTO_CHOICE" in 1) @@ -111,6 +115,23 @@ create_service() { PROTO="udp6" SOCAT_CMD="UDP6-LISTEN:${LOCAL_PORT},reuseaddr,fork UDP6:${TARGET_IP}:${TARGET_PORT}" ;; + 5) + PROTO="tcp4to6" + SOCAT_CMD="TCP-LISTEN:${LOCAL_PORT},reuseaddr,fork TCP6:${TARGET_IP}:${TARGET_PORT}" + ;; + 6) + PROTO="tcp6to4" + SOCAT_CMD="TCP6-LISTEN:${LOCAL_PORT},reuseaddr,fork TCP:${TARGET_IP}:${TARGET_PORT}" + ;; + 7) + PROTO="udp4to6" + SOCAT_CMD="UDP-LISTEN:${LOCAL_PORT},reuseaddr,fork UDP6:${TARGET_IP}:${TARGET_PORT}" + ;; + 8) + PROTO="udp6to4" + SOCAT_CMD="UDP6-LISTEN:${LOCAL_PORT},reuseaddr,fork UDP:${TARGET_IP}:${TARGET_PORT}" + ;; + *) echo "❌ 无效选择" return