|
|
@@ -637,6 +637,11 @@ func (x *XrayAPI) AddUser(Protocol string, inboundTag string, user map[string]an
|
|
|
|
|
|
// RemoveUser removes a user from an inbound in the Xray core by email.
|
|
|
func (x *XrayAPI) RemoveUser(inboundTag, email string) error {
|
|
|
+ if x.HandlerServiceClient == nil {
|
|
|
+ return common.NewError("xray HandlerServiceClient is not initialized")
|
|
|
+ }
|
|
|
+ client := *x.HandlerServiceClient
|
|
|
+
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
|
defer cancel()
|
|
|
|
|
|
@@ -646,7 +651,7 @@ func (x *XrayAPI) RemoveUser(inboundTag, email string) error {
|
|
|
Operation: serial.ToTypedMessage(op),
|
|
|
}
|
|
|
|
|
|
- _, err := (*x.HandlerServiceClient).AlterInbound(ctx, req)
|
|
|
+ _, err := client.AlterInbound(ctx, req)
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("failed to remove user: %w", err)
|
|
|
}
|