mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-04-16 12:35:54 +00:00
fix: Ensure the required "cipher" field is present in the shadowsocks protocol
This commit is contained in:
parent
e718679f26
commit
aaabeeb33c
1 changed files with 13 additions and 0 deletions
|
|
@ -424,6 +424,19 @@ func (j *CheckClientIpJob) disconnectClientTemporarily(inbound *model.Inbound, c
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For Shadowsocks, ensure the required "cipher" field is present by
|
||||||
|
// reading it from the inbound settings (e.g., settings["method"]).
|
||||||
|
if string(inbound.Protocol) == "shadowsocks" {
|
||||||
|
var inboundSettings map[string]any
|
||||||
|
if err := json.Unmarshal([]byte(inbound.Settings), &inboundSettings); err != nil {
|
||||||
|
logger.Warningf("[LIMIT_IP] Failed to parse inbound settings for shadowsocks cipher: %v", err)
|
||||||
|
} else {
|
||||||
|
if method, ok := inboundSettings["method"].(string); ok && method != "" {
|
||||||
|
clientConfig["cipher"] = method
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove user to disconnect all connections
|
// Remove user to disconnect all connections
|
||||||
err = xrayAPI.RemoveUser(inbound.Tag, clientEmail)
|
err = xrayAPI.RemoveUser(inbound.Tag, clientEmail)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue