Skip to content

Commit

Permalink
add Clash-classical
Browse files Browse the repository at this point in the history
  • Loading branch information
elysias123 committed Jun 3, 2024
1 parent 0becc55 commit e155a99
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions script/Clash-classical.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

def format_domain(List):
domain = []
for line in List:
domain_lines = f" - DOMAIN,{line.strip()}"
domain.append(domain_lines)
return domain

def format_regex(List):
regex = []
for line in List:
regex_lines = f" - DOMAIN-REGEX,'{line.strip()}'"
regex.append(regex_lines)
return regex

def format_ip(List):
ip = []
for line in List:
ip_lines = f" - IP-CIDR,{line.strip()}"
ip.append(ip_lines)
return ip

def build(rule):
clash_list = ["payload:"] + format_ip(rule.ip_list) + format_domain(rule.domain_list) + format_regex(rule.regex_list)
return clash_list, ".yaml", "#"

0 comments on commit e155a99

Please sign in to comment.