Extracts obfs-local 0.0.2

This commit is contained in:
Timothy Qiu
2017-11-01 11:23:34 +08:00
committed by Haoyu Qiu
parent f7f7aa0589
commit 234a83f2fa
5 changed files with 60 additions and 0 deletions

View File

@ -82,6 +82,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
InstallSSLocal()
InstallKcptunClient()
InstallPrivoxy()
InstallSimpleObfs()
// Prepare defaults
let defaults = UserDefaults.standard
defaults.register(defaults: [

View File

@ -11,6 +11,7 @@ import Foundation
let SS_LOCAL_VERSION = "3.0.5"
let KCPTUN_CLIENT_VERSION = "20170322"
let PRIVOXY_VERSION = "3.0.26.static"
let SIMPLE_OBFS_VERSION = "0.0.2"
let APP_SUPPORT_DIR = "/Library/Application Support/ShadowsocksX-NG/"
let LAUNCH_AGENT_DIR = "/Library/LaunchAgents/"
let LAUNCH_AGENT_CONF_SSLOCAL_NAME = "com.qiuyuzhou.shadowsocksX-NG.local.plist"
@ -180,6 +181,27 @@ func SyncSSLocal() {
SyncKcptun()
}
// --------------------------------------------------------------------------------
// MARK: simple-obfs
func InstallSimpleObfs() {
let fileMgr = FileManager.default
let homeDir = NSHomeDirectory()
let appSupportDir = homeDir + APP_SUPPORT_DIR
if !fileMgr.fileExists(atPath: appSupportDir + "simple-obfs-\(SIMPLE_OBFS_VERSION)/obfs-local")
|| !fileMgr.fileExists(atPath: appSupportDir + "plugins/obfs-local") {
let bundle = Bundle.main
let installerPath = bundle.path(forResource: "install_simple_obfs.sh", ofType: nil)
let task = Process.launchedProcess(launchPath: "/bin/sh", arguments: [installerPath!])
task.waitUntilExit()
if task.terminationStatus == 0 {
NSLog("Install simple-obfs succeeded.")
} else {
NSLog("Install simple-obfs failed.")
}
}
}
// --------------------------------------------------------------------------------
// MARK: privoxy

View File

@ -0,0 +1,19 @@
#!/bin/sh
FILE_DIR=`dirname "${BASH_SOURCE[0]}"`
cd "$FILE_DIR"
NGDir="$HOME/Library/Application Support/ShadowsocksX-NG"
TargetDir="$NGDir/simple-obfs-0.0.2"
PluginDir="$NGDir/plugins"
echo ngdir: ${NGDir}
mkdir -p "$TargetDir"
mkdir -p "$PluginDir"
cp -f obfs-local "$TargetDir"
ln -sfh "$TargetDir/obfs-local" "$PluginDir"
echo done

Binary file not shown.