Skip to content

Commit

Permalink
fix: Ruleset 中 IP-CIDR6 的处理不当
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Dec 10, 2019
1 parent 9913f36 commit edee2bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/utils/remote-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const addProxyToSurgeRuleSet = (str: string, proxyName: string): string =
case 'NOT':
return `${item},${proxyName}`;
case 'IP-CIDR':
case 'IP-CIDR6':
case 'GEOIP':
rule.splice(2, 0, proxyName);
return rule.join(',');
Expand Down
8 changes: 8 additions & 0 deletions test/utils/remote-snippet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,18 @@ test('addProxyToSurgeRuleSet', t => {
utils.addProxyToSurgeRuleSet('IP-CIDR,192.168.0.0/16,no-resolve', 'Proxy'),
'IP-CIDR,192.168.0.0/16,Proxy,no-resolve'
);
t.is(
utils.addProxyToSurgeRuleSet('IP-CIDR6,2a03:2880:f200:c3:face:b00c::177/128,no-resolve', 'Proxy'),
'IP-CIDR6,2a03:2880:f200:c3:face:b00c::177/128,Proxy,no-resolve'
);
t.is(
utils.addProxyToSurgeRuleSet('IP-CIDR,192.168.0.0/16', 'Proxy'),
'IP-CIDR,192.168.0.0/16,Proxy'
);
t.is(
utils.addProxyToSurgeRuleSet('IP-CIDR6,2a03:2880:f200:c3:face:b00c::177/128', 'Proxy'),
'IP-CIDR6,2a03:2880:f200:c3:face:b00c::177/128,Proxy'
);
t.is(
utils.addProxyToSurgeRuleSet('GEOIP,US,no-resolve', 'Proxy'),
'GEOIP,US,Proxy,no-resolve'
Expand Down

0 comments on commit edee2bd

Please sign in to comment.