mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Refactor: support RULE-SET as Mihomo's nameserver-policy
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user