-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0becc55
commit e155a99
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", "#" |