1. fix issue https://github.com/qinyuhang/ShadowsocksX-NG/issues/35
2. add new ss-local support traffic log (experiment only count traffic
going through proxy)
3. ping client update menu upon finish ping any one server
This commit is contained in:
qinyuhang
2016-10-07 10:50:03 +08:00
parent afa46d20b4
commit d26410aae6
3 changed files with 16 additions and 14 deletions
+14 -12
View File
@@ -60,17 +60,20 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
// PingServers.instance.ping()
// let newInstance = PingTest.init(hostName: "www.baidu.com")
// newInstance.start()
let SerMgr = ServerProfileManager.instance
let pingServerQueue : DispatchQueue = DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.high)
for profile in SerMgr.profiles {
let host = profile.serverHost
pingServerQueue.async(execute: {
// let SerMgr = ServerProfileManager.instance
// let pingServerQueue : DispatchQueue = DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.high)
//
// for profile in SerMgr.profiles {
// let host = profile.serverHost
//
// pingServerQueue.async(execute: {
// print(profile.serverHost)
let pingInstance = PingTest.init(hostName: host)
pingInstance.start()
})}
// SimplePingClient().pingHostname(host) { latency in
// print("-----------\(host) latency is \(latency ?? "fail")")}
//// let pingInstance = PingTest.init(hostName: host)
//// pingInstance.start()
// })}
NSUserNotificationCenter.default.delegate = self
// Prepare ss-local
@@ -120,6 +123,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
}
}
self.updateServersMenu()
self.updateMainMenu()
SyncSSLocal()
}
)
@@ -152,9 +156,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
} else if userInfo["source"] as! String == "url" {
userNote.subtitle = "By Handle SS URL".localized
}
userNote.informativeText = "Host: \(profile.serverHost)"
" Port: \(profile.serverPort)"
" Encription Method: \(profile.method)".localized
userNote.informativeText = "Host: \(profile.serverHost)\n Port: \(profile.serverPort)\n Encription Method: \(profile.method)".localized
userNote.soundName = NSUserNotificationDefaultSoundName
NSUserNotificationCenter.default
+2 -2
View File
@@ -94,8 +94,6 @@ class PingServers:NSObject{
}
if i >= SerMgr.profiles.count{
(NSApplication.shared().delegate as! AppDelegate).updateServersMenu()
(NSApplication.shared().delegate as! AppDelegate).updateRunningModeMenu()
let notice = NSUserNotification()
notice.title = "Ping测试完成!"
notice.subtitle = "最快的是\(SerMgr.profiles[fastest_id].remark) \(SerMgr.profiles[fastest_id].serverHost) \(SerMgr.profiles[fastest_id].latency!)ms"
@@ -117,6 +115,8 @@ class PingServers:NSObject{
self.fastest_id = i
}
}
(NSApplication.shared().delegate as! AppDelegate).updateServersMenu()
(NSApplication.shared().delegate as! AppDelegate).updateRunningModeMenu()
}
self.ping(i+1)
Binary file not shown.