mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-03 04:21:53 +08:00
Fix CloudMounter
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import picocolors from 'picocolors';
|
||||
import { domainWildCardToRegex } from './misc';
|
||||
import { isProbablyIpv4, isProbablyIpv6 } from './is-fast-ip';
|
||||
|
||||
const identity = <T>(x: T): T => x;
|
||||
const unsupported = Symbol('unsupported');
|
||||
@@ -14,6 +15,18 @@ const PROCESSOR: Record<string, ((raw: string, type: string, value: string) => s
|
||||
'IP-CIDR': identity,
|
||||
'IP-CIDR6': identity,
|
||||
'IP-ASN': identity,
|
||||
'SRC-IP': (_raw, _type, value) => {
|
||||
if (value.includes('/')) {
|
||||
return `SRC-IP-CIDR,${value}`;
|
||||
}
|
||||
if (isProbablyIpv4(value)) {
|
||||
return `SRC-IP-CIDR,${value}/32`;
|
||||
}
|
||||
if (isProbablyIpv6(value)) {
|
||||
return `SRC-IP-CIDR6,${value}/128`;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
'SRC-IP-CIDR': identity,
|
||||
'SRC-PORT': identity,
|
||||
'DST-PORT': identity,
|
||||
|
||||
Reference in New Issue
Block a user