Add config profiles with inbound assignment for nodes.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -275,16 +275,57 @@ ORDER BY p.sort_order`, nodeID)
|
||||
"code": code, "installed": inst, "enabled": en, "port": port,
|
||||
})
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if installed == nil {
|
||||
installed = []string{}
|
||||
}
|
||||
if enabled == nil {
|
||||
enabled = []string{}
|
||||
}
|
||||
return map[string]any{
|
||||
"protocols": enabled, // backward-compatible health list
|
||||
|
||||
payload := map[string]any{
|
||||
"protocols": enabled,
|
||||
"protocols_installed": installed,
|
||||
"protocols_enabled": enabled,
|
||||
"protocol_items": items,
|
||||
}, rows.Err()
|
||||
}
|
||||
|
||||
n, err := GetNode(db, nodeID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n != nil && n.ProfileID != nil {
|
||||
payload["profile"] = map[string]any{
|
||||
"id": n.ProfileID.String(),
|
||||
"name": n.ProfileName,
|
||||
}
|
||||
inbounds, err := ListNodeInbounds(db, nodeID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var inList []map[string]any
|
||||
for _, in := range inbounds {
|
||||
if !in.NodeEnabled || !in.Enabled {
|
||||
continue
|
||||
}
|
||||
inList = append(inList, map[string]any{
|
||||
"id": in.ID.String(),
|
||||
"tag": in.Tag,
|
||||
"protocol": in.ProtocolCode,
|
||||
"port": in.Port,
|
||||
"network": in.Network,
|
||||
"security": in.Security,
|
||||
"listen": in.Listen,
|
||||
"remark": in.Remark,
|
||||
})
|
||||
}
|
||||
if inList == nil {
|
||||
inList = []map[string]any{}
|
||||
}
|
||||
payload["inbounds"] = inList
|
||||
}
|
||||
|
||||
return payload, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user