添加代理与节点的注册与端口分配接口功能
This commit is contained in:
@@ -17,10 +17,8 @@ type Channel struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:通道ID" json:"id"` // 通道ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
ProxyID int32 `gorm:"column:proxy_id;not null;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||
NodeID int32 `gorm:"column:node_id;comment:节点ID" json:"node_id"` // 节点ID
|
||||
ProxyHost string `gorm:"column:proxy_host;not null;comment:代理地址" json:"proxy_host"` // 代理地址
|
||||
ProxyPort int32 `gorm:"column:proxy_port;not null;comment:转发端口" json:"proxy_port"` // 转发端口
|
||||
NodeHost string `gorm:"column:node_host;comment:节点地址" json:"node_host"` // 节点地址
|
||||
Protocol int32 `gorm:"column:protocol;comment:协议类型:1-http,2-https,3-socks5" json:"protocol"` // 协议类型:1-http,2-https,3-socks5
|
||||
AuthIP bool `gorm:"column:auth_ip;not null;comment:IP认证" json:"auth_ip"` // IP认证
|
||||
AuthPass bool `gorm:"column:auth_pass;not null;comment:密码认证" json:"auth_pass"` // 密码认证
|
||||
@@ -30,6 +28,8 @@ type Channel struct {
|
||||
CreatedAt orm.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt orm.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
EdgeHost string `gorm:"column:edge_host;comment:节点地址" json:"edge_host"` // 节点地址
|
||||
EdgeID int32 `gorm:"column:edge_id;comment:节点ID" json:"edge_id"` // 节点ID
|
||||
}
|
||||
|
||||
// TableName Channel's table name
|
||||
|
||||
@@ -10,12 +10,13 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameNode = "node"
|
||||
const TableNameEdge = "edge"
|
||||
|
||||
// Node mapped from table <node>
|
||||
type Node struct {
|
||||
// Edge mapped from table <edge>
|
||||
type Edge struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:节点ID" json:"id"` // 节点ID
|
||||
ProxyID int32 `gorm:"column:proxy_id;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||
Type int32 `gorm:"column:type;not null;comment:节点类型:1-自建" json:"type"` // 节点类型:1-自建
|
||||
Version int32 `gorm:"column:version;not null;comment:节点版本" json:"version"` // 节点版本
|
||||
Name string `gorm:"column:name;not null;comment:节点名称" json:"name"` // 节点名称
|
||||
Host string `gorm:"column:host;not null;comment:节点地址" json:"host"` // 节点地址
|
||||
@@ -24,14 +25,14 @@ type Node struct {
|
||||
City string `gorm:"column:city;not null;comment:城市" json:"city"` // 城市
|
||||
ProxyPort int32 `gorm:"column:proxy_port;comment:代理端口" json:"proxy_port"` // 代理端口
|
||||
Status int32 `gorm:"column:status;not null;comment:节点状态:0-离线,1-正常" json:"status"` // 节点状态:0-离线,1-正常
|
||||
Rtt int32 `gorm:"column:rtt;comment:延迟" json:"rtt"` // 延迟
|
||||
Loss int32 `gorm:"column:loss;comment:丢包率" json:"loss"` // 丢包率
|
||||
Rtt int32 `gorm:"column:rtt;comment:最近平均延迟" json:"rtt"` // 最近平均延迟
|
||||
Loss int32 `gorm:"column:loss;comment:最近丢包率" json:"loss"` // 最近丢包率
|
||||
CreatedAt orm.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt orm.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Node's table name
|
||||
func (*Node) TableName() string {
|
||||
return TableNameNode
|
||||
// TableName Edge's table name
|
||||
func (*Edge) TableName() string {
|
||||
return TableNameEdge
|
||||
}
|
||||
@@ -23,6 +23,7 @@ type Proxy struct {
|
||||
CreatedAt orm.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt orm.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Edges []Edge `gorm:"foreignKey:ProxyID;references:ID" json:"edges"`
|
||||
}
|
||||
|
||||
// TableName Proxy's table name
|
||||
|
||||
Reference in New Issue
Block a user