Chore: Clash script
This commit is contained in:
@@ -128,27 +128,26 @@ script:
|
|||||||
|
|
||||||
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]
|
||||||
if port not in port_list:
|
if port not in port_list:
|
||||||
return "DIRECT"
|
|
||||||
ctx.log('[Script] not common port use direct')
|
ctx.log('[Script] not common port use direct')
|
||||||
|
return "DIRECT"
|
||||||
|
|
||||||
if metadata["dst_ip"] == "":
|
if metadata["dst_ip"] == "":
|
||||||
metadata["dst_ip"] = ctx.resolve_ip(metadata["host"])
|
metadata["dst_ip"] = ctx.resolve_ip(metadata["host"])
|
||||||
|
|
||||||
ruleset_list = [r for r in ruleset_action]
|
for ruleset in ruleset_action:
|
||||||
for rule_name in ruleset_list:
|
if ctx.rule_providers[ruleset].match(metadata):
|
||||||
if ctx.rule_providers[rule_name].match(metadata):
|
return ruleset_action[ruleset]
|
||||||
return ruleset_action[rule_name]
|
|
||||||
|
|
||||||
if metadata["dst_ip"] == "":
|
if metadata["dst_ip"] == "":
|
||||||
return "DIRECT"
|
return "DIRECT"
|
||||||
|
|
||||||
code = ctx.geoip(metadata["dst_ip"])
|
code = ctx.geoip(metadata["dst_ip"])
|
||||||
if code == "CN":
|
if code == "CN":
|
||||||
return "Domestic"
|
|
||||||
ctx.log('[Script] Geoip CN')
|
ctx.log('[Script] Geoip CN')
|
||||||
|
return "Domestic"
|
||||||
|
|
||||||
return "Others"
|
|
||||||
ctx.log('[Script] FINAL')
|
ctx.log('[Script] FINAL')
|
||||||
|
return "Others"
|
||||||
|
|
||||||
rule-providers:
|
rule-providers:
|
||||||
Reject:
|
Reject:
|
||||||
|
|||||||
Reference in New Issue
Block a user