Add config profiles with inbound assignment for nodes.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -79,6 +79,8 @@ type Node struct {
|
||||
SSHSecretEnc string `json:"-"`
|
||||
NodePort int `json:"node_port"`
|
||||
SecretKey string `json:"-"`
|
||||
ProfileID *uuid.UUID `json:"profile_id,omitempty"`
|
||||
ProfileName string `json:"profile_name,omitempty"`
|
||||
Status NodeStatus `json:"status"`
|
||||
InstallMode string `json:"install_mode"` // auto | manual
|
||||
LastError string `json:"last_error"`
|
||||
@@ -105,10 +107,51 @@ func (n Node) StatusLabel() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (n Node) ProfileIDString() string {
|
||||
if n.ProfileID == nil {
|
||||
return ""
|
||||
}
|
||||
return n.ProfileID.String()
|
||||
}
|
||||
|
||||
type ConfigProfile struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
InboundCount int `json:"inbound_count"`
|
||||
NodeCount int `json:"node_count"`
|
||||
Inbounds []Inbound `json:"inbounds,omitempty"`
|
||||
}
|
||||
|
||||
type Inbound struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ProfileID uuid.UUID `json:"profile_id"`
|
||||
Tag string `json:"tag"`
|
||||
ProtocolID uuid.UUID `json:"protocol_id"`
|
||||
ProtocolCode string `json:"protocol_code"`
|
||||
ProtocolName string `json:"protocol_name"`
|
||||
Port int `json:"port"`
|
||||
Network string `json:"network"` // tcp, ws, grpc, quic, udp
|
||||
Security string `json:"security"` // none, tls, reality
|
||||
Listen string `json:"listen"`
|
||||
Enabled bool `json:"enabled"` // definition enabled in profile
|
||||
SortOrder int `json:"sort_order"`
|
||||
Remark string `json:"remark"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
// Per-node activation when listed under a node
|
||||
NodeEnabled bool `json:"node_enabled,omitempty"`
|
||||
}
|
||||
|
||||
type DashboardStats struct {
|
||||
ProtocolsTotal int
|
||||
ProtocolsEnabled int
|
||||
AdminsTotal int
|
||||
NodesTotal int
|
||||
NodesOnline int
|
||||
ProfilesTotal int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user