Chore: fix singbox & clash processPath, more TODO

This commit is contained in:
SukkaW 2024-09-21 04:41:03 +08:00
parent 9eec31be10
commit a3aec826f5
3 changed files with 12 additions and 4 deletions

View File

@ -30,8 +30,7 @@ const PROCESSOR: Record<string, ((raw: string, type: string, value: string) => s
'SRC-IP-CIDR': identity,
'SRC-PORT': identity,
'DST-PORT': identity,
'PROCESS-NAME': identity,
'PROCESS-PATH': identity,
'PROCESS-NAME': (_raw, _type, value) => ((value.includes('/') || value.includes('\\')) ? `PROCESS-PATH,${value}` : `PROCESS-NAME,${value}`),
'DEST-PORT': (_raw, _type, value) => `DST-PORT,${value}`,
'IN-PORT': (_raw, _type, value) => `SRC-PORT,${value}`,
'URL-REGEX': unsupported,

View File

@ -31,6 +31,7 @@ const sortTypeOrder: Record<string | typeof defaultSortTypeOrder, number> = {
'URL-REGEX': 100,
AND: 300,
OR: 300,
GEOIP: 400,
'IP-CIDR': 400,
'IP-CIDR6': 400
};
@ -43,6 +44,14 @@ abstract class RuleOutput {
protected ipcidrNoResolve = new Set<string>();
protected ipcidr6 = new Set<string>();
protected ipcidr6NoResolve = new Set<string>();
// TODO: add sourceIpcidr
// TODO: add sourcePort
// TODO: add port
// TODO: processName
// TODO: processPath
// TODO: userAgent
// TODO: urlRegex
protected otherRules: Array<[raw: string, orderWeight: number]> = [];
protected abstract type: 'domainset' | 'non_ip' | 'ip';

View File

@ -34,8 +34,8 @@ const PROCESSOR: Record<string, ((raw: string, type: string, value: string) => [
'SRC-IP-CIDR': (_1, _2, value) => ['source_ip_cidr', value.endsWith(',no-resolve') ? value.slice(0, -11) : value],
'SRC-PORT': (_1, _2, value) => toNumberTuple('source_port', value),
'DST-PORT': (_1, _2, value) => toNumberTuple('port', value),
'PROCESS-NAME': (_1, _2, value) => ['process_name', value],
'PROCESS-PATH': (_1, _2, value) => ['process_path', value],
'PROCESS-NAME': (_1, _2, value) => ((value.includes('/') || value.includes('\\')) ? ['process_path', value] : ['process_name', value]),
// 'PROCESS-PATH': (_1, _2, value) => ['process_path', value],
'DEST-PORT': (_1, _2, value) => toNumberTuple('port', value),
'IN-PORT': (_1, _2, value) => toNumberTuple('source_port', value),
'URL-REGEX': unsupported,