mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-03 12:31:54 +08:00
Feat: Surge DOMAIN-WILDCARD -> Clash DOMAIN-REGEX
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import picocolors from 'picocolors';
|
||||
import { domainWildCardToRegex } from './misc';
|
||||
|
||||
const identity = <T>(x: T): T => x;
|
||||
const unsupported = Symbol('unsupported');
|
||||
@@ -8,6 +9,7 @@ const PROCESSOR: Record<string, ((raw: string, type: string, value: string) => s
|
||||
DOMAIN: identity,
|
||||
'DOMAIN-SUFFIX': identity,
|
||||
'DOMAIN-KEYWORD': identity,
|
||||
'DOMAIN-WILDCARD': (_raw, _type, value) => `DOMAIN-REGEX,${domainWildCardToRegex(value)}`,
|
||||
GEOIP: identity,
|
||||
'IP-CIDR': identity,
|
||||
'IP-CIDR6': identity,
|
||||
@@ -17,8 +19,8 @@ const PROCESSOR: Record<string, ((raw: string, type: string, value: string) => s
|
||||
'DST-PORT': identity,
|
||||
'PROCESS-NAME': identity,
|
||||
'PROCESS-PATH': identity,
|
||||
'DEST-PORT': (_raw, type, value) => `DST-PORT,${value}`,
|
||||
'IN-PORT': (_raw, type, value) => `SRC-PORT,${value}`,
|
||||
'DEST-PORT': (_raw, _type, value) => `DST-PORT,${value}`,
|
||||
'IN-PORT': (_raw, _type, value) => `SRC-PORT,${value}`,
|
||||
'URL-REGEX': unsupported,
|
||||
'USER-AGENT': unsupported
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user