|
|
@ -50,6 +50,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
- RULE-SET,PROXY,Proxy
|
|
|
|
- RULE-SET,PROXY,Proxy
|
|
|
|
- RULE-SET,Domestic,Domestic
|
|
|
|
- RULE-SET,Domestic,Domestic
|
|
|
|
|
|
|
|
- RULE-SET,Domestic IPs,Domestic
|
|
|
|
- RULE-SET,Apple,Apple
|
|
|
|
- RULE-SET,Apple,Apple
|
|
|
|
|
|
|
|
|
|
|
|
- GEOIP,CN,Domestic
|
|
|
|
- GEOIP,CN,Domestic
|
|
|
@ -58,14 +59,6 @@
|
|
|
|
script:
|
|
|
|
script:
|
|
|
|
code: |
|
|
|
|
code: |
|
|
|
|
def main(ctx, metadata):
|
|
|
|
def main(ctx, metadata):
|
|
|
|
ip = ctx.resolve_ip(metadata["host"])
|
|
|
|
|
|
|
|
if ip == "":
|
|
|
|
|
|
|
|
return "DIRECT"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
code = ctx.geoip(ip)
|
|
|
|
|
|
|
|
if code == "CN":
|
|
|
|
|
|
|
|
return "Domestic"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
port_list = [21, 22, 23, 53, 80, 123, 143, 194, 443, 465, 587, 853, 993, 995, 998, 2052, 2053, 2082, 2083, 2086, 2095, 2096, 5222, 5228, 5229, 5230, 8080, 8443, 8880, 8888, 8889]
|
|
|
|
port_list = [21, 22, 23, 53, 80, 123, 143, 194, 443, 465, 587, 853, 993, 995, 998, 2052, 2053, 2082, 2083, 2086, 2095, 2096, 5222, 5228, 5229, 5230, 8080, 8443, 8880, 8888, 8889]
|
|
|
|
ruleset_action = {"Reject": "AdBlock",
|
|
|
|
ruleset_action = {"Reject": "AdBlock",
|
|
|
|
"Special": "DIRECT",
|
|
|
|
"Special": "DIRECT",
|
|
|
@ -111,6 +104,7 @@ script:
|
|
|
|
"Microsoft": "Microsoft",
|
|
|
|
"Microsoft": "Microsoft",
|
|
|
|
"PROXY": "Proxy",
|
|
|
|
"PROXY": "Proxy",
|
|
|
|
"Domestic": "Domestic",
|
|
|
|
"Domestic": "Domestic",
|
|
|
|
|
|
|
|
"Domestic IPs": "Domestic",
|
|
|
|
"Apple": "Apple"
|
|
|
|
"Apple": "Apple"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
port = int(metadata["dst_port"])
|
|
|
|
port = int(metadata["dst_port"])
|
|
|
@ -122,6 +116,18 @@ script:
|
|
|
|
if ctx.rule_providers[rule_name].match(metadata):
|
|
|
|
if ctx.rule_providers[rule_name].match(metadata):
|
|
|
|
return ruleset_action[rule_name]
|
|
|
|
return ruleset_action[rule_name]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ip = ctx.resolve_ip(metadata["host"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ip == "":
|
|
|
|
|
|
|
|
return "DIRECT"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
code = ctx.geoip(ip)
|
|
|
|
|
|
|
|
if code == "CN":
|
|
|
|
|
|
|
|
return "Domestic"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if code == "LAN":
|
|
|
|
|
|
|
|
return "DIRECT"
|
|
|
|
|
|
|
|
|
|
|
|
return "Others"
|
|
|
|
return "Others"
|
|
|
|
|
|
|
|
|
|
|
|
rule-providers:
|
|
|
|
rule-providers:
|
|
|
@ -406,4 +412,10 @@ rule-providers:
|
|
|
|
behavior: classical
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://git.dler.io/lhie1/Rules/master/Clash/Provider/Apple.yaml'
|
|
|
|
url: 'https://git.dler.io/lhie1/Rules/master/Clash/Provider/Apple.yaml'
|
|
|
|
path: ./Rules/Apple
|
|
|
|
path: ./Rules/Apple
|
|
|
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
|
|
Domestic IPs:
|
|
|
|
|
|
|
|
type: http
|
|
|
|
|
|
|
|
behavior: ipcidr
|
|
|
|
|
|
|
|
url: 'https://git.dler.io/lhie1/Rules/master/Clash/Provider/Domestic%20IPs.yaml'
|
|
|
|
|
|
|
|
path: ./Rules/Domestic_IPs
|
|
|
|
interval: 86400
|
|
|
|
interval: 86400
|