Browse Source

Upgrade kcptun to version v20190905.

Use origin kcptun binary with an adapter script.
Qiu Yuzhou 5 years ago
parent
commit
dc38694ffa

+ 8 - 4
ShadowsocksX-NG.xcodeproj/project.pbxproj

@@ -22,6 +22,8 @@
 		9B0BFFF91D0460A70040E62B /* ShadowsocksX_NGTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B0BFFF81D0460A70040E62B /* ShadowsocksX_NGTests.swift */; };
 		9B0BFFF91D0460A70040E62B /* ShadowsocksX_NGTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B0BFFF81D0460A70040E62B /* ShadowsocksX_NGTests.swift */; };
 		9B16E59A1F99FD0700E54DC5 /* icons8-Eye Filled-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B16E5971F99FD0700E54DC5 /* icons8-Eye Filled-50.png */; };
 		9B16E59A1F99FD0700E54DC5 /* icons8-Eye Filled-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B16E5971F99FD0700E54DC5 /* icons8-Eye Filled-50.png */; };
 		9B16E59B1F99FD0700E54DC5 /* icons8-Blind Filled-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B16E5991F99FD0700E54DC5 /* icons8-Blind Filled-50.png */; };
 		9B16E59B1F99FD0700E54DC5 /* icons8-Blind Filled-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B16E5991F99FD0700E54DC5 /* icons8-Blind Filled-50.png */; };
+		9B20804A2326AC460075386C /* kcptun.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B2080482326AC460075386C /* kcptun.sh */; };
+		9B20804B2326AC460075386C /* client in Resources */ = {isa = PBXBuildFile; fileRef = 9B2080492326AC460075386C /* client */; };
 		9B2491B41D0ACC3A003BBECC /* PreferencesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B2491B61D0ACC3A003BBECC /* PreferencesWindowController.xib */; };
 		9B2491B41D0ACC3A003BBECC /* PreferencesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B2491B61D0ACC3A003BBECC /* PreferencesWindowController.xib */; };
 		9B3546721E802B1200B510B4 /* ToastWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3546701E802B1200B510B4 /* ToastWindowController.swift */; };
 		9B3546721E802B1200B510B4 /* ToastWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3546701E802B1200B510B4 /* ToastWindowController.swift */; };
 		9B3546731E802B1200B510B4 /* ToastWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B3546711E802B1200B510B4 /* ToastWindowController.xib */; };
 		9B3546731E802B1200B510B4 /* ToastWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B3546711E802B1200B510B4 /* ToastWindowController.xib */; };
@@ -47,7 +49,6 @@
 		9B5832071E7421B2009D5B7D /* virtual-server-icon-3.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B5832061E7421B2009D5B7D /* virtual-server-icon-3.png */; };
 		9B5832071E7421B2009D5B7D /* virtual-server-icon-3.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B5832061E7421B2009D5B7D /* virtual-server-icon-3.png */; };
 		9B58320B1E7422DB009D5B7D /* http.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B58320A1E7422DB009D5B7D /* http.png */; };
 		9B58320B1E7422DB009D5B7D /* http.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B58320A1E7422DB009D5B7D /* http.png */; };
 		9B5AA0AC209C43C200E8B659 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 9B5AA0AB209C43C200E8B659 /* Credits.rtf */; };
 		9B5AA0AC209C43C200E8B659 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 9B5AA0AB209C43C200E8B659 /* Credits.rtf */; };
-		9B5D13292154A57C00F99F03 /* kcptun_client in Resources */ = {isa = PBXBuildFile; fileRef = 9B5D13282154A57C00F99F03 /* kcptun_client */; };
 		9B5D132A2154A62600F99F03 /* install_kcptun.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B5D13272154A50700F99F03 /* install_kcptun.sh */; };
 		9B5D132A2154A62600F99F03 /* install_kcptun.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B5D13272154A50700F99F03 /* install_kcptun.sh */; };
 		9B6BF9541E27B2570061B9A7 /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B6BF9531E27B2570061B9A7 /* ServiceManagement.framework */; };
 		9B6BF9541E27B2570061B9A7 /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B6BF9531E27B2570061B9A7 /* ServiceManagement.framework */; };
 		9B7297E7214D69C300FD24AA /* libmbedcrypto.2.12.0.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9B7297E5214D68F800FD24AA /* libmbedcrypto.2.12.0.dylib */; };
 		9B7297E7214D69C300FD24AA /* libmbedcrypto.2.12.0.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9B7297E5214D68F800FD24AA /* libmbedcrypto.2.12.0.dylib */; };
