Feature: support custom ignore list
This commit is contained in:
parent
216996b9fd
commit
b66ce2500f
@ -4,7 +4,7 @@ import AppKit
|
||||
|
||||
class ProxyConfigHelperManager {
|
||||
static let kProxyConfigFolder = (NSHomeDirectory() as NSString).appendingPathComponent("/.config/clash")
|
||||
static let kVersion = "0.1.2"
|
||||
static let kVersion = "0.1.3"
|
||||
|
||||
|
||||
static func vaildHelper() -> Bool {
|
||||
|
@ -94,7 +94,7 @@
|
||||
TargetAttributes = {
|
||||
36B6A3221E263590002B5B1D = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
LastSwiftMigration = 1000;
|
||||
LastSwiftMigration = 1020;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
};
|
||||
@ -104,6 +104,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
);
|
||||
mainGroup = 36B6A31A1E263590002B5B1D;
|
||||
@ -241,8 +242,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -255,8 +255,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -1,9 +1,30 @@
|
||||
import Foundation
|
||||
import SystemConfiguration
|
||||
|
||||
let version = "0.1.2"
|
||||
let version = "0.1.3"
|
||||
|
||||
|
||||
func getIgnoreList() -> [String] {
|
||||
let configPath = "\(NSHomeDirectory())/.config/clash/proxyIgnoreList.plist"
|
||||
if FileManager.default.fileExists(atPath: configPath) {
|
||||
if let arr = NSArray(contentsOfFile: configPath) as? [String] {
|
||||
return arr
|
||||
}
|
||||
}
|
||||
let ignoreList = [
|
||||
"192.168.0.0/16",
|
||||
"10.0.0.0/8",
|
||||
"172.16.0.0/12",
|
||||
"127.0.0.1",
|
||||
"localhost",
|
||||
"*.local",
|
||||
"*.crashlytics.com"
|
||||
]
|
||||
return ignoreList
|
||||
|
||||
|
||||
}
|
||||
|
||||
func getProxySetting(enable:Bool,port:Int,socksPort:Int) -> [String:AnyObject] {
|
||||
let ip = enable ? "127.0.0.1" : ""
|
||||
let enableInt = enable ? 1 : 0
|
||||
@ -25,22 +46,7 @@ func getProxySetting(enable:Bool,port:Int,socksPort:Int) -> [String:AnyObject] {
|
||||
proxySettings[kCFNetworkProxiesSOCKSPort as String] = nil
|
||||
}
|
||||
|
||||
var ignoreList = [
|
||||
"192.168.0.0/16",
|
||||
"10.0.0.0/8",
|
||||
"172.16.0.0/12",
|
||||
"127.0.0.1",
|
||||
"localhost",
|
||||
"*.local"
|
||||
]
|
||||
|
||||
if !UserDefaults.standard.bool(forKey: "disableIgnoreCrashlytics") {
|
||||
ignoreList.append("*.crashlytics.com")
|
||||
}
|
||||
|
||||
if let customArr = UserDefaults.standard.array(forKey: "customIgnoreList") as? [String] {
|
||||
ignoreList.append(contentsOf: customArr)
|
||||
}
|
||||
let ignoreList = getIgnoreList()
|
||||
|
||||
proxySettings[kCFNetworkProxiesExceptionsList as String] = ignoreList as AnyObject
|
||||
|
||||
|
12
README.md
12
README.md
@ -45,4 +45,16 @@ The default name of the configuration file is `config.yml`. You can use your cus
|
||||
|
||||
Checking [Github for Clash](https://github.com/Dreamacro/clash) or [SS-Rule-Snippet for Clash](https://github.com/Hackl0us/SS-Rule-Snippet/blob/master/LAZY_RULES/clash.yml) for more detail.
|
||||
|
||||
## Advance Config
|
||||
### Change your status menu icon
|
||||
|
||||
Place your icon file in the ~/.config/clash/menuImage.png then restart ClashX
|
||||
|
||||
### Change default system ignore list.
|
||||
|
||||
- Download sample plist in the [Here](https://baidu.com) and place in the ~/.config/clash/proxyIgnoreList.plist
|
||||
|
||||
- edit the proxyIgnoreList.plist to set up your own proxy ignore list
|
||||
|
||||
|
||||
|
||||
|
14
proxyIgnoreList.plist
Normal file
14
proxyIgnoreList.plist
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array>
|
||||
<string>192.168.0.0/16</string>
|
||||
<string>10.0.0.0/8</string>
|
||||
<string>172.16.0.0/12</string>
|
||||
<string>127.0.0.1</string>
|
||||
<string>localhost</string>
|
||||
<string>*.local</string>
|
||||
<string>*.crashlytics.com</string>
|
||||
<string>my-custom-site.com</string>
|
||||
</array>
|
||||
</plist>
|
Loading…
Reference in New Issue
Block a user