2025-01-29 21:24:00 +08:00

47 lines
1.1 KiB
TypeScript

import type { Span } from '../../trace';
import { ClashClassicRuleSet } from '../writing-strategy/clash';
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, protected type: 'non_ip' | 'ip' | (string & {})) {
super(span, id);
this.strategies = [
new SurgeRuleSet(this.type),
new ClashClassicRuleSet(this.type),
new SingboxSource(this.type)
];
}
}
export class SurgeOnlyRulesetOutput extends FileOutput {
constructor(
span: Span,
id: string,
protected type: 'non_ip' | 'ip' | (string & {}),
overrideOutputDir?: string
) {
super(span, id);
this.strategies = [
new SurgeRuleSet(this.type, overrideOutputDir)
];
}
}
export class ClashOnlyRulesetOutput extends FileOutput {
constructor(
span: Span,
id: string,
protected type: 'non_ip' | 'ip' | (string & {})
) {
super(span, id);
this.strategies = [
new ClashClassicRuleSet(this.type)
];
}
}