@@ -169,6 +170,8 @@
 		9B172A601D0ADA5B00B87B9A /* genstrings.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = genstrings.py; sourceTree = "<group>"; };
 		9B172A601D0ADA5B00B87B9A /* genstrings.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = genstrings.py; sourceTree = "<group>"; };
 		9B172A6B1D0ADDDD00B87B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
 		9B172A6B1D0ADDDD00B87B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
 		9B172A6D1D0ADDE800B87B9A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		9B172A6D1D0ADDE800B87B9A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
+		9B2080482326AC460075386C /* kcptun.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = kcptun.sh; sourceTree = "<group>"; };
+		9B2080492326AC460075386C /* client */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = client; sourceTree = "<group>"; };
 		9B2491B51D0ACC3A003BBECC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreferencesWindowController.xib; sourceTree = "<group>"; };
 		9B2491B51D0ACC3A003BBECC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreferencesWindowController.xib; sourceTree = "<group>"; };
 		9B3546701E802B1200B510B4 /* ToastWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastWindowController.swift; sourceTree = "<group>"; };
 		9B3546701E802B1200B510B4 /* ToastWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastWindowController.swift; sourceTree = "<group>"; };
 		9B3546711E802B1200B510B4 /* ToastWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ToastWindowController.xib; sourceTree = "<group>"; };
 		9B3546711E802B1200B510B4 /* ToastWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ToastWindowController.xib; sourceTree = "<group>"; };
@@ -206,7 +209,6 @@
 		9B5AA0A2209C103900E8B659 /* libcares.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcares.2.dylib; sourceTree = "<group>"; };
 		9B5AA0A2209C103900E8B659 /* libcares.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcares.2.dylib; sourceTree = "<group>"; };
 		9B5AA0AB209C43C200E8B659 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
 		9B5AA0AB209C43C200E8B659 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
 		9B5D13272154A50700F99F03 /* install_kcptun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = install_kcptun.sh; sourceTree = "<group>"; };
 		9B5D13272154A50700F99F03 /* install_kcptun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = install_kcptun.sh; sourceTree = "<group>"; };
-		9B5D13282154A57C00F99F03 /* kcptun_client */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = kcptun_client; sourceTree = "<group>"; };
 		9B6BF9531E27B2570061B9A7 /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; };
 		9B6BF9531E27B2570061B9A7 /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; };
 		9B7297E5214D68F800FD24AA /* libmbedcrypto.2.12.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libmbedcrypto.2.12.0.dylib; sourceTree = "<group>"; };
 		9B7297E5214D68F800FD24AA /* libmbedcrypto.2.12.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libmbedcrypto.2.12.0.dylib; sourceTree = "<group>"; };
 		9B7297E8214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareServerProfilesWindowController.swift; sourceTree = "<group>"; };
 		9B7297E8214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareServerProfilesWindowController.swift; sourceTree = "<group>"; };
@@ -474,7 +476,8 @@
 		9B5D13252154A4B400F99F03 /* kcptun */ = {
 		9B5D13252154A4B400F99F03 /* kcptun */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				9B5D13282154A57C00F99F03 /* kcptun_client */,
+				9B2080492326AC460075386C /* client */,
+				9B2080482326AC460075386C /* kcptun.sh */,
 				9B5D13272154A50700F99F03 /* install_kcptun.sh */,
 				9B5D13272154A50700F99F03 /* install_kcptun.sh */,
 			);
 			);
 			path = kcptun;
 			path = kcptun;
@@ -677,7 +680,6 @@
 				9B0BFFEB1D0460A70040E62B /* Assets.xcassets in Resources */,
 				9B0BFFEB1D0460A70040E62B /* Assets.xcassets in Resources */,
 				08FCA0FF1E24BE1A0070984F /* example-gui-config.json in Resources */,
 				08FCA0FF1E24BE1A0070984F /* example-gui-config.json in Resources */,
 				B5A2AB04221A72EC003F77B7 /* install_v2ray_plugin.sh in Resources */,
 				B5A2AB04221A72EC003F77B7 /* install_v2ray_plugin.sh in Resources */,
-				9B5D13292154A57C00F99F03 /* kcptun_client in Resources */,
 				1C82DBA81FA96C7500B32551 /* obfs-local in Resources */,
 				1C82DBA81FA96C7500B32551 /* obfs-local in Resources */,
 				9B938D9D1E864B38005F5636 /* menu_p_icon.png in Resources */,
 				9B938D9D1E864B38005F5636 /* menu_p_icon.png in Resources */,
 				9B938D9B1E864B38005F5636 /* menu_m_icon.png in Resources */,
 				9B938D9B1E864B38005F5636 /* menu_m_icon.png in Resources */,
