MCPcopy
hub / github.com/Zephyruso/zashboard / handlerProxySelect

Function handlerProxySelect

src/assembly/proxies/singbox.ts:139–157  ·  view source on GitHub ↗
(proxyGroupName: string, proxyName: string)

Source from the content-addressed store, hash-verified

137}
138
139export const handlerProxySelect = async (proxyGroupName: string, proxyName: string) => {
140 const client = getSingboxClient()?.client
141 if (!client) return
142
143 await client.selectOutbound({ groupTag: proxyGroupName, outboundTag: proxyName })
144
145 // 乐观更新,流随后会确认
146 const group = groups.get(proxyGroupName)
147 if (group) {
148 group.selected = proxyName
149 rebuild()
150 }
151
152 if (automaticDisconnection.value) {
153 activeConnections.value
154 .filter((c) => getConnectionChains(c).includes(proxyGroupName))
155 .forEach((c) => disconnectByIdAPI(c.id))
156 }
157}
158
159// sing-box native API 的 URLTest 是组级别;节点卡片触发测速时转为所在组测速。
160export const proxyLatencyTest = async (

Callers

nothing calls this directly

Calls 4

getSingboxClientFunction · 0.90
getConnectionChainsFunction · 0.90
disconnectByIdAPIFunction · 0.90
rebuildFunction · 0.85

Tested by

no test coverage detected