Remove feature over kcptune.

This commit is contained in:
Qiu Yuzhou
2018-09-16 01:39:15 +08:00
parent b3ad963c92
commit db81543372
12 changed files with 11 additions and 810 deletions

View File

@ -42,7 +42,6 @@ From [here](https://github.com/shadowsocks/ShadowsocksX-NG/releases/)
- User rules for PAC.
- Support for [AEAD Ciphers](https://shadowsocks.org/en/spec/AEAD-Ciphers.html)
- HTTP Proxy by [privoxy](http://www.privoxy.org/)
- Over [kcptun](https://github.com/xtaci/kcptun). Version 20170322. [Deprecated - Please use kcptun by SIP003 plugin.This would be removed in future.]
- An advanced preferences panel for configuring:
- Local SOCKS5 listen address.
- Local SOCKS5 listen port.

View File

@ -57,12 +57,7 @@
9B938D9C1E864B38005F5636 /* menu_m_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B938D961E864B38005F5636 /* menu_m_icon@2x.png */; };
9B938D9D1E864B38005F5636 /* menu_p_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B938D971E864B38005F5636 /* menu_p_icon.png */; };
9B938D9E1E864B38005F5636 /* menu_p_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9B938D981E864B38005F5636 /* menu_p_icon@2x.png */; };
9B9CBCA61E25E1DB00FC61AA /* KcptunProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9CBCA51E25E1DB00FC61AA /* KcptunProfile.swift */; };
9B9CBCA81E26312E00FC61AA /* install_kcptun.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B9CBCA71E26310E00FC61AA /* install_kcptun.sh */; };
9B9CBCAA1E2633CB00FC61AA /* kcptun_client in Resources */ = {isa = PBXBuildFile; fileRef = 9B9CBCA91E2633CB00FC61AA /* kcptun_client */; };
9B9CBCAF1E263B1600FC61AA /* libpcre.1.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9B9CBCAD1E263A6600FC61AA /* libpcre.1.dylib */; };
9B9CBCB41E26453C00FC61AA /* start_kcptun.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B9CBCB01E2644DC00FC61AA /* start_kcptun.sh */; };
9B9CBCB51E26453C00FC61AA /* stop_kcptun.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B9CBCB11E26450D00FC61AA /* stop_kcptun.sh */; };
9B9F13A71E8A28B300DE4794 /* LaunchHelper.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9B9F13A61E8A282D00DE4794 /* LaunchHelper.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
9BA04B231D23D5A5005AAD7F /* ProxyConfTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */; };
9BAFE2E21E83ED7F00F71CCE /* PreferencesWinController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9BAFE2E41E83ED7F00F71CCE /* PreferencesWinController.xib */; };
@ -213,12 +208,7 @@
9B938D961E864B38005F5636 /* menu_m_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menu_m_icon@2x.png"; sourceTree = "<group>"; };
9B938D971E864B38005F5636 /* menu_p_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu_p_icon.png; sourceTree = "<group>"; };
9B938D981E864B38005F5636 /* menu_p_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menu_p_icon@2x.png"; sourceTree = "<group>"; };
9B9CBCA51E25E1DB00FC61AA /* KcptunProfile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KcptunProfile.swift; sourceTree = "<group>"; };
9B9CBCA71E26310E00FC61AA /* install_kcptun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = install_kcptun.sh; sourceTree = "<group>"; };
9B9CBCA91E2633CB00FC61AA /* kcptun_client */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = kcptun_client; sourceTree = "<group>"; };
9B9CBCAD1E263A6600FC61AA /* libpcre.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libpcre.1.dylib; sourceTree = "<group>"; };
9B9CBCB01E2644DC00FC61AA /* start_kcptun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = start_kcptun.sh; sourceTree = "<group>"; };
9B9CBCB11E26450D00FC61AA /* stop_kcptun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = stop_kcptun.sh; sourceTree = "<group>"; };
9B9F13A11E8A282C00DE4794 /* LaunchHelper.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LaunchHelper.xcodeproj; path = LaunchHelper/LaunchHelper.xcodeproj; sourceTree = "<group>"; };
9BA04B211D23D5A5005AAD7F /* ProxyConfTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyConfTool.h; sourceTree = "<group>"; };
9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyConfTool.m; sourceTree = "<group>"; };
@ -308,7 +298,6 @@
isa = PBXGroup;
children = (
9B5AA0A9209C41EC00E8B659 /* ss-local */,
9B5AA0A8209C41B400E8B659 /* kcptun */,
1C82DBA31FA96C7400B32551 /* simple-obfs */,
9B16E5991F99FD0700E54DC5 /* icons8-Blind Filled-50.png */,
9B5AA0AA209C42A900E8B659 /* privoxy */,
@ -379,7 +368,6 @@
9B0BFFEC1D0460A70040E62B /* MainMenu.xib */,
9B0BFFEF1D0460A70040E62B /* Info.plist */,
9BEEF06D1D04DCE400FC52B3 /* ServerProfile.swift */,
9B9CBCA51E25E1DB00FC61AA /* KcptunProfile.swift */,
9BEEF06F1D04DDB100FC52B3 /* ServerProfileManager.swift */,
9BEEF0771D04FE8A00FC52B3 /* LaunchAgentUtils.swift */,
9B3FFF0C1D05FEB30019A709 /* Utils.swift */,
@ -435,17 +423,6 @@
path = proxy_conf_helper;
sourceTree = "<group>";
};
9B5AA0A8209C41B400E8B659 /* kcptun */ = {
isa = PBXGroup;
children = (
9B9CBCA71E26310E00FC61AA /* install_kcptun.sh */,
9B9CBCB01E2644DC00FC61AA /* start_kcptun.sh */,
9B9CBCB11E26450D00FC61AA /* stop_kcptun.sh */,
9B9CBCA91E2633CB00FC61AA /* kcptun_client */,
);
name = kcptun;
sourceTree = "<group>";
};
9B5AA0A9209C41EC00E8B659 /* ss-local */ = {
isa = PBXGroup;
children = (
@ -633,14 +610,10 @@
9BBE7B751F508A0E00E8FFE5 /* fix_dir_owner.sh in Resources */,
9B3F7BFF1E82BF5B00C68B75 /* libev.4.dylib in Resources */,
1C82DBAA1FA96FB600B32551 /* install_simple_obfs.sh in Resources */,
9B9CBCB41E26453C00FC61AA /* start_kcptun.sh in Resources */,
9B9CBCB51E26453C00FC61AA /* stop_kcptun.sh in Resources */,
9B938D9A1E864B38005F5636 /* menu_g_icon@2x.png in Resources */,
9B938D9E1E864B38005F5636 /* menu_p_icon@2x.png in Resources */,
9B9CBCAF1E263B1600FC61AA /* libpcre.1.dylib in Resources */,
9B9CBCA81E26312E00FC61AA /* install_kcptun.sh in Resources */,
9B5832031E741F8D009D5B7D /* command-512.png in Resources */,
9B9CBCAA1E2633CB00FC61AA /* kcptun_client in Resources */,
9B3FFF541D09E2D10019A709 /* proxy_conf_helper in Resources */,
9B5832071E7421B2009D5B7D /* virtual-server-icon-3.png in Resources */,
9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */,
@ -857,7 +830,6 @@
9B5831FF1E741969009D5B7D /* PreferencesWinController.swift in Sources */,
9BEEF0781D04FE8A00FC52B3 /* LaunchAgentUtils.swift in Sources */,
9B3546721E802B1200B510B4 /* ToastWindowController.swift in Sources */,
9B9CBCA61E25E1DB00FC61AA /* KcptunProfile.swift in Sources */,
C8E42A6C1D4F270A0074C7EA /* UserRulesController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -80,7 +80,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
// Prepare ss-local
InstallSSLocal()
InstallKcptunClient()
InstallPrivoxy()
InstallSimpleObfs()
// Prepare defaults
@ -188,7 +187,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
StopSSLocal()
StopKcptun()
StopPrivoxy()
ProxyConfHelper.disableProxy()
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14109"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@ -10,19 +10,7 @@
<customObject id="-2" userLabel="File's Owner" customClass="PreferencesWindowController" customModule="ShadowsocksX_NG" customModuleProvider="target">
<connections>
<outlet property="hostTextField" destination="R4F-j7-GkK" id="a1I-WO-Qdj"/>
<outlet property="kcptunArgumentsTextField" destination="nor-Pv-SbH" id="fxO-yq-grE"/>
<outlet property="kcptunCheckBoxBtn" destination="Zgs-86-BfH" id="ahJ-hV-3td"/>
<outlet property="kcptunCryptComboBox" destination="rlP-C7-3uJ" id="awJ-b4-AVm"/>
<outlet property="kcptunDatashardTextField" destination="QIu-0B-hot" id="ubh-s9-7d1"/>
<outlet property="kcptunKeyTextField" destination="oX2-Db-V5d" id="F32-hY-01D"/>
<outlet property="kcptunMTUTextField" destination="Q5m-nt-Gpa" id="KLz-5k-yXu"/>
<outlet property="kcptunModeComboBox" destination="WNY-EE-WjA" id="8dJ-nb-kFV"/>
<outlet property="kcptunNocompCheckBoxBtn" destination="WiD-LX-WHu" id="whG-WJ-qyh"/>
<outlet property="kcptunParityshardTextField" destination="8hC-op-kWY" id="0Hd-X7-T39"/>
<outlet property="kcptunPortTextField" destination="JNT-U1-Ao5" id="tpy-nE-j9f"/>
<outlet property="kcptunProfileBox" destination="WE7-7J-vda" id="HlV-ET-fgs"/>
<outlet property="methodTextField" destination="ef4-8J-eFn" id="OXd-fC-ICR"/>
<outlet property="otaCheckBoxBtn" destination="9CP-zt-WuH" id="egZ-KB-iSv"/>
<outlet property="passwordSecureTextField" destination="ZXA-oi-Zv3" id="ZMF-s4-w53"/>
<outlet property="passwordTabView" destination="DHz-Hx-kZ5" id="8W3-H3-Ezq"/>
<outlet property="passwordTextField" destination="3Ad-X4-DBi" id="FHf-t3-D8t"/>
@ -42,7 +30,7 @@
<window title="Server Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<rect key="contentRect" x="423" y="365" width="590" height="564"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="590" height="564"/>
<autoresizingMask key="autoresizingMask"/>
@ -114,7 +102,7 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Otb-CO-KUH">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Otb-CO-KUH">
<rect key="frame" x="212" y="446" width="9" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="5" id="JAU-I8-jVc"/>
@ -181,7 +169,7 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R4F-j7-GkK">
<textField verticalHuggingPriority="750" ambiguous="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R4F-j7-GkK">
<rect key="frame" x="110" y="441" width="96" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="IP" drawsBackground="YES" id="MWO-hQ-nMt">
<font key="font" metaFont="system"/>
@ -189,244 +177,7 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button translatesAutoresizingMaskIntoConstraints="NO" id="9CP-zt-WuH">
<rect key="frame" x="83" y="263" width="174" height="18"/>
<buttonCell key="cell" type="check" title="Enable OTA (deprecated)" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="hRZ-Rp-I5e">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="Zgs-86-BfH">
<rect key="frame" x="83" y="243" width="138" height="18"/>
<buttonCell key="cell" type="check" title="Enable over kcptun" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="jNm-rQ-3wm">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<box boxType="secondary" borderType="none" title="Kcptun" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="WE7-7J-vda">
<rect key="frame" x="-3" y="-4" width="303" height="235"/>
<view key="contentView" id="rqF-7k-7qO">
<rect key="frame" x="0.0" y="0.0" width="303" height="235"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="8lc-dc-PSG">
<rect key="frame" x="29" y="225" width="254" height="5"/>
</box>
<comboBox verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rlP-C7-3uJ">
<rect key="frame" x="119" y="158" width="167" height="26"/>
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="11" id="Pki-dN-sGQ">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</comboBoxCell>
</comboBox>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="g86-vn-tV6">
<rect key="frame" x="40" y="163" width="73" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Encryption:" id="bSO-KG-2b5">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<secureTextField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oX2-Db-V5d">
<rect key="frame" x="119" y="132" width="164" height="22"/>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="Crw-uk-LMT">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</secureTextFieldCell>
</secureTextField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AGS-ql-5dx">
<rect key="frame" x="47" y="134" width="66" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Password:" id="F9H-G8-6DV">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button translatesAutoresizingMaskIntoConstraints="NO" id="WiD-LX-WHu">
<rect key="frame" x="117" y="108" width="148" height="18"/>
<buttonCell key="cell" type="check" title="Disable compression" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="ezp-Vb-ouI">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hXK-B7-wCP">
<rect key="frame" x="18" y="50" width="95" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Parityshard:" id="Tas-1r-V7W">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eiU-HT-y0P">
<rect key="frame" x="165" y="83" width="58" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="MTU:" id="G4r-Ba-CmP">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Q5m-nt-Gpa">
<rect key="frame" x="227" y="81" width="56" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="56" id="7yZ-EA-vgv"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="PLG-nZ-2b8">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="formatter" destination="B8F-00-aMS" id="0Tg-9d-lTR"/>
</connections>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QIu-0B-hot">
<rect key="frame" x="119" y="80" width="40" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="VVd-ie-snZ"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="lqa-TF-zf8">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="formatter" destination="fck-0V-svg" id="feZ-Wh-Seh"/>
</connections>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8hC-op-kWY">
<rect key="frame" x="119" y="48" width="40" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="wNm-kP-LEf">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="formatter" destination="fck-0V-svg" id="dQf-w3-TXN"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QEf-lL-f9y">
<rect key="frame" x="18" y="193" width="95" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Kcptun Port:" id="n2C-cl-kCt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="JNT-U1-Ao5">
<rect key="frame" x="119" y="190" width="50" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="4Z4-1J-wZo"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Port" drawsBackground="YES" id="PQf-6C-ACJ">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</textFieldCell>
<connections>
<outlet property="formatter" destination="QZc-kt-D7Z" id="ilB-tq-udd"/>
</connections>
</textField>
<comboBox verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WNY-EE-WjA">
<rect key="frame" x="225" y="187" width="61" height="26"/>
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="M84-Q1-s9N">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</comboBoxCell>
</comboBox>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6Up-x6-VlH">
<rect key="frame" x="177" y="192" width="42" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Mode:" id="UPY-ya-au1">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="d2a-yC-KrD">
<rect key="frame" x="18" y="17" width="95" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Arguments:" id="NHi-9M-nZc">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nor-Pv-SbH">
<rect key="frame" x="119" y="15" width="164" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Other arguments for kcptun" drawsBackground="YES" id="fzw-BF-E8q">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bu6-g1-G0Q">
<rect key="frame" x="18" y="82" width="95" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Datashard:" id="Aj8-qI-alu">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="QIu-0B-hot" firstAttribute="baseline" secondItem="eiU-HT-y0P" secondAttribute="baseline" id="0Xu-Pd-0yV"/>
<constraint firstItem="WiD-LX-WHu" firstAttribute="top" secondItem="oX2-Db-V5d" secondAttribute="bottom" constant="8" symbolic="YES" id="18y-HU-IWD"/>
<constraint firstItem="8hC-op-kWY" firstAttribute="leading" secondItem="nor-Pv-SbH" secondAttribute="leading" id="5GP-bH-3by"/>
<constraint firstItem="WNY-EE-WjA" firstAttribute="leading" secondItem="6Up-x6-VlH" secondAttribute="trailing" constant="8" symbolic="YES" id="5w2-jx-QYD"/>
<constraint firstItem="rlP-C7-3uJ" firstAttribute="leading" secondItem="g86-vn-tV6" secondAttribute="trailing" constant="8" symbolic="YES" id="7Gt-Kr-EY2"/>
<constraint firstItem="eiU-HT-y0P" firstAttribute="leading" secondItem="QIu-0B-hot" secondAttribute="trailing" constant="8" symbolic="YES" id="A4t-0S-Hhb"/>
<constraint firstItem="6Up-x6-VlH" firstAttribute="centerY" secondItem="WNY-EE-WjA" secondAttribute="centerY" id="BsT-Si-PkB"/>
<constraint firstItem="QIu-0B-hot" firstAttribute="trailing" secondItem="8hC-op-kWY" secondAttribute="trailing" id="Fz8-ZS-emJ"/>
<constraint firstItem="Q5m-nt-Gpa" firstAttribute="trailing" secondItem="nor-Pv-SbH" secondAttribute="trailing" id="GfT-HW-D9s"/>
<constraint firstItem="rlP-C7-3uJ" firstAttribute="leading" secondItem="oX2-Db-V5d" secondAttribute="leading" id="HmT-Bl-zIv"/>
<constraint firstItem="AGS-ql-5dx" firstAttribute="centerY" secondItem="oX2-Db-V5d" secondAttribute="centerY" id="IXS-rB-bHs"/>
<constraint firstItem="g86-vn-tV6" firstAttribute="centerY" secondItem="rlP-C7-3uJ" secondAttribute="centerY" id="JNm-5L-B83"/>
<constraint firstItem="nor-Pv-SbH" firstAttribute="leading" secondItem="d2a-yC-KrD" secondAttribute="trailing" constant="8" symbolic="YES" id="JfO-iu-0cI"/>
<constraint firstItem="WNY-EE-WjA" firstAttribute="trailing" secondItem="rlP-C7-3uJ" secondAttribute="trailing" id="NwZ-UF-2Sg"/>
<constraint firstItem="hXK-B7-wCP" firstAttribute="leading" secondItem="d2a-yC-KrD" secondAttribute="leading" id="OoE-D8-dGo"/>
<constraint firstItem="JNT-U1-Ao5" firstAttribute="centerY" secondItem="6Up-x6-VlH" secondAttribute="centerY" id="Owu-px-zFR"/>
<constraint firstItem="hXK-B7-wCP" firstAttribute="centerY" secondItem="8hC-op-kWY" secondAttribute="centerY" id="Rtk-rE-D7m"/>
<constraint firstItem="QEf-lL-f9y" firstAttribute="baseline" secondItem="JNT-U1-Ao5" secondAttribute="baseline" id="Rxm-mu-qwS"/>
<constraint firstItem="oX2-Db-V5d" firstAttribute="top" secondItem="rlP-C7-3uJ" secondAttribute="bottom" constant="8" symbolic="YES" id="SUo-ZZ-c77"/>
<constraint firstItem="oX2-Db-V5d" firstAttribute="trailing" secondItem="Q5m-nt-Gpa" secondAttribute="trailing" id="TyT-p4-bdu"/>
<constraint firstItem="JNT-U1-Ao5" firstAttribute="leading" secondItem="QEf-lL-f9y" secondAttribute="trailing" constant="8" symbolic="YES" id="UTh-6a-n7a"/>
<constraint firstItem="d2a-yC-KrD" firstAttribute="centerY" secondItem="nor-Pv-SbH" secondAttribute="centerY" id="Ubj-hP-TpR"/>
<constraint firstItem="JNT-U1-Ao5" firstAttribute="top" secondItem="8lc-dc-PSG" secondAttribute="bottom" constant="15" id="W4H-Y9-FQF"/>
<constraint firstItem="6Up-x6-VlH" firstAttribute="leading" secondItem="JNT-U1-Ao5" secondAttribute="trailing" constant="10" id="W4Q-pI-7MI"/>
<constraint firstItem="bu6-g1-G0Q" firstAttribute="centerY" secondItem="QIu-0B-hot" secondAttribute="centerY" id="Wo7-JC-nZO"/>
<constraint firstItem="QEf-lL-f9y" firstAttribute="leading" secondItem="bu6-g1-G0Q" secondAttribute="leading" id="aAA-56-5Bu"/>
<constraint firstItem="QIu-0B-hot" firstAttribute="top" secondItem="WiD-LX-WHu" secondAttribute="bottom" constant="8" symbolic="YES" id="iqY-Sy-Tr4"/>
<constraint firstItem="oX2-Db-V5d" firstAttribute="leading" secondItem="WiD-LX-WHu" secondAttribute="leading" id="jhd-7j-Us6"/>
<constraint firstItem="nor-Pv-SbH" firstAttribute="top" secondItem="8hC-op-kWY" secondAttribute="bottom" constant="11" id="m09-Xz-Yho"/>
<constraint firstItem="JNT-U1-Ao5" firstAttribute="leading" secondItem="rlP-C7-3uJ" secondAttribute="leading" id="mv8-2u-4K4"/>
<constraint firstItem="g86-vn-tV6" firstAttribute="leading" secondItem="rqF-7k-7qO" secondAttribute="leading" constant="42" id="nnG-uu-uYd"/>
<constraint firstItem="8hC-op-kWY" firstAttribute="leading" secondItem="hXK-B7-wCP" secondAttribute="trailing" constant="8" symbolic="YES" id="nrb-Fn-442"/>
<constraint firstAttribute="trailing" secondItem="8lc-dc-PSG" secondAttribute="trailing" constant="20" symbolic="YES" id="o1A-qO-0bV"/>
<constraint firstItem="oX2-Db-V5d" firstAttribute="leading" secondItem="AGS-ql-5dx" secondAttribute="trailing" constant="8" symbolic="YES" id="oGH-UR-U9I"/>
<constraint firstItem="8hC-op-kWY" firstAttribute="top" secondItem="QIu-0B-hot" secondAttribute="bottom" constant="10" symbolic="YES" id="pFV-dO-vOW"/>
<constraint firstItem="QEf-lL-f9y" firstAttribute="leading" secondItem="rqF-7k-7qO" secondAttribute="leading" constant="20" symbolic="YES" id="pPx-N8-Ggo"/>
<constraint firstItem="Q5m-nt-Gpa" firstAttribute="leading" secondItem="eiU-HT-y0P" secondAttribute="trailing" constant="6" id="pgL-eK-6pV"/>
<constraint firstItem="rlP-C7-3uJ" firstAttribute="top" secondItem="JNT-U1-Ao5" secondAttribute="bottom" constant="8" symbolic="YES" id="s9j-L5-dBK"/>
<constraint firstItem="bu6-g1-G0Q" firstAttribute="leading" secondItem="hXK-B7-wCP" secondAttribute="leading" id="sjm-d5-YlS"/>
<constraint firstItem="QIu-0B-hot" firstAttribute="leading" secondItem="bu6-g1-G0Q" secondAttribute="trailing" constant="8" symbolic="YES" id="uYd-8Z-LB7"/>
<constraint firstItem="WNY-EE-WjA" firstAttribute="trailing" secondItem="8lc-dc-PSG" secondAttribute="trailing" id="vAr-oy-vUW"/>
<constraint firstAttribute="bottom" secondItem="nor-Pv-SbH" secondAttribute="bottom" constant="15" id="wHY-5y-lZw"/>
<constraint firstItem="eiU-HT-y0P" firstAttribute="centerY" secondItem="Q5m-nt-Gpa" secondAttribute="centerY" id="wRR-nI-WmE"/>
<constraint firstItem="WiD-LX-WHu" firstAttribute="leading" secondItem="QIu-0B-hot" secondAttribute="leading" id="wu8-KY-1HX"/>
<constraint firstItem="QIu-0B-hot" firstAttribute="leading" secondItem="8hC-op-kWY" secondAttribute="leading" id="y5z-dv-Ah4"/>
<constraint firstItem="rlP-C7-3uJ" firstAttribute="trailing" secondItem="oX2-Db-V5d" secondAttribute="trailing" id="yDK-OU-3li"/>
<constraint firstItem="8lc-dc-PSG" firstAttribute="leading" secondItem="rqF-7k-7qO" secondAttribute="leading" constant="29" id="yuZ-DZ-ok3"/>
</constraints>
</view>
</box>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lng-AE-g0J">
<textField verticalHuggingPriority="750" ambiguous="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lng-AE-g0J">
<rect key="frame" x="223" y="441" width="50" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Port" drawsBackground="YES" id="e1F-jd-e0J">
<font key="font" metaFont="system"/>
@ -540,12 +291,9 @@
<constraint firstItem="ef4-8J-eFn" firstAttribute="top" secondItem="R4F-j7-GkK" secondAttribute="bottom" constant="8" symbolic="YES" id="41P-Ix-it2"/>
<constraint firstItem="jDI-cn-wYa" firstAttribute="trailing" secondItem="0PP-Ng-z0v" secondAttribute="trailing" constant="35" id="5DS-4j-Cr9"/>
<constraint firstAttribute="trailing" secondItem="lng-AE-g0J" secondAttribute="trailing" constant="24" id="6W3-BA-gYo"/>
<constraint firstItem="Otb-CO-KUH" firstAttribute="trailing" secondItem="Zgs-86-BfH" secondAttribute="trailing" id="8Pl-xV-uvr"/>
<constraint firstItem="9CP-zt-WuH" firstAttribute="leading" secondItem="Zgs-86-BfH" secondAttribute="leading" id="8r8-GD-9Z3"/>
<constraint firstItem="0PP-Ng-z0v" firstAttribute="centerY" secondItem="DGz-Sq-t0c" secondAttribute="centerY" id="99Q-Zk-mdj"/>
<constraint firstItem="R4F-j7-GkK" firstAttribute="top" secondItem="a3z-VL-3xV" secondAttribute="top" constant="20" symbolic="YES" id="Dkz-UA-ymg"/>
<constraint firstItem="0PP-Ng-z0v" firstAttribute="top" secondItem="DHz-Hx-kZ5" secondAttribute="bottom" constant="10" id="Fwl-Mu-bKH"/>
<constraint firstItem="Zgs-86-BfH" firstAttribute="top" secondItem="9CP-zt-WuH" secondAttribute="bottom" constant="6" symbolic="YES" id="Gvl-Fp-l23"/>
<constraint firstItem="DHz-Hx-kZ5" firstAttribute="top" secondItem="ef4-8J-eFn" secondAttribute="bottom" constant="8" symbolic="YES" id="I7k-9o-SLi"/>
<constraint firstItem="jDI-cn-wYa" firstAttribute="leading" secondItem="DHz-Hx-kZ5" secondAttribute="trailing" constant="9" id="IMV-t5-Set"/>
<constraint firstItem="jDI-cn-wYa" firstAttribute="trailing" secondItem="q3C-S0-iNn" secondAttribute="trailing" id="Idl-zd-MSU"/>
@ -554,16 +302,11 @@
<constraint firstAttribute="trailing" secondItem="jDI-cn-wYa" secondAttribute="trailing" constant="17" id="JSl-uN-iMh"/>
<constraint firstItem="ef4-8J-eFn" firstAttribute="leading" secondItem="DHz-Hx-kZ5" secondAttribute="leading" id="L85-np-Xpn"/>
<constraint firstItem="q3C-S0-iNn" firstAttribute="leading" secondItem="Baj-Yh-kmj" secondAttribute="trailing" constant="8" symbolic="YES" id="LTy-e7-h27"/>
<constraint firstItem="9CP-zt-WuH" firstAttribute="top" secondItem="q3C-S0-iNn" secondAttribute="bottom" constant="8" symbolic="YES" id="M5Z-aD-cu9"/>
<constraint firstAttribute="bottom" secondItem="WE7-7J-vda" secondAttribute="bottom" id="MTo-dp-G2o"/>
<constraint firstItem="q3C-S0-iNn" firstAttribute="top" secondItem="5eh-s9-YH8" secondAttribute="bottom" constant="10" symbolic="YES" id="ORc-LV-dNZ"/>
<constraint firstItem="DHz-Hx-kZ5" firstAttribute="bottom" secondItem="jDI-cn-wYa" secondAttribute="bottom" id="RM1-vq-zAm"/>
<constraint firstItem="Kft-TG-O5S" firstAttribute="centerY" secondItem="ef4-8J-eFn" secondAttribute="centerY" id="RYD-o2-vjB"/>
<constraint firstItem="Kft-TG-O5S" firstAttribute="leading" secondItem="a3z-VL-3xV" secondAttribute="leading" constant="32" id="TsS-51-KLG"/>
<constraint firstItem="WE7-7J-vda" firstAttribute="top" secondItem="Zgs-86-BfH" secondAttribute="bottom" constant="16" id="U6M-Pc-YYB"/>
<constraint firstItem="WE7-7J-vda" firstAttribute="leading" secondItem="a3z-VL-3xV" secondAttribute="leading" id="UVZ-vu-0ss"/>
<constraint firstItem="ef4-8J-eFn" firstAttribute="leading" secondItem="Kft-TG-O5S" secondAttribute="trailing" constant="8" symbolic="YES" id="VGj-2V-kmi"/>
<constraint firstAttribute="trailing" secondItem="WE7-7J-vda" secondAttribute="trailing" id="WAe-uE-c28"/>
<constraint firstItem="Otb-CO-KUH" firstAttribute="leading" secondItem="R4F-j7-GkK" secondAttribute="trailing" constant="8" symbolic="YES" id="dL8-po-Zhh"/>
<constraint firstItem="jch-rI-Swc" firstAttribute="centerX" secondItem="jDI-cn-wYa" secondAttribute="centerX" id="eTA-qv-ID2"/>
<constraint firstItem="HPg-NP-kjP" firstAttribute="baseline" secondItem="R4F-j7-GkK" secondAttribute="baseline" id="fb7-sB-eHL"/>
@ -578,7 +321,6 @@
<constraint firstItem="0PP-Ng-z0v" firstAttribute="leading" secondItem="DGz-Sq-t0c" secondAttribute="trailing" constant="8" symbolic="YES" id="mcp-te-11z"/>
<constraint firstItem="R4F-j7-GkK" firstAttribute="leading" secondItem="ef4-8J-eFn" secondAttribute="leading" id="opP-Lo-SO0"/>
<constraint firstItem="5eh-s9-YH8" firstAttribute="leading" secondItem="4LD-CD-u7b" secondAttribute="trailing" constant="8" symbolic="YES" id="uFv-U2-g2d"/>
<constraint firstItem="9CP-zt-WuH" firstAttribute="leading" secondItem="a3z-VL-3xV" secondAttribute="leading" constant="85" id="vYk-bK-2hT"/>
<constraint firstItem="Qfe-Ql-iCO" firstAttribute="centerY" secondItem="DHz-Hx-kZ5" secondAttribute="centerY" id="wKU-B5-A3m"/>
<constraint firstItem="jch-rI-Swc" firstAttribute="top" secondItem="0PP-Ng-z0v" secondAttribute="top" id="zzw-ge-6mH"/>
</constraints>

View File

@ -1,150 +0,0 @@
//
// KcptunProfile.swift
// ShadowsocksX-NG
//
// Created by on 2017/1/11.
// Copyright © 2017 qiuyuzhou. All rights reserved.
//
import Foundation
class KcptunProfile: NSObject, NSCopying {
@objc var mode: String = "fast"
@objc var key: String = "it's a secrect"
@objc var crypt: String = "aes"
@objc var nocomp: Bool = false
@objc var datashard: uint = 10
@objc var parityshard: uint = 3
@objc var mtu: uint = 1350
@objc var arguments: String = ""
public func copy(with zone: NSZone? = nil) -> Any {
let copy = KcptunProfile()
copy.mode = self.mode
copy.key = self.key
copy.crypt = self.crypt
copy.nocomp = self.nocomp
copy.datashard = self.datashard
copy.parityshard = self.parityshard
copy.mtu = self.mtu
return copy;
}
func toDictionary() -> [String:AnyObject] {
let conf: [String: AnyObject] = [
"mode": self.mode as AnyObject,
"key": self.key as AnyObject,
"crypt": self.crypt as AnyObject,
"nocomp": NSNumber(value: self.nocomp),
"datashard": NSNumber(value: self.datashard),
"parityshard": NSNumber(value: self.parityshard),
"mtu": NSNumber(value: self.mtu),
"arguments": self.arguments as AnyObject,
]
return conf
}
static func fromDictionary(_ data:[String:Any?]) -> KcptunProfile {
let profile = KcptunProfile()
profile.mode = data["mode"] as! String
profile.key = data["key"] as! String
profile.crypt = data["crypt"] as! String
profile.nocomp = (data["nocomp"] as! NSNumber).boolValue
profile.datashard = uint((data["datashard"] as! NSNumber).uintValue)
profile.parityshard = uint((data["parityshard"] as! NSNumber).uintValue)
if let v = data["mtu"] as? NSNumber {
profile.mtu = uint(v.uintValue)
}
if let arguments = data["arguments"] as? String {
profile.arguments = arguments
}
return profile
}
func toJsonConfig() -> [String: AnyObject] {
let defaults = UserDefaults.standard
let localHost = defaults.string(forKey: "Kcptun.LocalHost")! as String
let localPort = defaults.integer(forKey: "Kcptun.LocalPort")
let connNum = defaults.integer(forKey: "Kcptun.Conn")
let conf: [String: AnyObject] = [
"localaddr": "\(localHost):\(localPort)" as AnyObject,
"mode": self.mode as AnyObject,
"key": self.key as AnyObject,
"crypt": self.crypt as AnyObject,
"nocomp": NSNumber(value: self.nocomp),
"datashard": NSNumber(value: self.datashard),
"parityshard": NSNumber(value: self.parityshard),
"mtu": NSNumber(value: self.mtu),
"conn": NSNumber(value: connNum),
]
return conf
}
func urlQueryItems() -> [URLQueryItem] {
return [
URLQueryItem(name: "mode", value: mode),
URLQueryItem(name: "key", value: key),
URLQueryItem(name: "crypt", value: crypt),
URLQueryItem(name: "datashard", value: "\(datashard)"),
URLQueryItem(name: "parityshard", value: "\(parityshard)"),
URLQueryItem(name: "nocomp", value: nocomp.description),
URLQueryItem(name: "mtu", value: "\(mtu)"),
URLQueryItem(name: "arguments", value: arguments),
]
}
func loadUrlQueryItems(items: [URLQueryItem]) {
for item in items {
switch item.name {
case "mode":
if let v = item.value {
mode = v
}
case "key":
if let v = item.value {
key = v
}
case "crypt":
if let v = item.value {
crypt = v
}
case "datashard":
if let v = item.value {
if let vv = uint(v) {
datashard = vv
}
}
case "parityshard":
if let v = item.value {
if let vv = uint(v) {
parityshard = vv
}
}
case "nocomp":
if let v = item.value {
if let vv = Bool(v) {
nocomp = vv
}
}
case "mtu":
if let v = item.value {
if let vv = uint(v) {
mtu = vv
}
}
case "arguments":
if let v = item.value {
arguments = v
}
default:
continue
}
}
}
}

View File

@ -187,7 +187,6 @@ func SyncSSLocal() {
}
SyncPac()
SyncPrivoxy()
SyncKcptun()
}
// --------------------------------------------------------------------------------
@ -352,163 +351,3 @@ func SyncPrivoxy() {
StopPrivoxy()
}
}
// --------------------------------------------------------------------------------
// kcptun
func generateKcptunLauchAgentPlist() -> Bool {
let sslocalPath = NSHomeDirectory() + APP_SUPPORT_DIR + "kcptun_client"
let logFilePath = NSHomeDirectory() + "/Library/Logs/kcptun_client.log"
let launchAgentDirPath = NSHomeDirectory() + LAUNCH_AGENT_DIR
let plistFilepath = launchAgentDirPath + LAUNCH_AGENT_CONF_KCPTUN_NAME
// Ensure launch agent directory is existed.
let fileMgr = FileManager.default
if !fileMgr.fileExists(atPath: launchAgentDirPath) {
try! fileMgr.createDirectory(atPath: launchAgentDirPath, withIntermediateDirectories: true, attributes: nil)
}
let oldSha1Sum = getFileSHA1Sum(plistFilepath)
var arguments = [sslocalPath, "-c", "kcptun-config.json"]
let mgr = ServerProfileManager.instance
if let profile = mgr.getActiveProfile() {
if profile.enabledKcptun {
let otherArgumentsLine = profile.kcptunProfile.arguments.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
if !otherArgumentsLine.isEmpty {
// TOFIX: Don't support space between quotation marks
let otherArguments = otherArgumentsLine.components(separatedBy: " ")
arguments.append(contentsOf: otherArguments.filter { !$0.isEmpty })
}
}
}
// For a complete listing of the keys, see the launchd.plist manual page.
let dict: NSMutableDictionary = [
"Label": "com.qiuyuzhou.shadowsocksX-NG.kcptun",
"WorkingDirectory": NSHomeDirectory() + APP_SUPPORT_DIR,
"StandardOutPath": logFilePath,
"StandardErrorPath": logFilePath,
"ProgramArguments": arguments,
"EnvironmentVariables": ["DYLD_LIBRARY_PATH": NSHomeDirectory() + APP_SUPPORT_DIR]
]
dict.write(toFile: plistFilepath, atomically: true)
let Sha1Sum = getFileSHA1Sum(plistFilepath)
if oldSha1Sum != Sha1Sum {
return true
} else {
return false
}
}
func InstallKcptunClient() {
let fileMgr = FileManager.default
let homeDir = NSHomeDirectory()
let appSupportDir = homeDir+APP_SUPPORT_DIR
if !fileMgr.fileExists(atPath: appSupportDir + "kcptun_\(KCPTUN_CLIENT_VERSION)/kcptun_client") {
let bundle = Bundle.main
let installerPath = bundle.path(forResource: "install_kcptun", ofType: "sh")
let task = Process.launchedProcess(launchPath: installerPath!, arguments: [""])
task.waitUntilExit()
if task.terminationStatus == 0 {
NSLog("Install kcptun succeeded.")
} else {
NSLog("Install kcptun failed.")
}
}
}
func writeKcptunConfFile(_ conf:[String:AnyObject]) -> Bool {
do {
let filepath = NSHomeDirectory() + APP_SUPPORT_DIR + "kcptun-config.json"
let data: Data = try JSONSerialization.data(withJSONObject: conf, options: .prettyPrinted)
let oldSum = getFileSHA1Sum(filepath)
try data.write(to: URL(fileURLWithPath: filepath), options: .atomic)
let newSum = getFileSHA1Sum(filepath)
if oldSum == newSum {
return false
}
return true
} catch {
NSLog("Write kcptun config file failed.")
}
return false
}
func isEnabledKcptun() -> Bool {
let mgr = ServerProfileManager.instance
if let profile = mgr.getActiveProfile() {
return profile.enabledKcptun
}
return false
}
func removeKcptunConfFile() {
do {
let filepath = NSHomeDirectory() + APP_SUPPORT_DIR + "kcptun-config.json"
try FileManager.default.removeItem(atPath: filepath)
} catch {
}
}
func StartKcptun() {
if isEnabledKcptun() {
let bundle = Bundle.main
let installerPath = bundle.path(forResource: "start_kcptun.sh", ofType: nil)
let task = Process.launchedProcess(launchPath: installerPath!, arguments: [""])
task.waitUntilExit()
if task.terminationStatus == 0 {
NSLog("Start kcptun succeeded.")
} else {
NSLog("Start kcptun failed.")
}
}
}
func StopKcptun() {
let bundle = Bundle.main
let installerPath = bundle.path(forResource: "stop_kcptun.sh", ofType: nil)
let task = Process.launchedProcess(launchPath: installerPath!, arguments: [""])
task.waitUntilExit()
if task.terminationStatus == 0 {
NSLog("Stop kcptun succeeded.")
} else {
NSLog("Stop kcptun failed.")
}
}
func SyncKcptun() {
var changed: Bool = false
changed = changed || generateKcptunLauchAgentPlist()
let mgr = ServerProfileManager.instance
if let profile = mgr.getActiveProfile() {
if profile.enabledKcptun {
changed = changed || writeKcptunConfFile(profile.toKcptunJsonConfig())
let on = UserDefaults.standard.bool(forKey: "ShadowsocksOn")
if on {
if changed {
StopKcptun()
DispatchQueue.main.asyncAfter(
deadline: DispatchTime.now() + DispatchTimeInterval.seconds(1),
execute: {
() in
StartKcptun()
})
} else {
StartKcptun()
}
} else {
StopKcptun()
}
return
}
}
StopKcptun()
removeKcptunConfFile()
}

View File

@ -16,11 +16,9 @@ class PreferencesWindowController: NSWindowController
@IBOutlet weak var profilesTableView: NSTableView!
@IBOutlet weak var profileBox: NSBox!
@IBOutlet weak var kcptunProfileBox: NSBox!
@IBOutlet weak var hostTextField: NSTextField!
@IBOutlet weak var portTextField: NSTextField!
@IBOutlet weak var kcptunPortTextField: NSTextField!
@IBOutlet weak var methodTextField: NSComboBox!
@IBOutlet weak var passwordTabView: NSTabView!
@ -29,22 +27,9 @@ class PreferencesWindowController: NSWindowController
@IBOutlet weak var togglePasswordVisibleButton: NSButton!
@IBOutlet weak var pluginTextField: NSTextField!
@IBOutlet weak var pluginOptionsTextField: NSTextField!
@IBOutlet weak var remarkTextField: NSTextField!
@IBOutlet weak var otaCheckBoxBtn: NSButton!
@IBOutlet weak var kcptunCheckBoxBtn: NSButton!
@IBOutlet weak var kcptunCryptComboBox: NSComboBox!
@IBOutlet weak var kcptunKeyTextField: NSTextField!
@IBOutlet weak var kcptunModeComboBox: NSComboBox!
@IBOutlet weak var kcptunNocompCheckBoxBtn: NSButton!
@IBOutlet weak var kcptunDatashardTextField: NSTextField!
@IBOutlet weak var kcptunParityshardTextField: NSTextField!
@IBOutlet weak var kcptunMTUTextField: NSTextField!
@IBOutlet weak var kcptunArgumentsTextField: NSTextField!
@IBOutlet weak var removeButton: NSButton!
let tableViewDragType: String = "ss.server.profile.data"
var defaults: UserDefaults!
@ -85,29 +70,6 @@ class PreferencesWindowController: NSWindowController
"rc4-md5",
])
kcptunCryptComboBox.addItems(withObjectValues: [
"none",
"aes",
"aes-128",
"aes-192",
"salsa20",
"blowfish",
"twofish",
"cast5",
"3des",
"tea",
"xtea",
"xor",
])
kcptunModeComboBox.addItems(withObjectValues: [
"default",
"normal",
"fast",
"fast2",
"fast3",
])
profilesTableView.reloadData()
updateProfileBoxVisible()
}
@ -165,7 +127,6 @@ class PreferencesWindowController: NSWindowController
profileMgr.save()
window?.performClose(nil)
NotificationCenter.default
.post(name: NOTIFY_SERVER_PROFILES_CHANGED, object: nil)
}
@ -253,14 +214,6 @@ class PreferencesWindowController: NSWindowController
if index >= 0 && index < profileMgr.profiles.count {
editingProfile = profileMgr.profiles[index]
enabledKcptunSubDisosable = editingProfile.rx.observeWeakly(Bool.self, "enabledKcptun")
.subscribe(onNext: { v in
if let enabled = v {
self.portTextField.isEnabled = !enabled
}
})
hostTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "serverHost"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
portTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "serverPort"
@ -280,43 +233,6 @@ class PreferencesWindowController: NSWindowController
remarkTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "remark"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
otaCheckBoxBtn.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "ota"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
// --------------------------------------------------
// Kcptun
kcptunCheckBoxBtn.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "enabledKcptun"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
kcptunPortTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "serverPort"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
kcptunProfileBox.bind(NSBindingName(rawValue: "Hidden"), to: editingProfile, withKeyPath: "enabledKcptun"
, options: [NSBindingOption.continuouslyUpdatesValue: false,
NSBindingOption.valueTransformerName: NSValueTransformerName.negateBooleanTransformerName])
kcptunNocompCheckBoxBtn.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "kcptunProfile.nocomp", options: nil)
kcptunModeComboBox.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "kcptunProfile.mode", options: nil)
kcptunCryptComboBox.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "kcptunProfile.crypt", options: nil)
kcptunKeyTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "kcptunProfile.key"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
kcptunDatashardTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "kcptunProfile.datashard"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
kcptunParityshardTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "kcptunProfile.parityshard"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
kcptunMTUTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "kcptunProfile.mtu"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
kcptunArgumentsTextField.bind(NSBindingName(rawValue: "value"), to: editingProfile, withKeyPath: "kcptunProfile.arguments"
, options: [NSBindingOption.continuouslyUpdatesValue: true])
} else {
editingProfile = nil
hostTextField.unbind(NSBindingName(rawValue: "value"))
@ -326,10 +242,6 @@ class PreferencesWindowController: NSWindowController
passwordTextField.unbind(NSBindingName(rawValue: "value"))
remarkTextField.unbind(NSBindingName(rawValue: "value"))
otaCheckBoxBtn.unbind(NSBindingName(rawValue: "value"))
kcptunCheckBoxBtn.unbind(NSBindingName(rawValue: "value"))
}
}

View File

@ -18,10 +18,6 @@ class ServerProfile: NSObject, NSCopying {
@objc var method:String = "aes-128-gcm"
@objc var password:String = ""
@objc var remark:String = ""
@objc var ota: Bool = false // onetime authentication
@objc var enabledKcptun: Bool = false
@objc var kcptunProfile = KcptunProfile()
// SIP003 Plugin
@objc var plugin: String = "" // empty string disables plugin
@ -103,21 +99,6 @@ class ServerProfile: NSObject, NSCopying {
}
}
if let otaStr = parsedUrl.queryItems?
.filter({ $0.name == "OTA" }).first?.value {
ota = NSString(string: otaStr).boolValue
}
if let enabledKcptunStr = parsedUrl.queryItems?
.filter({ $0.name == "Kcptun" }).first?.value {
enabledKcptun = NSString(string: enabledKcptunStr).boolValue
}
if enabledKcptun {
if let items = parsedUrl.queryItems {
self.kcptunProfile.loadUrlQueryItems(items: items)
}
}
if let pluginStr = parsedUrl.queryItems?
.filter({ $0.name == "plugin" }).first?.value {
let parts = pluginStr.split(separator: ";", maxSplits: 1)
@ -135,10 +116,7 @@ class ServerProfile: NSObject, NSCopying {
copy.method = self.method
copy.password = self.password
copy.remark = self.remark
copy.ota = self.ota
copy.enabledKcptun = self.enabledKcptun
copy.kcptunProfile = self.kcptunProfile.copy() as! KcptunProfile
copy.plugin = self.plugin
copy.pluginOptions = self.pluginOptions
return copy;
@ -154,15 +132,6 @@ class ServerProfile: NSObject, NSCopying {
if let remark = data["Remark"] {
profile.remark = remark as! String
}
if let ota = data["OTA"] {
profile.ota = ota as! Bool
}
if let enabledKcptun = data["EnabledKcptun"] {
profile.enabledKcptun = enabledKcptun as! Bool
}
if let kcptunData = data["KcptunProfile"] {
profile.kcptunProfile = KcptunProfile.fromDictionary(kcptunData as! [String:Any?])
}
if let plugin = data["Plugin"] as? String {
profile.plugin = plugin
}
@ -190,9 +159,6 @@ class ServerProfile: NSObject, NSCopying {
d["Method"] = method as AnyObject?
d["Password"] = password as AnyObject?
d["Remark"] = remark as AnyObject?
d["OTA"] = ota as AnyObject?
d["EnabledKcptun"] = NSNumber(value: enabledKcptun)
d["KcptunProfile"] = kcptunProfile.toDictionary() as AnyObject
d["Plugin"] = plugin as AnyObject
d["PluginOptions"] = pluginOptions as AnyObject
return d
@ -206,20 +172,8 @@ class ServerProfile: NSObject, NSCopying {
conf["local_port"] = NSNumber(value: UInt16(defaults.integer(forKey: "LocalSocks5.ListenPort")) as UInt16)
conf["local_address"] = defaults.string(forKey: "LocalSocks5.ListenAddress") as AnyObject?
conf["timeout"] = NSNumber(value: UInt32(defaults.integer(forKey: "LocalSocks5.Timeout")) as UInt32)
if ota {
conf["auth"] = NSNumber(value: ota as Bool)
}
if enabledKcptun {
let localHost = defaults.string(forKey: "Kcptun.LocalHost")
let localPort = uint16(defaults.integer(forKey: "Kcptun.LocalPort"))
conf["server"] = localHost as AnyObject
conf["server_port"] = NSNumber(value: localPort as UInt16)
} else {
conf["server"] = serverHost as AnyObject
conf["server_port"] = NSNumber(value: serverPort as UInt16)
}
if !plugin.isEmpty {
// all plugin binaries should be located in the plugins dir
@ -231,17 +185,6 @@ class ServerProfile: NSObject, NSCopying {
return conf
}
func toKcptunJsonConfig() -> [String: AnyObject] {
var conf = kcptunProfile.toJsonConfig()
if serverHost.contains(Character(":")) {
conf["remoteaddr"] = "[\(serverHost)]:\(serverPort)" as AnyObject
} else {
conf["remoteaddr"] = "\(serverHost):\(serverPort)" as AnyObject
}
return conf
}
func isValid() -> Bool {
func validateIpAddress(_ ipToValidate: String) -> Bool {
@ -289,14 +232,7 @@ class ServerProfile: NSObject, NSCopying {
url.password = password
url.port = Int(serverPort)
url.queryItems = [URLQueryItem(name: "Remark", value: remark),
URLQueryItem(name: "OTA", value: ota.description)]
if enabledKcptun {
url.queryItems?.append(contentsOf: [
URLQueryItem(name: "Kcptun", value: enabledKcptun.description),
])
url.queryItems?.append(contentsOf: kcptunProfile.urlQueryItems())
}
url.queryItems = [URLQueryItem(name: "Remark", value: remark)]
let parts = url.string?.replacingOccurrences(
of: "//", with: "",
@ -322,11 +258,7 @@ class ServerProfile: NSObject, NSCopying {
}
let userInfo = rawUserInfo.base64EncodedString()
var items = [URLQueryItem(name: "OTA", value: ota.description)]
if enabledKcptun {
items.append(URLQueryItem(name: "Kcptun", value: enabledKcptun.description))
items.append(contentsOf: kcptunProfile.urlQueryItems())
}
var items: [URLQueryItem] = []
if !plugin.isEmpty {
let value = "\(plugin);\(pluginOptions)"
items.append(URLQueryItem(name: "plugin", value: value))

View File

@ -1,22 +0,0 @@
#!/bin/sh
# install_kcptun.sh
# ShadowsocksX-NG
#
# Created by 邱宇舟 on 2017/1/11.
# Copyright © 2017年 qiuyuzhou. All rights reserved.
# https://github.com/shadowsocks/kcptun/releases
VERSION="v20170718"
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/"
ln -sfh "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION/kcptun_client" "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_client"
ln -sfh "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION/kcptun_client" "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/kcptun"
echo "install kcptun done"

Binary file not shown.

View File

@ -1,11 +0,0 @@
#!/bin/sh
# start_kcptun.sh
# ShadowsocksX-NG
#
# Created by 邱宇舟 on 2017/1/11.
# Copyright © 2017年 qiuyuzhou. All rights reserved.
chmod 644 "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.kcptun.plist"
launchctl load -wF "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.kcptun.plist"
launchctl start com.qiuyuzhou.shadowsocksX-NG.kcptun

View File

@ -1,10 +0,0 @@
#!/bin/sh
# stop_kcptun.sh
# ShadowsocksX-NG
#
# Created by 邱宇舟 on 2017/1/11.
# Copyright © 2017年 qiuyuzhou. All rights reserved.
launchctl stop com.qiuyuzhou.shadowsocksX-NG.kcptun
launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.kcptun.plist"