@@ -687,6 +689,7 @@
 				9B58320B1E7422DB009D5B7D /* http.png in Resources */,
 				9B58320B1E7422DB009D5B7D /* http.png in Resources */,
 				9BC70EDC1D2E3E3100EDA4CA /* Localizable.strings in Resources */,
 				9BC70EDC1D2E3E3100EDA4CA /* Localizable.strings in Resources */,
 				9B16E59B1F99FD0700E54DC5 /* icons8-Blind Filled-50.png in Resources */,
 				9B16E59B1F99FD0700E54DC5 /* icons8-Blind Filled-50.png in Resources */,
+				9B20804B2326AC460075386C /* client in Resources */,
 				9B0BFFEE1D0460A70040E62B /* MainMenu.xib in Resources */,
 				9B0BFFEE1D0460A70040E62B /* MainMenu.xib in Resources */,
 				9B3FFF4C1D09D8F70019A709 /* install_helper.sh in Resources */,
 				9B3FFF4C1D09D8F70019A709 /* install_helper.sh in Resources */,
 				C6D429961DA75988002A5711 /* start_privoxy.sh in Resources */,
 				C6D429961DA75988002A5711 /* start_privoxy.sh in Resources */,
@@ -694,6 +697,7 @@
 				9B5AA0AC209C43C200E8B659 /* Credits.rtf in Resources */,
 				9B5AA0AC209C43C200E8B659 /* Credits.rtf in Resources */,
 				9B07EFA71D048BBB0052D9DF /* ss-local in Resources */,
 				9B07EFA71D048BBB0052D9DF /* ss-local in Resources */,
 				9B07EFAF1D048E880052D9DF /* menu_icon_disabled@2x.png in Resources */,
 				9B07EFAF1D048E880052D9DF /* menu_icon_disabled@2x.png in Resources */,
+				9B20804A2326AC460075386C /* kcptun.sh in Resources */,
 				9B07EFAE1D048E880052D9DF /* menu_icon_disabled.png in Resources */,
 				9B07EFAE1D048E880052D9DF /* menu_icon_disabled.png in Resources */,
 				9B938D991E864B38005F5636 /* menu_g_icon.png in Resources */,
 				9B938D991E864B38005F5636 /* menu_g_icon.png in Resources */,
 			);
 			);

+ 1 - 1
ShadowsocksX-NG/Credits.rtf

@@ -8,7 +8,7 @@
 \f0\fs24 \cf0 ss-local}}
 \f0\fs24 \cf0 ss-local}}
 \f0\fs24  v3.2.5\
 \f0\fs24  v3.2.5\
 \pard\tx560\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
 \pard\tx560\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
-{\field{\*\fldinst{HYPERLINK "https://github.com/shadowsocks/kcptun"}}{\fldrslt \cf0 kcptun}} v20170718\
+{\field{\*\fldinst{HYPERLINK "https://github.com/shadowsocks/kcptun"}}{\fldrslt \cf0 kcptun}} v20190905\
 \pard\tx560\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
 \pard\tx560\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
 {\field{\*\fldinst{HYPERLINK "https://github.com/shadowsocks/simple-obfs"}}{\fldrslt \cf0 simple-obfs}} v0.0.5\
 {\field{\*\fldinst{HYPERLINK "https://github.com/shadowsocks/simple-obfs"}}{\fldrslt \cf0 simple-obfs}} v0.0.5\
 \pard\tx560\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
 \pard\tx560\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0

+ 2 - 2
ShadowsocksX-NG/LaunchAgentUtils.swift

@@ -9,7 +9,7 @@
 import Foundation
 import Foundation
 
 
 let SS_LOCAL_VERSION = "3.2.5"
 let SS_LOCAL_VERSION = "3.2.5"
-let KCPTUN_CLIENT_VERSION = "v20170718"
+let KCPTUN_CLIENT_VERSION = "v20190905"
 let V2RAY_PLUGIN_VERSION = "1.1.0"
 let V2RAY_PLUGIN_VERSION = "1.1.0"
 let PRIVOXY_VERSION = "3.0.26.static"
 let PRIVOXY_VERSION = "3.0.26.static"
 let SIMPLE_OBFS_VERSION = "0.0.5_1"
 let SIMPLE_OBFS_VERSION = "0.0.5_1"
