2025-04-29 21:54:41 +08:00

50 lines
1.2 KiB
TypeScript

import type { Span } from '../../trace';
import { ClashClassicRuleSet } from '../writing-strategy/clash';
import { LegacyClashPremiumRuleSet } from '../writing-strategy/legacy-clash-premium';
import { SingboxSource } from '../writing-strategy/singbox';
import { SurgeRuleSet } from '../writing-strategy/surge';
import { FileOutput } from './base';
export class RulesetOutput extends FileOutput {
constructor(span: Span, id: string, type: 'non_ip' | 'ip') {
super(span, id);
this.strategies = [
new SurgeRuleSet(type),
new ClashClassicRuleSet(type),
new LegacyClashPremiumRuleSet(type),
new SingboxSource(type)
];
}
}
export class SurgeOnlyRulesetOutput extends FileOutput {
constructor(
span: Span,
id: string,
type: 'non_ip' | 'ip' | (string & {}),
overrideOutputDir?: string
) {
super(span, id);
this.strategies = [
new SurgeRuleSet(type, overrideOutputDir)
];
}
}
export class ClashOnlyRulesetOutput extends FileOutput {
constructor(
span: Span,
id: string,
type: 'non_ip' | 'ip'
) {
super(span, id);
this.strategies = [
new ClashClassicRuleSet(type),
new LegacyClashPremiumRuleSet(type)
];
}
}