mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
42bb7bc90f
initial support for hysteria update config update api change user email format ...
35 lines
724 B
Go
35 lines
724 B
Go
package node
|
|
|
|
import (
|
|
"github.com/Yuzuki616/V2bX/api/panel"
|
|
"strconv"
|
|
)
|
|
|
|
func compareUserList(old, new []panel.UserInfo) (deleted, added []panel.UserInfo) {
|
|
tmp := map[string]struct{}{}
|
|
tmp2 := map[string]struct{}{}
|
|
for i := range old {
|
|
tmp[old[i].Uuid+strconv.Itoa(old[i].SpeedLimit)] = struct{}{}
|
|
}
|
|
l := len(tmp)
|
|
for i := range new {
|
|
e := new[i].Uuid + strconv.Itoa(new[i].SpeedLimit)
|
|
tmp[e] = struct{}{}
|
|
tmp2[e] = struct{}{}
|
|
if l != len(tmp) {
|
|
added = append(added, new[i])
|
|
l++
|
|
}
|
|
}
|
|
tmp = nil
|
|
l = len(tmp2)
|
|
for i := range old {
|
|
tmp2[old[i].Uuid+strconv.Itoa(old[i].SpeedLimit)] = struct{}{}
|
|
if l != len(tmp2) {
|
|
deleted = append(deleted, old[i])
|
|
l++
|
|
}
|
|
}
|
|
return deleted, added
|
|
}
|