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

Function isActiveInbound

backend/xray/user.go:74–118  ·  view source on GitHub ↗
(inbound *Inbound, inbounds []string, settings api.ProxySettings)

Source from the content-addressed store, hash-verified

72}
73
74func isActiveInbound(inbound *Inbound, inbounds []string, settings api.ProxySettings) (api.Account, bool) {
75 if slices.Contains(inbounds, inbound.Tag) {
76 switch inbound.Protocol {
77 case Vless:
78 if settings.Vless == nil {
79 return nil, false
80 }
81 return settings.Vless, true
82
83 case Vmess:
84 if settings.Vmess == nil {
85 return nil, false
86 }
87 return settings.Vmess, true
88
89 case Trojan:
90 if settings.Trojan == nil {
91 return nil, false
92 }
93 return settings.Trojan, true
94
95 case Shadowsocks:
96 method, ok := inbound.Settings["method"].(string)
97 if ok && strings.HasPrefix(method, "2022-blake3") {
98 if settings.Shadowsocks2022 == nil {
99 return nil, false
100 }
101 account := checkShadowsocks2022(method, *settings.Shadowsocks2022)
102
103 return &account, true
104 }
105 if settings.Shadowsocks == nil {
106 return nil, false
107 }
108 return settings.Shadowsocks, true
109
110 case Hysteria:
111 if settings.Hysteria == nil {
112 return nil, false
113 }
114 return settings.Hysteria, true
115 }
116 }
117 return nil, false
118}
119
120func (x *Xray) SyncUser(ctx context.Context, user *common.User) error {
121 proxySetting, err := setupUserAccount(user)

Callers 3

buildInboundUpdatesMethod · 0.85
SyncUserMethod · 0.85

Calls 1

checkShadowsocks2022Function · 0.85