@@ -225,7 +225,7 @@ func InstallKcptun() {
     let fileMgr = FileManager.default
     let fileMgr = FileManager.default
     let homeDir = NSHomeDirectory()
     let homeDir = NSHomeDirectory()
     let appSupportDir = homeDir+APP_SUPPORT_DIR
     let appSupportDir = homeDir+APP_SUPPORT_DIR
-    if !fileMgr.fileExists(atPath: appSupportDir + "kcptun_\(KCPTUN_CLIENT_VERSION)/kcptun_client") {
+    if !fileMgr.fileExists(atPath: appSupportDir + "kcptun_\(KCPTUN_CLIENT_VERSION)/client") {
         let bundle = Bundle.main
         let bundle = Bundle.main
         let installerPath = bundle.path(forResource: "install_kcptun", ofType: "sh")
         let installerPath = bundle.path(forResource: "install_kcptun", ofType: "sh")
         let task = Process.launchedProcess(launchPath: "/bin/sh", arguments: [installerPath!])
         let task = Process.launchedProcess(launchPath: "/bin/sh", arguments: [installerPath!])

BIN
ShadowsocksX-NG/kcptun/client


+ 11 - 5
ShadowsocksX-NG/kcptun/install_kcptun.sh

@@ -4,17 +4,23 @@
 #  ShadowsocksX-NG
 #  ShadowsocksX-NG
 #
 #
 #  Created by 邱宇舟 on 2018/9/21.
 #  Created by 邱宇舟 on 2018/9/21.
-#  Copyright © 2018年 qiuyuzhou. All rights reserved.
+#  Copyright © 2018-2019年 qiuyuzhou. All rights reserved.
 
 
-# https://github.com/shadowsocks/kcptun/releases
+# Use kcptune bianry from here which is not support SIP003.
+# We use an adatper to handle it.
+# https://github.com/xtaci/kcptun/releases
 
 
-VERSION="v20170718"
+VERSION="v20190905"
 
 
 cd "$(dirname "${BASH_SOURCE[0]}")"
 cd "$(dirname "${BASH_SOURCE[0]}")"
 
 
 mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION"
 mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION"
-cp -f kcptun_client "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION/"
+cp -f client "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION/"
 
 
-ln -sfh "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION/kcptun_client" "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/kcptun"
+# Delete old kcptun symbol link
+rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/kcptun"
+
+# Copy adapter shell script to plugin folder
+cp -f kcptun.sh "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/kcptun"
 
 
 echo "install kcptun done"
 echo "install kcptun done"

+ 43 - 0
ShadowsocksX-NG/kcptun/kcptun.sh

@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# A shadowsocks SIP003 adapter shell script.
+#
+# SIP003 Docucment: https://github.com/shadowsocks/shadowsocks-org/issues/28
+#
+# Created by Qiu Yuzhou on 2019-09-09
+# Copyright © 2019 Qiu Yuzhou. All rights reserved.
+
+# test data, Start
+# SS_REMOTE_HOST=127.0.0.1
+# SS_REMOTE_PORT=8088
+# SS_LOCAL_HOST=192.168.1.1
+# SS_LOCAL_PORT=888
+# test data, End
+
+SS_ENV_NAMES=(SS_REMOTE_HOST SS_REMOTE_PORT SS_LOCAL_HOST SS_LOCAL_PORT)
+
+for i in "${SS_ENV_NAMES[@]}"; do
+    if [ -z ${!i} ]
+    then
+        echo Not found env variable $i
+        exit
+    fi
+done
+
+# Split options
+IFS=';' read -ra _OPTS <<< "${SS_PLUGIN_OPTIONS}"
+
+# Prepend `--`
+OPTS=()
+for i in "${_OPTS[@]}"; do
+    OPTS+=("--$i")
+done
+
+PLUGIN_NAME="kcptun"
+PLUGIN_VERSION="v20190905"
+PLUGIN_BINARY_NAME="client"
+
+CMD="$(dirname "${BASH_SOURCE[0]}")/../${PLUGIN_NAME}_${PLUGIN_VERSION}/${PLUGIN_BINARY_NAME}"
+
+# Update this line when adapted other plugin.
+"$CMD" -r "${SS_REMOTE_HOST}:${SS_REMOTE_PORT}" -l "${SS_LOCAL_HOST}:${SS_LOCAL_PORT}" ${OPTS[@]}

BIN
ShadowsocksX-NG/kcptun/kcptun_client