diff --git a/ShadowsocksX-NG.xcodeproj/project.pbxproj b/ShadowsocksX-NG.xcodeproj/project.pbxproj index a43ce24..9a6c3fe 100755 --- a/ShadowsocksX-NG.xcodeproj/project.pbxproj +++ b/ShadowsocksX-NG.xcodeproj/project.pbxproj @@ -22,6 +22,8 @@ 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 */; }; 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 */; }; 9B3546721E802B1200B510B4 /* ToastWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3546701E802B1200B510B4 /* ToastWindowController.swift */; }; 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 */; }; 9B58320B1E7422DB009D5B7D /* http.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B58320A1E7422DB009D5B7D /* http.png */; }; 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 */; }; 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 */; }; @@ -169,6 +170,8 @@ 9B172A601D0ADA5B00B87B9A /* genstrings.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = genstrings.py; sourceTree = ""; }; 9B172A6B1D0ADDDD00B87B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = ""; }; 9B172A6D1D0ADDE800B87B9A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; + 9B2080482326AC460075386C /* kcptun.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = kcptun.sh; sourceTree = ""; }; + 9B2080492326AC460075386C /* client */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = client; sourceTree = ""; }; 9B2491B51D0ACC3A003BBECC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreferencesWindowController.xib; sourceTree = ""; }; 9B3546701E802B1200B510B4 /* ToastWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastWindowController.swift; sourceTree = ""; }; 9B3546711E802B1200B510B4 /* ToastWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ToastWindowController.xib; sourceTree = ""; }; @@ -206,7 +209,6 @@ 9B5AA0A2209C103900E8B659 /* libcares.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcares.2.dylib; sourceTree = ""; }; 9B5AA0AB209C43C200E8B659 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; 9B5D13272154A50700F99F03 /* install_kcptun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = install_kcptun.sh; sourceTree = ""; }; - 9B5D13282154A57C00F99F03 /* kcptun_client */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = kcptun_client; sourceTree = ""; }; 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 = ""; }; 9B7297E8214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareServerProfilesWindowController.swift; sourceTree = ""; }; @@ -474,7 +476,8 @@ 9B5D13252154A4B400F99F03 /* kcptun */ = { isa = PBXGroup; children = ( - 9B5D13282154A57C00F99F03 /* kcptun_client */, + 9B2080492326AC460075386C /* client */, + 9B2080482326AC460075386C /* kcptun.sh */, 9B5D13272154A50700F99F03 /* install_kcptun.sh */, ); path = kcptun; @@ -677,7 +680,6 @@ 9B0BFFEB1D0460A70040E62B /* Assets.xcassets in Resources */, 08FCA0FF1E24BE1A0070984F /* example-gui-config.json in Resources */, B5A2AB04221A72EC003F77B7 /* install_v2ray_plugin.sh in Resources */, - 9B5D13292154A57C00F99F03 /* kcptun_client in Resources */, 1C82DBA81FA96C7500B32551 /* obfs-local in Resources */, 9B938D9D1E864B38005F5636 /* menu_p_icon.png in Resources */, 9B938D9B1E864B38005F5636 /* menu_m_icon.png in Resources */, @@ -687,6 +689,7 @@ 9B58320B1E7422DB009D5B7D /* http.png in Resources */, 9BC70EDC1D2E3E3100EDA4CA /* Localizable.strings in Resources */, 9B16E59B1F99FD0700E54DC5 /* icons8-Blind Filled-50.png in Resources */, + 9B20804B2326AC460075386C /* client in Resources */, 9B0BFFEE1D0460A70040E62B /* MainMenu.xib in Resources */, 9B3FFF4C1D09D8F70019A709 /* install_helper.sh in Resources */, C6D429961DA75988002A5711 /* start_privoxy.sh in Resources */, @@ -694,6 +697,7 @@ 9B5AA0AC209C43C200E8B659 /* Credits.rtf in Resources */, 9B07EFA71D048BBB0052D9DF /* ss-local in Resources */, 9B07EFAF1D048E880052D9DF /* menu_icon_disabled@2x.png in Resources */, + 9B20804A2326AC460075386C /* kcptun.sh in Resources */, 9B07EFAE1D048E880052D9DF /* menu_icon_disabled.png in Resources */, 9B938D991E864B38005F5636 /* menu_g_icon.png in Resources */, ); diff --git a/ShadowsocksX-NG/Credits.rtf b/ShadowsocksX-NG/Credits.rtf index 895a520..7aca55c 100644 --- a/ShadowsocksX-NG/Credits.rtf +++ b/ShadowsocksX-NG/Credits.rtf @@ -8,7 +8,7 @@ \f0\fs24 \cf0 ss-local}} \f0\fs24 v3.2.5\ \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 {\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 diff --git a/ShadowsocksX-NG/LaunchAgentUtils.swift b/ShadowsocksX-NG/LaunchAgentUtils.swift index 3c081af..b71a556 100644 --- a/ShadowsocksX-NG/LaunchAgentUtils.swift +++ b/ShadowsocksX-NG/LaunchAgentUtils.swift @@ -9,7 +9,7 @@ import Foundation 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 PRIVOXY_VERSION = "3.0.26.static" let SIMPLE_OBFS_VERSION = "0.0.5_1" @@ -225,7 +225,7 @@ func InstallKcptun() { let fileMgr = FileManager.default let homeDir = NSHomeDirectory() 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 installerPath = bundle.path(forResource: "install_kcptun", ofType: "sh") let task = Process.launchedProcess(launchPath: "/bin/sh", arguments: [installerPath!]) diff --git a/ShadowsocksX-NG/kcptun/client b/ShadowsocksX-NG/kcptun/client new file mode 100755 index 0000000..8a77ad6 Binary files /dev/null and b/ShadowsocksX-NG/kcptun/client differ diff --git a/ShadowsocksX-NG/kcptun/install_kcptun.sh b/ShadowsocksX-NG/kcptun/install_kcptun.sh index f42f322..ce6e51b 100644 --- a/ShadowsocksX-NG/kcptun/install_kcptun.sh +++ b/ShadowsocksX-NG/kcptun/install_kcptun.sh @@ -4,17 +4,23 @@ # ShadowsocksX-NG # # 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]}")" 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" diff --git a/ShadowsocksX-NG/kcptun/kcptun.sh b/ShadowsocksX-NG/kcptun/kcptun.sh new file mode 100755 index 0000000..f38b1b4 --- /dev/null +++ b/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[@]} diff --git a/ShadowsocksX-NG/kcptun/kcptun_client b/ShadowsocksX-NG/kcptun/kcptun_client deleted file mode 100755 index ccb973e..0000000 Binary files a/ShadowsocksX-NG/kcptun/kcptun_client and /dev/null differ