diff --git a/Build/lib/clash.ts b/Build/lib/clash.ts index 09eb4d7a..17f5020a 100644 --- a/Build/lib/clash.ts +++ b/Build/lib/clash.ts @@ -1,20 +1,26 @@ +import picocolors from 'picocolors'; + const identity = (x: T): T => x; +const unsupported = Symbol('unsupported'); // https://dreamacro.github.io/clash/configuration/rules.html -const PROCESSOR: Record string> = { +const PROCESSOR: Record string) | typeof unsupported> = { DOMAIN: identity, 'DOMAIN-SUFFIX': identity, 'DOMAIN-KEYWORD': identity, GEOIP: identity, 'IP-CIDR': identity, 'IP-CIDR6': identity, + 'IP-ASN': identity, 'SRC-IP-CIDR': identity, 'SRC-PORT': identity, '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}` + 'IN-PORT': (_raw, type, value) => `SRC-PORT,${value}`, + 'URL-REGEX': unsupported, + 'USER-AGENT': unsupported }; export const surgeRulesetToClashClassicalTextRuleset = (rules: string[] | Set) => { @@ -34,7 +40,12 @@ export const surgeRulesetToClashClassicalTextRuleset = (rules: string[] | Set