Merge pull request #289 from makaspacex/master

修复IP-CIDR的option错误
This commit is contained in:
xream 2024-02-28 22:19:11 +08:00 committed by GitHub
commit 56626dabc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ const RULE_TYPES_MAPPING = [
[/^(IN|SRC)-PORT$/, 'IN-PORT'],
[/^PROTOCOL$/, 'PROTOCOL'],
[/^IP-CIDR$/i, 'IP-CIDR'],
[/^(IP-CIDR6|ip6-cidr|IP6-CIDR)$/],
[/^(IP-CIDR6|ip6-cidr|IP6-CIDR)$/, 'IP-CIDR6'],
];
function AllRuleParser() {
@ -40,7 +40,7 @@ function AllRuleParser() {
rule.type === 'IP-CIDR' ||
rule.type === 'IP-CIDR6'
) {
rule.options = params.slice(2);
rule.options = params.slice(2).join(",");
}
result.push(rule);
}

View File

@ -31,7 +31,7 @@ function SurgeRuleSet() {
const func = (rule) => {
let output = `${rule.type},${rule.content}`;
if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') {
output += rule.options ? `,${rule.options[0]}` : '';
output += rule.options ? `,${rule.options}` : '';
}
return output;
};
@ -63,7 +63,7 @@ function ClashRuleProvider() {
rule.content
}`;
if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') {
output += rule.options ? `,${rule.options[0]}` : '';
output += rule.options ? `,${rule.options}` : '';
}
return output;
}),