重构白银节点分配方式,使用手动接口精确配置节点

This commit is contained in:
2025-12-08 14:22:30 +08:00
parent 9e237be21e
commit 983dbb4564
25 changed files with 651 additions and 630 deletions

View File

@@ -33,10 +33,12 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel {
_channel.DeletedAt = field.NewField(tableName, "deleted_at")
_channel.UserID = field.NewInt32(tableName, "user_id")
_channel.ResourceID = field.NewInt32(tableName, "resource_id")
_channel.ProxyID = field.NewInt32(tableName, "proxy_id")
_channel.BatchNo = field.NewString(tableName, "batch_no")
_channel.ProxyID = field.NewInt32(tableName, "proxy_id")
_channel.Host = field.NewString(tableName, "host")
_channel.Port = field.NewUint16(tableName, "port")
_channel.EdgeID = field.NewInt32(tableName, "edge_id")
_channel.EdgeRef = field.NewString(tableName, "edge_ref")
_channel.FilterISP = field.NewInt(tableName, "filter_isp")
_channel.FilterProv = field.NewString(tableName, "filter_prov")
_channel.FilterCity = field.NewString(tableName, "filter_city")
@@ -141,10 +143,12 @@ type channel struct {
DeletedAt field.Field
UserID field.Int32
ResourceID field.Int32
ProxyID field.Int32
BatchNo field.String
ProxyID field.Int32
Host field.String
Port field.Uint16
EdgeID field.Int32
EdgeRef field.String
FilterISP field.Int
FilterProv field.String
FilterCity field.String
@@ -182,10 +186,12 @@ func (c *channel) updateTableName(table string) *channel {
c.DeletedAt = field.NewField(table, "deleted_at")
c.UserID = field.NewInt32(table, "user_id")
c.ResourceID = field.NewInt32(table, "resource_id")
c.ProxyID = field.NewInt32(table, "proxy_id")
c.BatchNo = field.NewString(table, "batch_no")
c.ProxyID = field.NewInt32(table, "proxy_id")
c.Host = field.NewString(table, "host")
c.Port = field.NewUint16(table, "port")
c.EdgeID = field.NewInt32(table, "edge_id")
c.EdgeRef = field.NewString(table, "edge_ref")
c.FilterISP = field.NewInt(table, "filter_isp")
c.FilterProv = field.NewString(table, "filter_prov")
c.FilterCity = field.NewString(table, "filter_city")
@@ -210,17 +216,19 @@ func (c *channel) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
}
func (c *channel) fillFieldMap() {
c.fieldMap = make(map[string]field.Expr, 22)
c.fieldMap = make(map[string]field.Expr, 24)
c.fieldMap["id"] = c.ID
c.fieldMap["created_at"] = c.CreatedAt
c.fieldMap["updated_at"] = c.UpdatedAt
c.fieldMap["deleted_at"] = c.DeletedAt
c.fieldMap["user_id"] = c.UserID
c.fieldMap["resource_id"] = c.ResourceID
c.fieldMap["proxy_id"] = c.ProxyID
c.fieldMap["batch_no"] = c.BatchNo
c.fieldMap["proxy_id"] = c.ProxyID
c.fieldMap["host"] = c.Host
c.fieldMap["port"] = c.Port
c.fieldMap["edge_id"] = c.EdgeID
c.fieldMap["edge_ref"] = c.EdgeRef
c.fieldMap["filter_isp"] = c.FilterISP
c.fieldMap["filter_prov"] = c.FilterProv
c.fieldMap["filter_city"] = c.FilterCity

View File

@@ -34,6 +34,7 @@ func newProxy(db *gorm.DB, opts ...gen.DOOption) proxy {
_proxy.Version = field.NewInt32(tableName, "version")
_proxy.Mac = field.NewString(tableName, "mac")
_proxy.IP = field.NewField(tableName, "ip")
_proxy.Host = field.NewString(tableName, "host")
_proxy.Secret = field.NewString(tableName, "secret")
_proxy.Type = field.NewInt(tableName, "type")
_proxy.Status = field.NewInt(tableName, "status")
@@ -120,6 +121,7 @@ type proxy struct {
Version field.Int32
Mac field.String
IP field.Field
Host field.String
Secret field.String
Type field.Int
Status field.Int
@@ -148,6 +150,7 @@ func (p *proxy) updateTableName(table string) *proxy {
p.Version = field.NewInt32(table, "version")
p.Mac = field.NewString(table, "mac")
p.IP = field.NewField(table, "ip")
p.Host = field.NewString(table, "host")
p.Secret = field.NewString(table, "secret")
p.Type = field.NewInt(table, "type")
p.Status = field.NewInt(table, "status")
@@ -168,7 +171,7 @@ func (p *proxy) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
}
func (p *proxy) fillFieldMap() {
p.fieldMap = make(map[string]field.Expr, 12)
p.fieldMap = make(map[string]field.Expr, 13)
p.fieldMap["id"] = p.ID
p.fieldMap["created_at"] = p.CreatedAt
p.fieldMap["updated_at"] = p.UpdatedAt
@@ -176,6 +179,7 @@ func (p *proxy) fillFieldMap() {
p.fieldMap["version"] = p.Version
p.fieldMap["mac"] = p.Mac
p.fieldMap["ip"] = p.IP
p.fieldMap["host"] = p.Host
p.fieldMap["secret"] = p.Secret
p.fieldMap["type"] = p.Type
p.fieldMap["status"] = p.Status