Add kcptun installer.
This commit is contained in:
@ -73,6 +73,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
|
||||
// Prepare ss-local
|
||||
InstallSSLocal()
|
||||
InstallKcptunClient()
|
||||
InstallPrivoxy()
|
||||
// Prepare defaults
|
||||
let defaults = UserDefaults.standard
|
||||
|
@ -9,6 +9,7 @@
|
||||
import Foundation
|
||||
|
||||
let SS_LOCAL_VERSION = "2.5.6"
|
||||
let KCPTUN_CLIENT_VERSION = "20161222"
|
||||
let PRIVOXY_VERSION = "3.0.26.static"
|
||||
let APP_SUPPORT_DIR = "/Library/Application Support/ShadowsocksX-NG/"
|
||||
let LAUNCH_AGENT_DIR = "/Library/LaunchAgents/"
|
||||
@ -128,6 +129,23 @@ func InstallSSLocal() {
|
||||
}
|
||||
}
|
||||
|
||||
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 writeSSLocalConfFile(_ conf:[String:AnyObject]) -> Bool {
|
||||
do {
|
||||
let filepath = NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local-config.json"
|
||||
|
15
ShadowsocksX-NG/install_kcptun.sh
Executable file
15
ShadowsocksX-NG/install_kcptun.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# install_kcptun.sh
|
||||
# ShadowsocksX-NG
|
||||
#
|
||||
# Created by 邱宇舟 on 2017/1/11.
|
||||
# Copyright © 2017年 qiuyuzhou. All rights reserved.
|
||||
|
||||
cd `dirname "${BASH_SOURCE[0]}"`
|
||||
mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_20161222"
|
||||
cp -f kcptun_client "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_20161222/"
|
||||
rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_client"
|
||||
ln -s "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_20161222/kcptun_client" "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_client"
|
||||
|
||||
echo "install kcptun done"
|
BIN
ShadowsocksX-NG/kcptun_client
Executable file
BIN
ShadowsocksX-NG/kcptun_client
Executable file
Binary file not shown.
Reference in New Issue
Block a user