MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / xrayAddUser

Function xrayAddUser

internal/xray/manager.go:904–922  ·  view source on GitHub ↗

xrayAddUser 通过 in-process proxy.UserManager 接口热增用户。

(ctx context.Context, instance *xrayCore.Instance, tag string, user *protocol.MemoryUser)

Source from the content-addressed store, hash-verified

902
903// xrayAddUser 通过 in-process proxy.UserManager 接口热增用户。
904func xrayAddUser(ctx context.Context, instance *xrayCore.Instance, tag string, user *protocol.MemoryUser) error {
905 ihm, ok := instance.GetFeature(inbound.ManagerType()).(inbound.Manager)
906 if !ok {
907 return fmt.Errorf("AddUser: inbound manager not available")
908 }
909 handler, err := ihm.GetHandler(ctx, tag)
910 if err != nil {
911 return fmt.Errorf("AddUser: get handler %q: %w", tag, err)
912 }
913 gi, ok := handler.(proxy.GetInbound)
914 if !ok {
915 return fmt.Errorf("AddUser: handler %q does not support GetInbound", tag)
916 }
917 um, ok := gi.GetInbound().(proxy.UserManager)
918 if !ok {
919 return fmt.Errorf("AddUser: inbound %q does not support UserManager", tag)
920 }
921 return um.AddUser(ctx, user)
922}
923
924// xrayRemoveUser 通过 in-process proxy.UserManager 接口热删用户。
925func xrayRemoveUser(ctx context.Context, instance *xrayCore.Instance, tag, email string) error {

Callers 1

AddUserMethod · 0.85

Calls 2

GetInboundMethod · 0.65
AddUserMethod · 0.65

Tested by

no test coverage detected