mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Experimental Surfboard support
This commit is contained in:
25
Build/lib/writing-strategy/surfboard.ts
Normal file
25
Build/lib/writing-strategy/surfboard.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { noop } from 'foxts/noop';
|
||||
import { SurgeRuleSet } from './surge';
|
||||
import { OUTPUT_SURFBOARD_DIR } from '../../constants/dir';
|
||||
import { appendSetElementsToArray } from 'foxts/append-set-elements-to-array';
|
||||
|
||||
export class SurfboardRuleSet extends SurgeRuleSet {
|
||||
public override readonly name: string = 'surfboard for android ruleset';
|
||||
|
||||
protected result: string[] = ['DOMAIN,this_ruleset_is_made_by_sukkaw.ruleset.skk.moe'];
|
||||
constructor(public readonly type: 'ip' | 'non_ip' /* | (string & {}) */, public readonly outputDir = OUTPUT_SURFBOARD_DIR) {
|
||||
super(type, outputDir);
|
||||
}
|
||||
|
||||
override writeDomainWildcards = noop;
|
||||
override writeUserAgents = noop;
|
||||
override writeUrlRegexes = noop;
|
||||
override writeIpAsns = noop;
|
||||
|
||||
override writeSourcePorts(port: Set<string>): void {
|
||||
// https://getsurfboard.com/docs/profile-format/rule/misc
|
||||
appendSetElementsToArray(this.result, port, i => `IN-PORT,${i}`);
|
||||
}
|
||||
|
||||
override writeOtherRules = noop;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export class SurgeDomainSet extends BaseWriteStrategy {
|
||||
}
|
||||
|
||||
export class SurgeRuleSet extends BaseWriteStrategy {
|
||||
public readonly name = 'surge ruleset';
|
||||
public readonly name: string = 'surge ruleset';
|
||||
|
||||
readonly fileExtension = 'conf';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user