mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-10-30 22:23:43 +00:00
refactor(runtime): remove redundant mode guard
This commit is contained in:
@@ -248,7 +248,7 @@ final class ProxyControlWorkflow: ObservableObject {
|
||||
return republish()
|
||||
}
|
||||
|
||||
/// 切换代理模式:可用性与 no-op 语义由控制器既有入口裁定;
|
||||
/// 切换代理模式:no-op 语义由控制器既有入口裁定;
|
||||
/// 完成后整体重发布。持久化失败保留旧模式,失败以 typed fact 呈现。
|
||||
@discardableResult
|
||||
func setProxyMode(_ mode: ProxyMode) async -> ProxyControlSnapshot {
|
||||
|
||||
@@ -5,7 +5,6 @@ extension ProxyRuntimeController {
|
||||
/// and global) also deploy and verify the ACL runtime even when system proxy
|
||||
/// is off, because manually connected SOCKS and HTTP clients use the same ACL.
|
||||
func setProxyMode(_ mode: ProxyMode) async {
|
||||
guard ProxyMode.availableModes.contains(mode) else { return }
|
||||
guard mode != proxyMode else { return }
|
||||
await transitionMode(mode, ruleDefaultAction: settings.ruleDefaultAction)
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ import XCTest
|
||||
|
||||
@testable import ShadowsocksX_NG2
|
||||
|
||||
/// Domain mode availability is the single policy shared by the menu and
|
||||
/// runtime mode entry points.
|
||||
/// Built-in modes keep a stable selector order and project local proxy settings.
|
||||
final class ProxyModeAvailabilityTests: XCTestCase {
|
||||
func testBuiltInModesAreAlwaysAvailableInProductOrder() {
|
||||
XCTAssertEqual(
|
||||
|
||||
Reference in New Issue
Block a user