refactor: optimize user management, fix speed limit hot-reload and improve performance

This commit is contained in:
xboard
2026-03-16 06:55:42 +08:00
parent 08795d2e04
commit 0975b45404
7 changed files with 1115 additions and 326 deletions
+26
View File
@@ -411,3 +411,29 @@ func TestBuildConfig_Shadowsocks_MultiUser(t *testing.T) {
t.Fatalf("expected 2 clients, got %d", len(clients))
}
}
func TestBuildConfig_SocksStats(t *testing.T) {
nc := panel.NodeConfig{
Protocol: "socks",
ServerPort: 1080,
}
cfg := buildConfig(testKernelCfg, &nc, testUsers, "", "")
data, _ := json.Marshal(cfg)
var parsed map[string]interface{}
json.Unmarshal(data, &parsed)
inbounds := parsed["inbounds"].([]interface{})
ib := inbounds[0].(map[string]interface{})
settings := ib["settings"].(map[string]interface{})
accounts := settings["accounts"].([]interface{})
if len(accounts) == 0 {
t.Fatal("no accounts in socks config")
}
a1 := accounts[0].(map[string]interface{})
if a1["email"] != "user@1" {
t.Errorf("expected email user@1 for socks account, got %v", a1["email"])
}
}