MCPcopy Create free account
hub / github.com/PasarGuard/node / updateUsers

Method updateUsers

backend/xray/config.go:241–299  ·  view source on GitHub ↗
(accounts []api.Account, removeEmails []string)

Source from the content-addressed store, hash-verified

239}
240
241func (i *Inbound) updateUsers(accounts []api.Account, removeEmails []string) {
242 i.mu.Lock()
243 defer i.mu.Unlock()
244
245 if i.clients == nil {
246 i.clients = make(map[string]api.Account)
247 }
248
249 switch i.Protocol {
250 case Vmess:
251 for _, account := range accounts {
252 if a, ok := account.(*api.VmessAccount); ok {
253 i.clients[account.GetEmail()] = a
254 }
255 }
256
257 case Vless:
258 for _, account := range accounts {
259 if a, ok := account.(*api.VlessAccount); ok {
260 i.clients[account.GetEmail()] = a
261 }
262 }
263
264 case Trojan:
265 for _, account := range accounts {
266 if a, ok := account.(*api.TrojanAccount); ok {
267 i.clients[account.GetEmail()] = a
268 }
269 }
270
271 case Shadowsocks:
272 method, methodOk := i.Settings["method"].(string)
273 if methodOk && strings.HasPrefix(method, "2022-blake3") {
274 for _, account := range accounts {
275 if a, ok := account.(*api.ShadowsocksAccount); ok {
276 newAccount := checkShadowsocks2022(method, *a)
277 i.clients[account.GetEmail()] = &newAccount
278 }
279 }
280 } else {
281 for _, account := range accounts {
282 if a, ok := account.(*api.ShadowsocksTcpAccount); ok {
283 i.clients[account.GetEmail()] = a
284 }
285 }
286 }
287
288 case Hysteria:
289 for _, account := range accounts {
290 if a, ok := account.(*api.HysteriaAccount); ok {
291 i.clients[account.GetEmail()] = a
292 }
293 }
294 }
295
296 for _, email := range removeEmails {
297 delete(i.clients, email)
298 }

Callers

nothing calls this directly

Calls 2

checkShadowsocks2022Function · 0.85
GetEmailMethod · 0.65

Tested by

no test coverage detected