mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Protocol/Network rule support
This commit is contained in:
@@ -17,7 +17,8 @@ interface SingboxHeadlessRule {
|
||||
port?: number[],
|
||||
port_range?: string[],
|
||||
process_name?: string[],
|
||||
process_path?: string[]
|
||||
process_path?: string[],
|
||||
network?: string[]
|
||||
}
|
||||
|
||||
export interface SingboxSourceFormat {
|
||||
@@ -154,5 +155,16 @@ export class SingboxSource extends BaseWriteStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
writeProtocols(protocol: Set<string>): void {
|
||||
this.singbox.network ??= [];
|
||||
// protocol has already be normalized and will only be uppercase
|
||||
if (protocol.has('UDP')) {
|
||||
this.singbox.network.push('udp');
|
||||
}
|
||||
if (protocol.has('TCP')) {
|
||||
this.singbox.network.push('tcp');
|
||||
}
|
||||
}
|
||||
|
||||
writeOtherRules = noop;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user