Refactor: support RULE-SET as Mihomo's nameserver-policy

This commit is contained in:
SukkaW
2025-10-16 23:01:38 +08:00
parent 7aa2597641
commit f96612053e
3 changed files with 90 additions and 23 deletions

View File

@@ -35,6 +35,21 @@ export class SurgeOnlyRulesetOutput extends FileOutput {
}
}
export class MihomoNameserverPolicyOutput extends FileOutput {
constructor(
span: Span,
id: string,
type: 'non_ip' | (string & {}),
overrideOutputDir?: string
) {
super(span, id);
this.strategies = [
new ClashClassicRuleSet(type, overrideOutputDir)
];
}
}
export class ClashOnlyRulesetOutput extends FileOutput {
constructor(
span: Span,

View File

@@ -94,7 +94,7 @@ export class ClashClassicRuleSet extends BaseWriteStrategy {
protected result: string[] = [`DOMAIN,${MARKER_DOMAIN}`];
constructor(public readonly type: 'ip' | 'non_ip' /* | (string & {}) */, public readonly outputDir = OUTPUT_CLASH_DIR) {
constructor(public readonly type: 'ip' | 'non_ip' | (string & {}), public readonly outputDir = OUTPUT_CLASH_DIR) {
super(outputDir);
}