xrayRemoveUser 通过 in-process proxy.UserManager 接口热删用户。
(ctx context.Context, instance *xrayCore.Instance, tag, email string)
| 923 | |
| 924 | // xrayRemoveUser 通过 in-process proxy.UserManager 接口热删用户。 |
| 925 | func xrayRemoveUser(ctx context.Context, instance *xrayCore.Instance, tag, email string) error { |
| 926 | ihm, ok := instance.GetFeature(inbound.ManagerType()).(inbound.Manager) |
| 927 | if !ok { |
| 928 | return fmt.Errorf("RemoveUser: inbound manager not available") |
| 929 | } |
| 930 | handler, err := ihm.GetHandler(ctx, tag) |
| 931 | if err != nil { |
| 932 | return fmt.Errorf("RemoveUser: get handler %q: %w", tag, err) |
| 933 | } |
| 934 | gi, ok := handler.(proxy.GetInbound) |
| 935 | if !ok { |
| 936 | return fmt.Errorf("RemoveUser: handler %q does not support GetInbound", tag) |
| 937 | } |
| 938 | um, ok := gi.GetInbound().(proxy.UserManager) |
| 939 | if !ok { |
| 940 | return fmt.Errorf("RemoveUser: inbound %q does not support UserManager", tag) |
| 941 | } |
| 942 | return um.RemoveUser(ctx, email) |
| 943 | } |
| 944 | |
| 945 | // extractInboundPorts 从 xray JSON 配置中提取所有 inbound 的监听端口。 |
| 946 | func extractInboundPorts(config string) map[int]struct{} { |
no test coverage detected