improve client's inbound changes

This commit is contained in:
Alireza Ahmadi
2025-07-13 12:29:21 +02:00
parent f239574e41
commit d2827d013b
12 changed files with 848 additions and 21 deletions
+22
View File
@@ -0,0 +1,22 @@
package hysteria2
import (
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/option"
)
func (h *Inbound) UpdateUsers(users []option.Hysteria2User) error {
h.Close()
userList := make([]int, 0, len(users))
userNameList := make([]string, 0, len(users))
userPasswordList := make([]string, 0, len(users))
for index, user := range users {
userList = append(userList, index)
userNameList = append(userNameList, user.Name)
userPasswordList = append(userPasswordList, user.Password)
}
h.service.UpdateUsers(userList, userPasswordList)
h.userNameList = userNameList
h.Start(adapter.StartStateStart)
return nil
}