mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	字段中的blob和JSON类型映射为[]byte和dbs.JSON
This commit is contained in:
		
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							@@ -12,7 +12,7 @@ require (
 | 
				
			|||||||
	github.com/go-acme/lego/v4 v4.5.2
 | 
						github.com/go-acme/lego/v4 v4.5.2
 | 
				
			||||||
	github.com/go-sql-driver/mysql v1.5.0
 | 
						github.com/go-sql-driver/mysql v1.5.0
 | 
				
			||||||
	github.com/golang/protobuf v1.5.2
 | 
						github.com/golang/protobuf v1.5.2
 | 
				
			||||||
	github.com/iwind/TeaGo v0.0.0-20220321112016-5a2cd71d3151 // indirect
 | 
						github.com/iwind/TeaGo v0.0.0-20220321132348-7da816422f25 // indirect
 | 
				
			||||||
	github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3
 | 
						github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3
 | 
				
			||||||
	github.com/json-iterator/go v1.1.12 // indirect
 | 
						github.com/json-iterator/go v1.1.12 // indirect
 | 
				
			||||||
	github.com/mozillazg/go-pinyin v0.18.0
 | 
						github.com/mozillazg/go-pinyin v0.18.0
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							@@ -240,6 +240,10 @@ github.com/iwind/TeaGo v0.0.0-20210411134150-ddf57e240c2f/go.mod h1:KU4mS7QNiZ7Q
 | 
				
			|||||||
github.com/iwind/TeaGo v0.0.0-20220304043459-0dd944a5b475/go.mod h1:HRHK0zoC/og3c9/hKosD9yYVMTnnzm3PgXUdhRYHaLc=
 | 
					github.com/iwind/TeaGo v0.0.0-20220304043459-0dd944a5b475/go.mod h1:HRHK0zoC/og3c9/hKosD9yYVMTnnzm3PgXUdhRYHaLc=
 | 
				
			||||||
github.com/iwind/TeaGo v0.0.0-20220321112016-5a2cd71d3151 h1:jksmjwlGC8QMpyHZmzxr7J+3NeMOr9Zy2+yNJxVSIjI=
 | 
					github.com/iwind/TeaGo v0.0.0-20220321112016-5a2cd71d3151 h1:jksmjwlGC8QMpyHZmzxr7J+3NeMOr9Zy2+yNJxVSIjI=
 | 
				
			||||||
github.com/iwind/TeaGo v0.0.0-20220321112016-5a2cd71d3151/go.mod h1:HRHK0zoC/og3c9/hKosD9yYVMTnnzm3PgXUdhRYHaLc=
 | 
					github.com/iwind/TeaGo v0.0.0-20220321112016-5a2cd71d3151/go.mod h1:HRHK0zoC/og3c9/hKosD9yYVMTnnzm3PgXUdhRYHaLc=
 | 
				
			||||||
 | 
					github.com/iwind/TeaGo v0.0.0-20220321131553-fd7b112ba7e7 h1:gdMQZQk/aXfNuKuWCBQhP3byy5Dr8XHMe5+GXdGHcPQ=
 | 
				
			||||||
 | 
					github.com/iwind/TeaGo v0.0.0-20220321131553-fd7b112ba7e7/go.mod h1:HRHK0zoC/og3c9/hKosD9yYVMTnnzm3PgXUdhRYHaLc=
 | 
				
			||||||
 | 
					github.com/iwind/TeaGo v0.0.0-20220321132348-7da816422f25 h1:UpJ52iq8FEz2OeaXFhW1kuYeqVRUQ/5N+NVHvVuTnvw=
 | 
				
			||||||
 | 
					github.com/iwind/TeaGo v0.0.0-20220321132348-7da816422f25/go.mod h1:HRHK0zoC/og3c9/hKosD9yYVMTnnzm3PgXUdhRYHaLc=
 | 
				
			||||||
github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3 h1:aBSonas7vFcgTj9u96/bWGILGv1ZbUSTLiOzcI1ZT6c=
 | 
					github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3 h1:aBSonas7vFcgTj9u96/bWGILGv1ZbUSTLiOzcI1ZT6c=
 | 
				
			||||||
github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3/go.mod h1:H5Q7SXwbx3a97ecJkaS2sD77gspzE7HFUafBO0peEyA=
 | 
					github.com/iwind/gosock v0.0.0-20210722083328-12b2d66abec3/go.mod h1:H5Q7SXwbx3a97ecJkaS2sD77gspzE7HFUafBO0peEyA=
 | 
				
			||||||
github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
 | 
					github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,21 @@
 | 
				
			|||||||
package accounts
 | 
					package accounts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// UserAccountLog 用户账户日志
 | 
					// UserAccountLog 用户账户日志
 | 
				
			||||||
type UserAccountLog struct {
 | 
					type UserAccountLog struct {
 | 
				
			||||||
	Id          uint64  `field:"id"`          // ID
 | 
						Id          uint64   `field:"id"`          // ID
 | 
				
			||||||
	UserId      uint64  `field:"userId"`      // 用户ID
 | 
						UserId      uint64   `field:"userId"`      // 用户ID
 | 
				
			||||||
	AccountId   uint64  `field:"accountId"`   // 账户ID
 | 
						AccountId   uint64   `field:"accountId"`   // 账户ID
 | 
				
			||||||
	Delta       float64 `field:"delta"`       // 操作余额的数量(可为负)
 | 
						Delta       float64  `field:"delta"`       // 操作余额的数量(可为负)
 | 
				
			||||||
	DeltaFrozen float64 `field:"deltaFrozen"` // 操作冻结的数量(可为负)
 | 
						DeltaFrozen float64  `field:"deltaFrozen"` // 操作冻结的数量(可为负)
 | 
				
			||||||
	Total       float64 `field:"total"`       // 操作后余额
 | 
						Total       float64  `field:"total"`       // 操作后余额
 | 
				
			||||||
	TotalFrozen float64 `field:"totalFrozen"` // 操作后冻结余额
 | 
						TotalFrozen float64  `field:"totalFrozen"` // 操作后冻结余额
 | 
				
			||||||
	EventType   string  `field:"eventType"`   // 类型
 | 
						EventType   string   `field:"eventType"`   // 类型
 | 
				
			||||||
	Description string  `field:"description"` // 描述文字
 | 
						Description string   `field:"description"` // 描述文字
 | 
				
			||||||
	Day         string  `field:"day"`         // YYYYMMDD
 | 
						Day         string   `field:"day"`         // YYYYMMDD
 | 
				
			||||||
	CreatedAt   uint64  `field:"createdAt"`   // 时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 时间
 | 
				
			||||||
	Params      string  `field:"params"`      // 参数
 | 
						Params      dbs.JSON `field:"params"`      // 参数
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type UserAccountLogOperator struct {
 | 
					type UserAccountLogOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,23 @@
 | 
				
			|||||||
package acme
 | 
					package acme
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ACMETask ACME任务
 | 
					// ACMETask ACME任务
 | 
				
			||||||
type ACMETask struct {
 | 
					type ACMETask struct {
 | 
				
			||||||
	Id            uint64 `field:"id"`            // ID
 | 
						Id            uint64   `field:"id"`            // ID
 | 
				
			||||||
	AdminId       uint32 `field:"adminId"`       // 管理员ID
 | 
						AdminId       uint32   `field:"adminId"`       // 管理员ID
 | 
				
			||||||
	UserId        uint32 `field:"userId"`        // 用户ID
 | 
						UserId        uint32   `field:"userId"`        // 用户ID
 | 
				
			||||||
	IsOn          uint8  `field:"isOn"`          // 是否启用
 | 
						IsOn          uint8    `field:"isOn"`          // 是否启用
 | 
				
			||||||
	AcmeUserId    uint32 `field:"acmeUserId"`    // ACME用户ID
 | 
						AcmeUserId    uint32   `field:"acmeUserId"`    // ACME用户ID
 | 
				
			||||||
	DnsDomain     string `field:"dnsDomain"`     // DNS主域名
 | 
						DnsDomain     string   `field:"dnsDomain"`     // DNS主域名
 | 
				
			||||||
	DnsProviderId uint64 `field:"dnsProviderId"` // DNS服务商
 | 
						DnsProviderId uint64   `field:"dnsProviderId"` // DNS服务商
 | 
				
			||||||
	Domains       string `field:"domains"`       // 证书域名
 | 
						Domains       dbs.JSON `field:"domains"`       // 证书域名
 | 
				
			||||||
	CreatedAt     uint64 `field:"createdAt"`     // 创建时间
 | 
						CreatedAt     uint64   `field:"createdAt"`     // 创建时间
 | 
				
			||||||
	State         uint8  `field:"state"`         // 状态
 | 
						State         uint8    `field:"state"`         // 状态
 | 
				
			||||||
	CertId        uint64 `field:"certId"`        // 生成的证书ID
 | 
						CertId        uint64   `field:"certId"`        // 生成的证书ID
 | 
				
			||||||
	AutoRenew     uint8  `field:"autoRenew"`     // 是否自动更新
 | 
						AutoRenew     uint8    `field:"autoRenew"`     // 是否自动更新
 | 
				
			||||||
	AuthType      string `field:"authType"`      // 认证类型
 | 
						AuthType      string   `field:"authType"`      // 认证类型
 | 
				
			||||||
	AuthURL       string `field:"authURL"`       // 认证URL
 | 
						AuthURL       string   `field:"authURL"`       // 认证URL
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ACMETaskOperator struct {
 | 
					type ACMETaskOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,13 +5,13 @@ import (
 | 
				
			|||||||
	"github.com/iwind/TeaGo/logs"
 | 
						"github.com/iwind/TeaGo/logs"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 将域名解析成字符串数组
 | 
					// DecodeDomains 将域名解析成字符串数组
 | 
				
			||||||
func (this *ACMETask) DecodeDomains() []string {
 | 
					func (this *ACMETask) DecodeDomains() []string {
 | 
				
			||||||
	if len(this.Domains) == 0 || this.Domains == "null" {
 | 
						if len(this.Domains) == 0 {
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	result := []string{}
 | 
						result := []string{}
 | 
				
			||||||
	err := json.Unmarshal([]byte(this.Domains), &result)
 | 
						err := json.Unmarshal(this.Domains, &result)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		logs.Error(err)
 | 
							logs.Error(err)
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,18 +1,20 @@
 | 
				
			|||||||
package acme
 | 
					package acme
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ACMEUser ACME用户
 | 
					// ACMEUser ACME用户
 | 
				
			||||||
type ACMEUser struct {
 | 
					type ACMEUser struct {
 | 
				
			||||||
	Id           uint64 `field:"id"`           // ID
 | 
						Id           uint64   `field:"id"`           // ID
 | 
				
			||||||
	AdminId      uint32 `field:"adminId"`      // 管理员ID
 | 
						AdminId      uint32   `field:"adminId"`      // 管理员ID
 | 
				
			||||||
	UserId       uint32 `field:"userId"`       // 用户ID
 | 
						UserId       uint32   `field:"userId"`       // 用户ID
 | 
				
			||||||
	PrivateKey   string `field:"privateKey"`   // 私钥
 | 
						PrivateKey   string   `field:"privateKey"`   // 私钥
 | 
				
			||||||
	Email        string `field:"email"`        // E-mail
 | 
						Email        string   `field:"email"`        // E-mail
 | 
				
			||||||
	CreatedAt    uint64 `field:"createdAt"`    // 创建时间
 | 
						CreatedAt    uint64   `field:"createdAt"`    // 创建时间
 | 
				
			||||||
	State        uint8  `field:"state"`        // 状态
 | 
						State        uint8    `field:"state"`        // 状态
 | 
				
			||||||
	Description  string `field:"description"`  // 备注介绍
 | 
						Description  string   `field:"description"`  // 备注介绍
 | 
				
			||||||
	Registration string `field:"registration"` // 注册信息
 | 
						Registration dbs.JSON `field:"registration"` // 注册信息
 | 
				
			||||||
	ProviderCode string `field:"providerCode"` // 服务商代号
 | 
						ProviderCode string   `field:"providerCode"` // 服务商代号
 | 
				
			||||||
	AccountId    uint64 `field:"accountId"`    // 提供商ID
 | 
						AccountId    uint64   `field:"accountId"`    // 提供商ID
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ACMEUserOperator struct {
 | 
					type ACMEUserOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,21 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Admin 管理员
 | 
					// Admin 管理员
 | 
				
			||||||
type Admin struct {
 | 
					type Admin struct {
 | 
				
			||||||
	Id        uint32 `field:"id"`        // ID
 | 
						Id        uint32   `field:"id"`        // ID
 | 
				
			||||||
	IsOn      uint8  `field:"isOn"`      // 是否启用
 | 
						IsOn      uint8    `field:"isOn"`      // 是否启用
 | 
				
			||||||
	Username  string `field:"username"`  // 用户名
 | 
						Username  string   `field:"username"`  // 用户名
 | 
				
			||||||
	Password  string `field:"password"`  // 密码
 | 
						Password  string   `field:"password"`  // 密码
 | 
				
			||||||
	Fullname  string `field:"fullname"`  // 全名
 | 
						Fullname  string   `field:"fullname"`  // 全名
 | 
				
			||||||
	IsSuper   uint8  `field:"isSuper"`   // 是否为超级管理员
 | 
						IsSuper   uint8    `field:"isSuper"`   // 是否为超级管理员
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
	UpdatedAt uint64 `field:"updatedAt"` // 修改时间
 | 
						UpdatedAt uint64   `field:"updatedAt"` // 修改时间
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
	Modules   string `field:"modules"`   // 允许的模块
 | 
						Modules   dbs.JSON `field:"modules"`   // 允许的模块
 | 
				
			||||||
	CanLogin  uint8  `field:"canLogin"`  // 是否可以登录
 | 
						CanLogin  uint8    `field:"canLogin"`  // 是否可以登录
 | 
				
			||||||
	Theme     string `field:"theme"`     // 模板设置
 | 
						Theme     string   `field:"theme"`     // 模板设置
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type AdminOperator struct {
 | 
					type AdminOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,26 +1,28 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// API节点
 | 
					// API节点
 | 
				
			||||||
type APINode struct {
 | 
					type APINode struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	ClusterId   uint32 `field:"clusterId"`   // 专用集群ID
 | 
						ClusterId   uint32   `field:"clusterId"`   // 专用集群ID
 | 
				
			||||||
	UniqueId    string `field:"uniqueId"`    // 唯一ID
 | 
						UniqueId    string   `field:"uniqueId"`    // 唯一ID
 | 
				
			||||||
	Secret      string `field:"secret"`      // 密钥
 | 
						Secret      string   `field:"secret"`      // 密钥
 | 
				
			||||||
	Name        string `field:"name"`        // 名称
 | 
						Name        string   `field:"name"`        // 名称
 | 
				
			||||||
	Description string `field:"description"` // 描述
 | 
						Description string   `field:"description"` // 描述
 | 
				
			||||||
	Http        string `field:"http"`        // 监听的HTTP配置
 | 
						Http        dbs.JSON `field:"http"`        // 监听的HTTP配置
 | 
				
			||||||
	Https       string `field:"https"`       // 监听的HTTPS配置
 | 
						Https       dbs.JSON `field:"https"`       // 监听的HTTPS配置
 | 
				
			||||||
	RestIsOn    uint8  `field:"restIsOn"`    // 是否开放REST
 | 
						RestIsOn    uint8    `field:"restIsOn"`    // 是否开放REST
 | 
				
			||||||
	RestHTTP    string `field:"restHTTP"`    // REST HTTP配置
 | 
						RestHTTP    dbs.JSON `field:"restHTTP"`    // REST HTTP配置
 | 
				
			||||||
	RestHTTPS   string `field:"restHTTPS"`   // REST HTTPS配置
 | 
						RestHTTPS   dbs.JSON `field:"restHTTPS"`   // REST HTTPS配置
 | 
				
			||||||
	AccessAddrs string `field:"accessAddrs"` // 外部访问地址
 | 
						AccessAddrs dbs.JSON `field:"accessAddrs"` // 外部访问地址
 | 
				
			||||||
	Order       uint32 `field:"order"`       // 排序
 | 
						Order       uint32   `field:"order"`       // 排序
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	AdminId     uint32 `field:"adminId"`     // 管理员ID
 | 
						AdminId     uint32   `field:"adminId"`     // 管理员ID
 | 
				
			||||||
	Weight      uint32 `field:"weight"`      // 权重
 | 
						Weight      uint32   `field:"weight"`      // 权重
 | 
				
			||||||
	Status      string `field:"status"`      // 运行状态
 | 
						Status      dbs.JSON `field:"status"`      // 运行状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type APINodeOperator struct {
 | 
					type APINodeOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,17 @@
 | 
				
			|||||||
package authority
 | 
					package authority
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// AuthorityKey 企业版认证信息
 | 
					// AuthorityKey 企业版认证信息
 | 
				
			||||||
type AuthorityKey struct {
 | 
					type AuthorityKey struct {
 | 
				
			||||||
	Id           uint32 `field:"id"`           // ID
 | 
						Id           uint32   `field:"id"`           // ID
 | 
				
			||||||
	Value        string `field:"value"`        // Key值
 | 
						Value        string   `field:"value"`        // Key值
 | 
				
			||||||
	DayFrom      string `field:"dayFrom"`      // 开始日期
 | 
						DayFrom      string   `field:"dayFrom"`      // 开始日期
 | 
				
			||||||
	DayTo        string `field:"dayTo"`        // 结束日期
 | 
						DayTo        string   `field:"dayTo"`        // 结束日期
 | 
				
			||||||
	Hostname     string `field:"hostname"`     // Hostname
 | 
						Hostname     string   `field:"hostname"`     // Hostname
 | 
				
			||||||
	MacAddresses string `field:"macAddresses"` // MAC地址
 | 
						MacAddresses dbs.JSON `field:"macAddresses"` // MAC地址
 | 
				
			||||||
	UpdatedAt    uint64 `field:"updatedAt"`    // 创建/修改时间
 | 
						UpdatedAt    uint64   `field:"updatedAt"`    // 创建/修改时间
 | 
				
			||||||
	Company      string `field:"company"`      // 公司组织
 | 
						Company      string   `field:"company"`      // 公司组织
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type AuthorityKeyOperator struct {
 | 
					type AuthorityKeyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,21 @@
 | 
				
			|||||||
package authority
 | 
					package authority
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// AuthorityNode 监控节点
 | 
					// AuthorityNode 监控节点
 | 
				
			||||||
type AuthorityNode struct {
 | 
					type AuthorityNode struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	UniqueId    string `field:"uniqueId"`    // 唯一ID
 | 
						UniqueId    string   `field:"uniqueId"`    // 唯一ID
 | 
				
			||||||
	Secret      string `field:"secret"`      // 密钥
 | 
						Secret      string   `field:"secret"`      // 密钥
 | 
				
			||||||
	Name        string `field:"name"`        // 名称
 | 
						Name        string   `field:"name"`        // 名称
 | 
				
			||||||
	Description string `field:"description"` // 描述
 | 
						Description string   `field:"description"` // 描述
 | 
				
			||||||
	Order       uint32 `field:"order"`       // 排序
 | 
						Order       uint32   `field:"order"`       // 排序
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	AdminId     uint32 `field:"adminId"`     // 管理员ID
 | 
						AdminId     uint32   `field:"adminId"`     // 管理员ID
 | 
				
			||||||
	Weight      uint32 `field:"weight"`      // 权重
 | 
						Weight      uint32   `field:"weight"`      // 权重
 | 
				
			||||||
	Status      string `field:"status"`      // 运行状态
 | 
						Status      dbs.JSON `field:"status"`      // 运行状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type AuthorityNodeOperator struct {
 | 
					type AuthorityNodeOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,13 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 终端浏览器信息
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ClientBrowser 终端浏览器信息
 | 
				
			||||||
type ClientBrowser struct {
 | 
					type ClientBrowser struct {
 | 
				
			||||||
	Id    uint32 `field:"id"`    // ID
 | 
						Id    uint32   `field:"id"`    // ID
 | 
				
			||||||
	Name  string `field:"name"`  // 浏览器名称
 | 
						Name  string   `field:"name"`  // 浏览器名称
 | 
				
			||||||
	Codes string `field:"codes"` // 代号
 | 
						Codes dbs.JSON `field:"codes"` // 代号
 | 
				
			||||||
	State uint8  `field:"state"` // 状态
 | 
						State uint8    `field:"state"` // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ClientBrowserOperator struct {
 | 
					type ClientBrowserOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,13 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 终端操作系统信息
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ClientSystem 终端操作系统信息
 | 
				
			||||||
type ClientSystem struct {
 | 
					type ClientSystem struct {
 | 
				
			||||||
	Id    uint32 `field:"id"`    // ID
 | 
						Id    uint32   `field:"id"`    // ID
 | 
				
			||||||
	Name  string `field:"name"`  // 系统名称
 | 
						Name  string   `field:"name"`  // 系统名称
 | 
				
			||||||
	Codes string `field:"codes"` // 代号
 | 
						Codes dbs.JSON `field:"codes"` // 代号
 | 
				
			||||||
	State uint8  `field:"state"` //
 | 
						State uint8    `field:"state"` //
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ClientSystemOperator struct {
 | 
					type ClientSystemOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,22 +1,24 @@
 | 
				
			|||||||
package dns
 | 
					package dns
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// DNSDomain 管理的域名
 | 
					// DNSDomain 管理的域名
 | 
				
			||||||
type DNSDomain struct {
 | 
					type DNSDomain struct {
 | 
				
			||||||
	Id            uint32 `field:"id"`            // ID
 | 
						Id            uint32   `field:"id"`            // ID
 | 
				
			||||||
	AdminId       uint32 `field:"adminId"`       // 管理员ID
 | 
						AdminId       uint32   `field:"adminId"`       // 管理员ID
 | 
				
			||||||
	UserId        uint32 `field:"userId"`        // 用户ID
 | 
						UserId        uint32   `field:"userId"`        // 用户ID
 | 
				
			||||||
	ProviderId    uint32 `field:"providerId"`    // 服务商ID
 | 
						ProviderId    uint32   `field:"providerId"`    // 服务商ID
 | 
				
			||||||
	IsOn          uint8  `field:"isOn"`          // 是否可用
 | 
						IsOn          uint8    `field:"isOn"`          // 是否可用
 | 
				
			||||||
	Name          string `field:"name"`          // 域名
 | 
						Name          string   `field:"name"`          // 域名
 | 
				
			||||||
	CreatedAt     uint64 `field:"createdAt"`     // 创建时间
 | 
						CreatedAt     uint64   `field:"createdAt"`     // 创建时间
 | 
				
			||||||
	DataUpdatedAt uint64 `field:"dataUpdatedAt"` // 数据更新时间
 | 
						DataUpdatedAt uint64   `field:"dataUpdatedAt"` // 数据更新时间
 | 
				
			||||||
	DataError     string `field:"dataError"`     // 数据更新错误
 | 
						DataError     string   `field:"dataError"`     // 数据更新错误
 | 
				
			||||||
	Data          string `field:"data"`          // 原始数据信息
 | 
						Data          string   `field:"data"`          // 原始数据信息
 | 
				
			||||||
	Records       string `field:"records"`       // 所有解析记录
 | 
						Records       dbs.JSON `field:"records"`       // 所有解析记录
 | 
				
			||||||
	Routes        string `field:"routes"`        // 线路数据
 | 
						Routes        dbs.JSON `field:"routes"`        // 线路数据
 | 
				
			||||||
	IsUp          uint8  `field:"isUp"`          // 是否在线
 | 
						IsUp          uint8    `field:"isUp"`          // 是否在线
 | 
				
			||||||
	State         uint8  `field:"state"`         // 状态
 | 
						State         uint8    `field:"state"`         // 状态
 | 
				
			||||||
	IsDeleted     uint8  `field:"isDeleted"`     // 是否已删除
 | 
						IsDeleted     uint8    `field:"isDeleted"`     // 是否已删除
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type DNSDomainOperator struct {
 | 
					type DNSDomainOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,11 +7,11 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeRoutes 获取所有的线路
 | 
					// DecodeRoutes 获取所有的线路
 | 
				
			||||||
func (this *DNSDomain) DecodeRoutes() ([]*dnstypes.Route, error) {
 | 
					func (this *DNSDomain) DecodeRoutes() ([]*dnstypes.Route, error) {
 | 
				
			||||||
	if len(this.Routes) == 0 || this.Routes == "null" {
 | 
						if len(this.Routes) == 0 {
 | 
				
			||||||
		return nil, nil
 | 
							return nil, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	result := []*dnstypes.Route{}
 | 
						result := []*dnstypes.Route{}
 | 
				
			||||||
	err := json.Unmarshal([]byte(this.Routes), &result)
 | 
						err := json.Unmarshal(this.Routes, &result)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -35,7 +35,7 @@ func (this *DNSDomain) ContainsRouteCode(route string) (bool, error) {
 | 
				
			|||||||
// DecodeRecords 获取所有的记录
 | 
					// DecodeRecords 获取所有的记录
 | 
				
			||||||
func (this *DNSDomain) DecodeRecords() ([]*dnstypes.Record, error) {
 | 
					func (this *DNSDomain) DecodeRecords() ([]*dnstypes.Record, error) {
 | 
				
			||||||
	records := this.Records
 | 
						records := this.Records
 | 
				
			||||||
	if len(records) == 0 || records == "null" {
 | 
						if len(records) == 0 {
 | 
				
			||||||
		return nil, nil
 | 
							return nil, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	result := []*dnstypes.Record{}
 | 
						result := []*dnstypes.Record{}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,18 @@
 | 
				
			|||||||
package dns
 | 
					package dns
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// DNS服务商
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// DNSProvider DNS服务商
 | 
				
			||||||
type DNSProvider struct {
 | 
					type DNSProvider struct {
 | 
				
			||||||
	Id            uint32 `field:"id"`            // ID
 | 
						Id            uint32   `field:"id"`            // ID
 | 
				
			||||||
	Name          string `field:"name"`          // 名称
 | 
						Name          string   `field:"name"`          // 名称
 | 
				
			||||||
	AdminId       uint32 `field:"adminId"`       // 管理员ID
 | 
						AdminId       uint32   `field:"adminId"`       // 管理员ID
 | 
				
			||||||
	UserId        uint32 `field:"userId"`        // 用户ID
 | 
						UserId        uint32   `field:"userId"`        // 用户ID
 | 
				
			||||||
	Type          string `field:"type"`          // 供应商类型
 | 
						Type          string   `field:"type"`          // 供应商类型
 | 
				
			||||||
	ApiParams     string `field:"apiParams"`     // API参数
 | 
						ApiParams     dbs.JSON `field:"apiParams"`     // API参数
 | 
				
			||||||
	CreatedAt     uint64 `field:"createdAt"`     // 创建时间
 | 
						CreatedAt     uint64   `field:"createdAt"`     // 创建时间
 | 
				
			||||||
	State         uint8  `field:"state"`         // 状态
 | 
						State         uint8    `field:"state"`         // 状态
 | 
				
			||||||
	DataUpdatedAt uint64 `field:"dataUpdatedAt"` // 数据同步时间
 | 
						DataUpdatedAt uint64   `field:"dataUpdatedAt"` // 数据同步时间
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type DNSProviderOperator struct {
 | 
					type DNSProviderOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,9 +5,9 @@ import (
 | 
				
			|||||||
	"github.com/iwind/TeaGo/maps"
 | 
						"github.com/iwind/TeaGo/maps"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 获取API参数
 | 
					// DecodeAPIParams 获取API参数
 | 
				
			||||||
func (this *DNSProvider) DecodeAPIParams() (maps.Map, error) {
 | 
					func (this *DNSProvider) DecodeAPIParams() (maps.Map, error) {
 | 
				
			||||||
	if len(this.ApiParams) == 0 || this.ApiParams == "null" {
 | 
						if len(this.ApiParams) == 0 {
 | 
				
			||||||
		return maps.Map{}, nil
 | 
							return maps.Map{}, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	result := maps.Map{}
 | 
						result := maps.Map{}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ package models
 | 
				
			|||||||
type FileChunk struct {
 | 
					type FileChunk struct {
 | 
				
			||||||
	Id     uint32 `field:"id"`     // ID
 | 
						Id     uint32 `field:"id"`     // ID
 | 
				
			||||||
	FileId uint32 `field:"fileId"` // 文件ID
 | 
						FileId uint32 `field:"fileId"` // 文件ID
 | 
				
			||||||
	Data   string `field:"data"`   // 分块内容
 | 
						Data   []byte `field:"data"`   // 分块内容
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type FileChunkOperator struct {
 | 
					type FileChunkOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,22 +1,24 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPAccessLog 访问日志
 | 
					// HTTPAccessLog 访问日志
 | 
				
			||||||
type HTTPAccessLog struct {
 | 
					type HTTPAccessLog struct {
 | 
				
			||||||
	Id                  uint64 `field:"id"`                  // ID
 | 
						Id                  uint64   `field:"id"`                  // ID
 | 
				
			||||||
	ServerId            uint32 `field:"serverId"`            // 服务ID
 | 
						ServerId            uint32   `field:"serverId"`            // 服务ID
 | 
				
			||||||
	NodeId              uint32 `field:"nodeId"`              // 节点ID
 | 
						NodeId              uint32   `field:"nodeId"`              // 节点ID
 | 
				
			||||||
	Status              uint32 `field:"status"`              // 状态码
 | 
						Status              uint32   `field:"status"`              // 状态码
 | 
				
			||||||
	CreatedAt           uint64 `field:"createdAt"`           // 创建时间
 | 
						CreatedAt           uint64   `field:"createdAt"`           // 创建时间
 | 
				
			||||||
	Content             string `field:"content"`             // 日志内容
 | 
						Content             dbs.JSON `field:"content"`             // 日志内容
 | 
				
			||||||
	RequestId           string `field:"requestId"`           // 请求ID
 | 
						RequestId           string   `field:"requestId"`           // 请求ID
 | 
				
			||||||
	FirewallPolicyId    uint32 `field:"firewallPolicyId"`    // WAF策略ID
 | 
						FirewallPolicyId    uint32   `field:"firewallPolicyId"`    // WAF策略ID
 | 
				
			||||||
	FirewallRuleGroupId uint32 `field:"firewallRuleGroupId"` // WAF分组ID
 | 
						FirewallRuleGroupId uint32   `field:"firewallRuleGroupId"` // WAF分组ID
 | 
				
			||||||
	FirewallRuleSetId   uint32 `field:"firewallRuleSetId"`   // WAF集ID
 | 
						FirewallRuleSetId   uint32   `field:"firewallRuleSetId"`   // WAF集ID
 | 
				
			||||||
	FirewallRuleId      uint32 `field:"firewallRuleId"`      // WAF规则ID
 | 
						FirewallRuleId      uint32   `field:"firewallRuleId"`      // WAF规则ID
 | 
				
			||||||
	RemoteAddr          string `field:"remoteAddr"`          // IP地址
 | 
						RemoteAddr          string   `field:"remoteAddr"`          // IP地址
 | 
				
			||||||
	Domain              string `field:"domain"`              // 域名
 | 
						Domain              string   `field:"domain"`              // 域名
 | 
				
			||||||
	RequestBody         string `field:"requestBody"`         // 请求内容
 | 
						RequestBody         []byte   `field:"requestBody"`         // 请求内容
 | 
				
			||||||
	ResponseBody        string `field:"responseBody"`        // 响应内容
 | 
						ResponseBody        []byte   `field:"responseBody"`        // 响应内容
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPAccessLogOperator struct {
 | 
					type HTTPAccessLogOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,20 +1,22 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPAccessLogPolicy 访问日志策略
 | 
					// HTTPAccessLogPolicy 访问日志策略
 | 
				
			||||||
type HTTPAccessLogPolicy struct {
 | 
					type HTTPAccessLogPolicy struct {
 | 
				
			||||||
	Id         uint32 `field:"id"`         // ID
 | 
						Id         uint32   `field:"id"`         // ID
 | 
				
			||||||
	TemplateId uint32 `field:"templateId"` // 模版ID
 | 
						TemplateId uint32   `field:"templateId"` // 模版ID
 | 
				
			||||||
	AdminId    uint32 `field:"adminId"`    // 管理员ID
 | 
						AdminId    uint32   `field:"adminId"`    // 管理员ID
 | 
				
			||||||
	UserId     uint32 `field:"userId"`     // 用户ID
 | 
						UserId     uint32   `field:"userId"`     // 用户ID
 | 
				
			||||||
	State      uint8  `field:"state"`      // 状态
 | 
						State      uint8    `field:"state"`      // 状态
 | 
				
			||||||
	CreatedAt  uint64 `field:"createdAt"`  // 创建时间
 | 
						CreatedAt  uint64   `field:"createdAt"`  // 创建时间
 | 
				
			||||||
	Name       string `field:"name"`       // 名称
 | 
						Name       string   `field:"name"`       // 名称
 | 
				
			||||||
	IsOn       uint8  `field:"isOn"`       // 是否启用
 | 
						IsOn       uint8    `field:"isOn"`       // 是否启用
 | 
				
			||||||
	Type       string `field:"type"`       // 存储类型
 | 
						Type       string   `field:"type"`       // 存储类型
 | 
				
			||||||
	Options    string `field:"options"`    // 存储选项
 | 
						Options    dbs.JSON `field:"options"`    // 存储选项
 | 
				
			||||||
	Conds      string `field:"conds"`      // 请求条件
 | 
						Conds      dbs.JSON `field:"conds"`      // 请求条件
 | 
				
			||||||
	IsPublic   uint8  `field:"isPublic"`   // 是否为公用
 | 
						IsPublic   uint8    `field:"isPublic"`   // 是否为公用
 | 
				
			||||||
	Version    uint32 `field:"version"`    // 版本号
 | 
						Version    uint32   `field:"version"`    // 版本号
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPAccessLogPolicyOperator struct {
 | 
					type HTTPAccessLogPolicyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,17 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPAuthPolicy HTTP认证策略
 | 
					// HTTPAuthPolicy HTTP认证策略
 | 
				
			||||||
type HTTPAuthPolicy struct {
 | 
					type HTTPAuthPolicy struct {
 | 
				
			||||||
	Id      uint64 `field:"id"`      // ID
 | 
						Id      uint64   `field:"id"`      // ID
 | 
				
			||||||
	AdminId uint32 `field:"adminId"` // 管理员ID
 | 
						AdminId uint32   `field:"adminId"` // 管理员ID
 | 
				
			||||||
	UserId  uint32 `field:"userId"`  // 用户ID
 | 
						UserId  uint32   `field:"userId"`  // 用户ID
 | 
				
			||||||
	IsOn    uint8  `field:"isOn"`    // 是否启用
 | 
						IsOn    uint8    `field:"isOn"`    // 是否启用
 | 
				
			||||||
	Name    string `field:"name"`    // 名称
 | 
						Name    string   `field:"name"`    // 名称
 | 
				
			||||||
	Type    string `field:"type"`    // 类型
 | 
						Type    string   `field:"type"`    // 类型
 | 
				
			||||||
	Params  string `field:"params"`  // 参数
 | 
						Params  dbs.JSON `field:"params"`  // 参数
 | 
				
			||||||
	State   uint8  `field:"state"`   // 状态
 | 
						State   uint8    `field:"state"`   // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPAuthPolicyOperator struct {
 | 
					type HTTPAuthPolicyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,19 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPBrotliPolicy Gzip配置
 | 
					// HTTPBrotliPolicy Gzip配置
 | 
				
			||||||
type HTTPBrotliPolicy struct {
 | 
					type HTTPBrotliPolicy struct {
 | 
				
			||||||
	Id        uint32 `field:"id"`        // ID
 | 
						Id        uint32   `field:"id"`        // ID
 | 
				
			||||||
	AdminId   uint32 `field:"adminId"`   // 管理员ID
 | 
						AdminId   uint32   `field:"adminId"`   // 管理员ID
 | 
				
			||||||
	UserId    uint32 `field:"userId"`    // 用户ID
 | 
						UserId    uint32   `field:"userId"`    // 用户ID
 | 
				
			||||||
	IsOn      uint8  `field:"isOn"`      // 是否启用
 | 
						IsOn      uint8    `field:"isOn"`      // 是否启用
 | 
				
			||||||
	Level     uint32 `field:"level"`     // 压缩级别
 | 
						Level     uint32   `field:"level"`     // 压缩级别
 | 
				
			||||||
	MinLength string `field:"minLength"` // 可压缩最小值
 | 
						MinLength dbs.JSON `field:"minLength"` // 可压缩最小值
 | 
				
			||||||
	MaxLength string `field:"maxLength"` // 可压缩最大值
 | 
						MaxLength dbs.JSON `field:"maxLength"` // 可压缩最大值
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
	Conds     string `field:"conds"`     // 条件
 | 
						Conds     dbs.JSON `field:"conds"`     // 条件
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPBrotliPolicyOperator struct {
 | 
					type HTTPBrotliPolicyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,23 +1,25 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPCachePolicy HTTP缓存策略
 | 
					// HTTPCachePolicy HTTP缓存策略
 | 
				
			||||||
type HTTPCachePolicy struct {
 | 
					type HTTPCachePolicy struct {
 | 
				
			||||||
	Id                   uint32 `field:"id"`                   // ID
 | 
						Id                   uint32   `field:"id"`                   // ID
 | 
				
			||||||
	AdminId              uint32 `field:"adminId"`              // 管理员ID
 | 
						AdminId              uint32   `field:"adminId"`              // 管理员ID
 | 
				
			||||||
	UserId               uint32 `field:"userId"`               // 用户ID
 | 
						UserId               uint32   `field:"userId"`               // 用户ID
 | 
				
			||||||
	TemplateId           uint32 `field:"templateId"`           // 模版ID
 | 
						TemplateId           uint32   `field:"templateId"`           // 模版ID
 | 
				
			||||||
	IsOn                 uint8  `field:"isOn"`                 // 是否启用
 | 
						IsOn                 uint8    `field:"isOn"`                 // 是否启用
 | 
				
			||||||
	Name                 string `field:"name"`                 // 名称
 | 
						Name                 string   `field:"name"`                 // 名称
 | 
				
			||||||
	Capacity             string `field:"capacity"`             // 容量数据
 | 
						Capacity             dbs.JSON `field:"capacity"`             // 容量数据
 | 
				
			||||||
	MaxKeys              uint64 `field:"maxKeys"`              // 最多Key值
 | 
						MaxKeys              uint64   `field:"maxKeys"`              // 最多Key值
 | 
				
			||||||
	MaxSize              string `field:"maxSize"`              // 最大缓存内容尺寸
 | 
						MaxSize              dbs.JSON `field:"maxSize"`              // 最大缓存内容尺寸
 | 
				
			||||||
	Type                 string `field:"type"`                 // 存储类型
 | 
						Type                 string   `field:"type"`                 // 存储类型
 | 
				
			||||||
	Options              string `field:"options"`              // 存储选项
 | 
						Options              dbs.JSON `field:"options"`              // 存储选项
 | 
				
			||||||
	CreatedAt            uint64 `field:"createdAt"`            // 创建时间
 | 
						CreatedAt            uint64   `field:"createdAt"`            // 创建时间
 | 
				
			||||||
	State                uint8  `field:"state"`                // 状态
 | 
						State                uint8    `field:"state"`                // 状态
 | 
				
			||||||
	Description          string `field:"description"`          // 描述
 | 
						Description          string   `field:"description"`          // 描述
 | 
				
			||||||
	Refs                 string `field:"refs"`                 // 默认的缓存设置
 | 
						Refs                 dbs.JSON `field:"refs"`                 // 默认的缓存设置
 | 
				
			||||||
	SyncCompressionCache uint8  `field:"syncCompressionCache"` // 是否同步写入压缩缓存
 | 
						SyncCompressionCache uint8    `field:"syncCompressionCache"` // 是否同步写入压缩缓存
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPCachePolicyOperator struct {
 | 
					type HTTPCachePolicyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,19 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPDeflatePolicy Gzip配置
 | 
					// HTTPDeflatePolicy Gzip配置
 | 
				
			||||||
type HTTPDeflatePolicy struct {
 | 
					type HTTPDeflatePolicy struct {
 | 
				
			||||||
	Id        uint32 `field:"id"`        // ID
 | 
						Id        uint32   `field:"id"`        // ID
 | 
				
			||||||
	AdminId   uint32 `field:"adminId"`   // 管理员ID
 | 
						AdminId   uint32   `field:"adminId"`   // 管理员ID
 | 
				
			||||||
	UserId    uint32 `field:"userId"`    // 用户ID
 | 
						UserId    uint32   `field:"userId"`    // 用户ID
 | 
				
			||||||
	IsOn      uint8  `field:"isOn"`      // 是否启用
 | 
						IsOn      uint8    `field:"isOn"`      // 是否启用
 | 
				
			||||||
	Level     uint32 `field:"level"`     // 压缩级别
 | 
						Level     uint32   `field:"level"`     // 压缩级别
 | 
				
			||||||
	MinLength string `field:"minLength"` // 可压缩最小值
 | 
						MinLength dbs.JSON `field:"minLength"` // 可压缩最小值
 | 
				
			||||||
	MaxLength string `field:"maxLength"` // 可压缩最大值
 | 
						MaxLength dbs.JSON `field:"maxLength"` // 可压缩最大值
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
	Conds     string `field:"conds"`     // 条件
 | 
						Conds     dbs.JSON `field:"conds"`     // 条件
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPDeflatePolicyOperator struct {
 | 
					type HTTPDeflatePolicyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,18 +1,20 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPFastcgi Fastcgi设置
 | 
					// HTTPFastcgi Fastcgi设置
 | 
				
			||||||
type HTTPFastcgi struct {
 | 
					type HTTPFastcgi struct {
 | 
				
			||||||
	Id              uint64 `field:"id"`              // ID
 | 
						Id              uint64   `field:"id"`              // ID
 | 
				
			||||||
	AdminId         uint32 `field:"adminId"`         // 管理员ID
 | 
						AdminId         uint32   `field:"adminId"`         // 管理员ID
 | 
				
			||||||
	UserId          uint32 `field:"userId"`          // 用户ID
 | 
						UserId          uint32   `field:"userId"`          // 用户ID
 | 
				
			||||||
	IsOn            uint8  `field:"isOn"`            // 是否启用
 | 
						IsOn            uint8    `field:"isOn"`            // 是否启用
 | 
				
			||||||
	Address         string `field:"address"`         // 地址
 | 
						Address         string   `field:"address"`         // 地址
 | 
				
			||||||
	Params          string `field:"params"`          // 参数
 | 
						Params          dbs.JSON `field:"params"`          // 参数
 | 
				
			||||||
	ReadTimeout     string `field:"readTimeout"`     // 读取超时
 | 
						ReadTimeout     dbs.JSON `field:"readTimeout"`     // 读取超时
 | 
				
			||||||
	ConnTimeout     string `field:"connTimeout"`     // 连接超时
 | 
						ConnTimeout     dbs.JSON `field:"connTimeout"`     // 连接超时
 | 
				
			||||||
	PoolSize        uint32 `field:"poolSize"`        // 连接池尺寸
 | 
						PoolSize        uint32   `field:"poolSize"`        // 连接池尺寸
 | 
				
			||||||
	PathInfoPattern string `field:"pathInfoPattern"` // PATH_INFO匹配
 | 
						PathInfoPattern string   `field:"pathInfoPattern"` // PATH_INFO匹配
 | 
				
			||||||
	State           uint8  `field:"state"`           // 状态
 | 
						State           uint8    `field:"state"`           // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPFastcgiOperator struct {
 | 
					type HTTPFastcgiOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPFirewallPolicy HTTP防火墙
 | 
					// HTTPFirewallPolicy HTTP防火墙
 | 
				
			||||||
type HTTPFirewallPolicy struct {
 | 
					type HTTPFirewallPolicy struct {
 | 
				
			||||||
	Id               uint32 `field:"id"`               // ID
 | 
						Id               uint32 `field:"id"`               // ID
 | 
				
			||||||
@@ -13,12 +15,12 @@ type HTTPFirewallPolicy struct {
 | 
				
			|||||||
	IsOn             uint8  `field:"isOn"`             // 是否启用
 | 
						IsOn             uint8  `field:"isOn"`             // 是否启用
 | 
				
			||||||
	Name             string `field:"name"`             // 名称
 | 
						Name             string `field:"name"`             // 名称
 | 
				
			||||||
	Description      string `field:"description"`      // 描述
 | 
						Description      string `field:"description"`      // 描述
 | 
				
			||||||
	Inbound          string `field:"inbound"`          // 入站规则
 | 
						Inbound          dbs.JSON `field:"inbound"`          // 入站规则
 | 
				
			||||||
	Outbound         string `field:"outbound"`         // 出站规则
 | 
						Outbound         dbs.JSON `field:"outbound"`         // 出站规则
 | 
				
			||||||
	BlockOptions     string `field:"blockOptions"`     // BLOCK选项
 | 
						BlockOptions     dbs.JSON `field:"blockOptions"`     // BLOCK选项
 | 
				
			||||||
	Mode             string `field:"mode"`             // 模式
 | 
						Mode             string `field:"mode"`             // 模式
 | 
				
			||||||
	UseLocalFirewall uint8  `field:"useLocalFirewall"` // 是否自动使用本地防火墙
 | 
						UseLocalFirewall uint8  `field:"useLocalFirewall"` // 是否自动使用本地防火墙
 | 
				
			||||||
	SynFlood         string `field:"synFlood"`         // SynFlood防御设置
 | 
						SynFlood         dbs.JSON `field:"synFlood"`         // SynFlood防御设置
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPFirewallPolicyOperator struct {
 | 
					type HTTPFirewallPolicyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,18 +1,20 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPFirewallRuleGroup 防火墙规则分组
 | 
					// HTTPFirewallRuleGroup 防火墙规则分组
 | 
				
			||||||
type HTTPFirewallRuleGroup struct {
 | 
					type HTTPFirewallRuleGroup struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	Name        string `field:"name"`        // 名称
 | 
						Name        string   `field:"name"`        // 名称
 | 
				
			||||||
	Description string `field:"description"` // 描述
 | 
						Description string   `field:"description"` // 描述
 | 
				
			||||||
	Code        string `field:"code"`        // 代号
 | 
						Code        string   `field:"code"`        // 代号
 | 
				
			||||||
	IsTemplate  uint8  `field:"isTemplate"`  // 是否为预置模板
 | 
						IsTemplate  uint8    `field:"isTemplate"`  // 是否为预置模板
 | 
				
			||||||
	AdminId     uint32 `field:"adminId"`     // 管理员ID
 | 
						AdminId     uint32   `field:"adminId"`     // 管理员ID
 | 
				
			||||||
	UserId      uint32 `field:"userId"`      // 用户ID
 | 
						UserId      uint32   `field:"userId"`      // 用户ID
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	Sets        string `field:"sets"`        // 规则集列表
 | 
						Sets        dbs.JSON `field:"sets"`        // 规则集列表
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPFirewallRuleGroupOperator struct {
 | 
					type HTTPFirewallRuleGroupOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,20 +1,22 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 防火墙规则
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// HTTPFirewallRule 防火墙规则
 | 
				
			||||||
type HTTPFirewallRule struct {
 | 
					type HTTPFirewallRule struct {
 | 
				
			||||||
	Id                uint32 `field:"id"`                // ID
 | 
						Id                uint32   `field:"id"`                // ID
 | 
				
			||||||
	IsOn              uint8  `field:"isOn"`              // 是否启用
 | 
						IsOn              uint8    `field:"isOn"`              // 是否启用
 | 
				
			||||||
	Description       string `field:"description"`       // 说明
 | 
						Description       string   `field:"description"`       // 说明
 | 
				
			||||||
	Param             string `field:"param"`             // 参数
 | 
						Param             string   `field:"param"`             // 参数
 | 
				
			||||||
	ParamFilters      string `field:"paramFilters"`      // 处理器
 | 
						ParamFilters      dbs.JSON `field:"paramFilters"`      // 处理器
 | 
				
			||||||
	Operator          string `field:"operator"`          // 操作符
 | 
						Operator          string   `field:"operator"`          // 操作符
 | 
				
			||||||
	Value             string `field:"value"`             // 对比值
 | 
						Value             string   `field:"value"`             // 对比值
 | 
				
			||||||
	IsCaseInsensitive uint8  `field:"isCaseInsensitive"` // 是否大小写不敏感
 | 
						IsCaseInsensitive uint8    `field:"isCaseInsensitive"` // 是否大小写不敏感
 | 
				
			||||||
	CheckpointOptions string `field:"checkpointOptions"` // 检查点参数
 | 
						CheckpointOptions dbs.JSON `field:"checkpointOptions"` // 检查点参数
 | 
				
			||||||
	State             uint8  `field:"state"`             // 状态
 | 
						State             uint8    `field:"state"`             // 状态
 | 
				
			||||||
	CreatedAt         uint64 `field:"createdAt"`         // 创建时间
 | 
						CreatedAt         uint64   `field:"createdAt"`         // 创建时间
 | 
				
			||||||
	AdminId           uint32 `field:"adminId"`           // 管理员ID
 | 
						AdminId           uint32   `field:"adminId"`           // 管理员ID
 | 
				
			||||||
	UserId            uint32 `field:"userId"`            // 用户ID
 | 
						UserId            uint32   `field:"userId"`            // 用户ID
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPFirewallRuleOperator struct {
 | 
					type HTTPFirewallRuleOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,22 +1,24 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPFirewallRuleSet 防火墙规则集
 | 
					// HTTPFirewallRuleSet 防火墙规则集
 | 
				
			||||||
type HTTPFirewallRuleSet struct {
 | 
					type HTTPFirewallRuleSet struct {
 | 
				
			||||||
	Id            uint32 `field:"id"`            // ID
 | 
						Id            uint32   `field:"id"`            // ID
 | 
				
			||||||
	IsOn          uint8  `field:"isOn"`          // 是否启用
 | 
						IsOn          uint8    `field:"isOn"`          // 是否启用
 | 
				
			||||||
	Code          string `field:"code"`          // 代号
 | 
						Code          string   `field:"code"`          // 代号
 | 
				
			||||||
	Name          string `field:"name"`          // 名称
 | 
						Name          string   `field:"name"`          // 名称
 | 
				
			||||||
	Description   string `field:"description"`   // 描述
 | 
						Description   string   `field:"description"`   // 描述
 | 
				
			||||||
	CreatedAt     uint64 `field:"createdAt"`     // 创建时间
 | 
						CreatedAt     uint64   `field:"createdAt"`     // 创建时间
 | 
				
			||||||
	Rules         string `field:"rules"`         // 规则列表
 | 
						Rules         dbs.JSON `field:"rules"`         // 规则列表
 | 
				
			||||||
	Connector     string `field:"connector"`     // 规则之间的关系
 | 
						Connector     string   `field:"connector"`     // 规则之间的关系
 | 
				
			||||||
	State         uint8  `field:"state"`         // 状态
 | 
						State         uint8    `field:"state"`         // 状态
 | 
				
			||||||
	AdminId       uint32 `field:"adminId"`       // 管理员ID
 | 
						AdminId       uint32   `field:"adminId"`       // 管理员ID
 | 
				
			||||||
	UserId        uint32 `field:"userId"`        // 用户ID
 | 
						UserId        uint32   `field:"userId"`        // 用户ID
 | 
				
			||||||
	Action        string `field:"action"`        // 执行的动作(过期)
 | 
						Action        string   `field:"action"`        // 执行的动作(过期)
 | 
				
			||||||
	ActionOptions string `field:"actionOptions"` // 动作的选项(过期)
 | 
						ActionOptions dbs.JSON `field:"actionOptions"` // 动作的选项(过期)
 | 
				
			||||||
	Actions       string `field:"actions"`       // 一组动作
 | 
						Actions       dbs.JSON `field:"actions"`       // 一组动作
 | 
				
			||||||
	IgnoreLocal   uint8  `field:"ignoreLocal"`   // 忽略局域网请求
 | 
						IgnoreLocal   uint8    `field:"ignoreLocal"`   // 忽略局域网请求
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPFirewallRuleSetOperator struct {
 | 
					type HTTPFirewallRuleSetOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,19 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Gzip配置
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// HTTPGzip Gzip配置
 | 
				
			||||||
type HTTPGzip struct {
 | 
					type HTTPGzip struct {
 | 
				
			||||||
	Id        uint32 `field:"id"`        // ID
 | 
						Id        uint32   `field:"id"`        // ID
 | 
				
			||||||
	AdminId   uint32 `field:"adminId"`   // 管理员ID
 | 
						AdminId   uint32   `field:"adminId"`   // 管理员ID
 | 
				
			||||||
	UserId    uint32 `field:"userId"`    // 用户ID
 | 
						UserId    uint32   `field:"userId"`    // 用户ID
 | 
				
			||||||
	IsOn      uint8  `field:"isOn"`      // 是否启用
 | 
						IsOn      uint8    `field:"isOn"`      // 是否启用
 | 
				
			||||||
	Level     uint32 `field:"level"`     // 压缩级别
 | 
						Level     uint32   `field:"level"`     // 压缩级别
 | 
				
			||||||
	MinLength string `field:"minLength"` // 可压缩最小值
 | 
						MinLength dbs.JSON `field:"minLength"` // 可压缩最小值
 | 
				
			||||||
	MaxLength string `field:"maxLength"` // 可压缩最大值
 | 
						MaxLength dbs.JSON `field:"maxLength"` // 可压缩最大值
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
	Conds     string `field:"conds"`     // 条件
 | 
						Conds     dbs.JSON `field:"conds"`     // 条件
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPGzipOperator struct {
 | 
					type HTTPGzipOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,24 +1,26 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPHeader HTTP Header
 | 
					// HTTPHeader HTTP Header
 | 
				
			||||||
type HTTPHeader struct {
 | 
					type HTTPHeader struct {
 | 
				
			||||||
	Id              uint32 `field:"id"`              // ID
 | 
						Id              uint32   `field:"id"`              // ID
 | 
				
			||||||
	AdminId         uint32 `field:"adminId"`         // 管理员ID
 | 
						AdminId         uint32   `field:"adminId"`         // 管理员ID
 | 
				
			||||||
	UserId          uint32 `field:"userId"`          // 用户ID
 | 
						UserId          uint32   `field:"userId"`          // 用户ID
 | 
				
			||||||
	TemplateId      uint32 `field:"templateId"`      // 模版ID
 | 
						TemplateId      uint32   `field:"templateId"`      // 模版ID
 | 
				
			||||||
	IsOn            uint8  `field:"isOn"`            // 是否启用
 | 
						IsOn            uint8    `field:"isOn"`            // 是否启用
 | 
				
			||||||
	Name            string `field:"name"`            // 名称
 | 
						Name            string   `field:"name"`            // 名称
 | 
				
			||||||
	Value           string `field:"value"`           // 值
 | 
						Value           string   `field:"value"`           // 值
 | 
				
			||||||
	Order           uint32 `field:"order"`           // 排序
 | 
						Order           uint32   `field:"order"`           // 排序
 | 
				
			||||||
	Status          string `field:"status"`          // 状态码设置
 | 
						Status          dbs.JSON `field:"status"`          // 状态码设置
 | 
				
			||||||
	DisableRedirect uint8  `field:"disableRedirect"` // 是否不支持跳转
 | 
						DisableRedirect uint8    `field:"disableRedirect"` // 是否不支持跳转
 | 
				
			||||||
	ShouldAppend    uint8  `field:"shouldAppend"`    // 是否为附加
 | 
						ShouldAppend    uint8    `field:"shouldAppend"`    // 是否为附加
 | 
				
			||||||
	ShouldReplace   uint8  `field:"shouldReplace"`   // 是否替换变量
 | 
						ShouldReplace   uint8    `field:"shouldReplace"`   // 是否替换变量
 | 
				
			||||||
	ReplaceValues   string `field:"replaceValues"`   // 替换的值
 | 
						ReplaceValues   dbs.JSON `field:"replaceValues"`   // 替换的值
 | 
				
			||||||
	Methods         string `field:"methods"`         // 支持的方法
 | 
						Methods         dbs.JSON `field:"methods"`         // 支持的方法
 | 
				
			||||||
	Domains         string `field:"domains"`         // 支持的域名
 | 
						Domains         dbs.JSON `field:"domains"`         // 支持的域名
 | 
				
			||||||
	State           uint8  `field:"state"`           // 状态
 | 
						State           uint8    `field:"state"`           // 状态
 | 
				
			||||||
	CreatedAt       uint64 `field:"createdAt"`       // 创建时间
 | 
						CreatedAt       uint64   `field:"createdAt"`       // 创建时间
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPHeaderOperator struct {
 | 
					type HTTPHeaderOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,21 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
type HTTPHeaderPolicy struct {
 | 
					type HTTPHeaderPolicy struct {
 | 
				
			||||||
	Id             uint32 `field:"id"`             // ID
 | 
						Id             uint32   `field:"id"`             // ID
 | 
				
			||||||
	IsOn           uint8  `field:"isOn"`           // 是否启用
 | 
						IsOn           uint8    `field:"isOn"`           // 是否启用
 | 
				
			||||||
	State          uint8  `field:"state"`          // 状态
 | 
						State          uint8    `field:"state"`          // 状态
 | 
				
			||||||
	AdminId        uint32 `field:"adminId"`        // 管理员ID
 | 
						AdminId        uint32   `field:"adminId"`        // 管理员ID
 | 
				
			||||||
	UserId         uint32 `field:"userId"`         // 用户ID
 | 
						UserId         uint32   `field:"userId"`         // 用户ID
 | 
				
			||||||
	CreatedAt      uint64 `field:"createdAt"`      // 创建时间
 | 
						CreatedAt      uint64   `field:"createdAt"`      // 创建时间
 | 
				
			||||||
	AddHeaders     string `field:"addHeaders"`     // 添加的Header
 | 
						AddHeaders     dbs.JSON `field:"addHeaders"`     // 添加的Header
 | 
				
			||||||
	AddTrailers    string `field:"addTrailers"`    // 添加的Trailers
 | 
						AddTrailers    dbs.JSON `field:"addTrailers"`    // 添加的Trailers
 | 
				
			||||||
	SetHeaders     string `field:"setHeaders"`     // 设置Header
 | 
						SetHeaders     dbs.JSON `field:"setHeaders"`     // 设置Header
 | 
				
			||||||
	ReplaceHeaders string `field:"replaceHeaders"` // 替换Header内容
 | 
						ReplaceHeaders dbs.JSON `field:"replaceHeaders"` // 替换Header内容
 | 
				
			||||||
	Expires        string `field:"expires"`        // Expires单独设置
 | 
						Expires        dbs.JSON `field:"expires"`        // Expires单独设置
 | 
				
			||||||
	DeleteHeaders  string `field:"deleteHeaders"`  // 删除的Headers
 | 
						DeleteHeaders  dbs.JSON `field:"deleteHeaders"`  // 删除的Headers
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPHeaderPolicyOperator struct {
 | 
					type HTTPHeaderPolicyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -189,7 +189,7 @@ func (this *HTTPLocationDAO) ComposeLocationConfig(tx *dbs.Tx, locationId int64,
 | 
				
			|||||||
	// reverse proxy
 | 
						// reverse proxy
 | 
				
			||||||
	if IsNotNull(location.ReverseProxy) {
 | 
						if IsNotNull(location.ReverseProxy) {
 | 
				
			||||||
		ref := &serverconfigs.ReverseProxyRef{}
 | 
							ref := &serverconfigs.ReverseProxyRef{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(location.ReverseProxy), ref)
 | 
							err = json.Unmarshal(location.ReverseProxy, ref)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -204,9 +204,9 @@ func (this *HTTPLocationDAO) ComposeLocationConfig(tx *dbs.Tx, locationId int64,
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// conds
 | 
						// conds
 | 
				
			||||||
	if len(location.Conds) > 0 {
 | 
						if IsNotNull(location.Conds) {
 | 
				
			||||||
		conds := &shared.HTTPRequestCondsConfig{}
 | 
							conds := &shared.HTTPRequestCondsConfig{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(location.Conds), conds)
 | 
							err = json.Unmarshal(location.Conds, conds)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -214,9 +214,9 @@ func (this *HTTPLocationDAO) ComposeLocationConfig(tx *dbs.Tx, locationId int64,
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// domains
 | 
						// domains
 | 
				
			||||||
	if len(location.Domains) > 0 {
 | 
						if IsNotNull(location.Domains) {
 | 
				
			||||||
		var domains = []string{}
 | 
							var domains = []string{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(location.Domains), &domains)
 | 
							err = json.Unmarshal(location.Domains, &domains)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -241,7 +241,7 @@ func (this *HTTPLocationDAO) FindLocationReverseProxy(tx *dbs.Tx, locationId int
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if IsNotNull(refString) {
 | 
						if IsNotNull([]byte(refString)) {
 | 
				
			||||||
		ref := &serverconfigs.ReverseProxyRef{}
 | 
							ref := &serverconfigs.ReverseProxyRef{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(refString), ref)
 | 
							err = json.Unmarshal([]byte(refString), ref)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,24 +1,26 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPLocation 路由规则配置
 | 
					// HTTPLocation 路由规则配置
 | 
				
			||||||
type HTTPLocation struct {
 | 
					type HTTPLocation struct {
 | 
				
			||||||
	Id           uint32 `field:"id"`           // ID
 | 
						Id           uint32   `field:"id"`           // ID
 | 
				
			||||||
	TemplateId   uint32 `field:"templateId"`   // 模版ID
 | 
						TemplateId   uint32   `field:"templateId"`   // 模版ID
 | 
				
			||||||
	AdminId      uint32 `field:"adminId"`      // 管理员ID
 | 
						AdminId      uint32   `field:"adminId"`      // 管理员ID
 | 
				
			||||||
	UserId       uint32 `field:"userId"`       // 用户ID
 | 
						UserId       uint32   `field:"userId"`       // 用户ID
 | 
				
			||||||
	ParentId     uint32 `field:"parentId"`     // 父级ID
 | 
						ParentId     uint32   `field:"parentId"`     // 父级ID
 | 
				
			||||||
	State        uint8  `field:"state"`        // 状态
 | 
						State        uint8    `field:"state"`        // 状态
 | 
				
			||||||
	CreatedAt    uint64 `field:"createdAt"`    // 创建时间
 | 
						CreatedAt    uint64   `field:"createdAt"`    // 创建时间
 | 
				
			||||||
	Pattern      string `field:"pattern"`      // 匹配规则
 | 
						Pattern      string   `field:"pattern"`      // 匹配规则
 | 
				
			||||||
	IsOn         uint8  `field:"isOn"`         // 是否启用
 | 
						IsOn         uint8    `field:"isOn"`         // 是否启用
 | 
				
			||||||
	Name         string `field:"name"`         // 名称
 | 
						Name         string   `field:"name"`         // 名称
 | 
				
			||||||
	Description  string `field:"description"`  // 描述
 | 
						Description  string   `field:"description"`  // 描述
 | 
				
			||||||
	WebId        uint32 `field:"webId"`        // Web配置ID
 | 
						WebId        uint32   `field:"webId"`        // Web配置ID
 | 
				
			||||||
	ReverseProxy string `field:"reverseProxy"` // 反向代理
 | 
						ReverseProxy dbs.JSON `field:"reverseProxy"` // 反向代理
 | 
				
			||||||
	UrlPrefix    string `field:"urlPrefix"`    // URL前缀
 | 
						UrlPrefix    string   `field:"urlPrefix"`    // URL前缀
 | 
				
			||||||
	IsBreak      uint8  `field:"isBreak"`      // 是否终止匹配
 | 
						IsBreak      uint8    `field:"isBreak"`      // 是否终止匹配
 | 
				
			||||||
	Conds        string `field:"conds"`        // 匹配条件
 | 
						Conds        dbs.JSON `field:"conds"`        // 匹配条件
 | 
				
			||||||
	Domains      string `field:"domains"`      // 专属域名
 | 
						Domains      dbs.JSON `field:"domains"`      // 专属域名
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPLocationOperator struct {
 | 
					type HTTPLocationOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,18 +1,20 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPPage 特殊页面
 | 
					// HTTPPage 特殊页面
 | 
				
			||||||
type HTTPPage struct {
 | 
					type HTTPPage struct {
 | 
				
			||||||
	Id         uint32 `field:"id"`         // ID
 | 
						Id         uint32   `field:"id"`         // ID
 | 
				
			||||||
	AdminId    uint32 `field:"adminId"`    // 管理员ID
 | 
						AdminId    uint32   `field:"adminId"`    // 管理员ID
 | 
				
			||||||
	UserId     uint32 `field:"userId"`     // 用户ID
 | 
						UserId     uint32   `field:"userId"`     // 用户ID
 | 
				
			||||||
	IsOn       uint8  `field:"isOn"`       // 是否启用
 | 
						IsOn       uint8    `field:"isOn"`       // 是否启用
 | 
				
			||||||
	StatusList string `field:"statusList"` // 状态列表
 | 
						StatusList dbs.JSON `field:"statusList"` // 状态列表
 | 
				
			||||||
	Url        string `field:"url"`        // 页面URL
 | 
						Url        string   `field:"url"`        // 页面URL
 | 
				
			||||||
	NewStatus  int32  `field:"newStatus"`  // 新状态码
 | 
						NewStatus  int32    `field:"newStatus"`  // 新状态码
 | 
				
			||||||
	State      uint8  `field:"state"`      // 状态
 | 
						State      uint8    `field:"state"`      // 状态
 | 
				
			||||||
	CreatedAt  uint64 `field:"createdAt"`  // 创建时间
 | 
						CreatedAt  uint64   `field:"createdAt"`  // 创建时间
 | 
				
			||||||
	Body       string `field:"body"`       // 页面内容
 | 
						Body       string   `field:"body"`       // 页面内容
 | 
				
			||||||
	BodyType   string `field:"bodyType"`   // 内容类型
 | 
						BodyType   string   `field:"bodyType"`   // 内容类型
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPPageOperator struct {
 | 
					type HTTPPageOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,22 +1,24 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 重写规则
 | 
					// 重写规则
 | 
				
			||||||
type HTTPRewriteRule struct {
 | 
					type HTTPRewriteRule struct {
 | 
				
			||||||
	Id             uint32 `field:"id"`             // ID
 | 
						Id             uint32   `field:"id"`             // ID
 | 
				
			||||||
	AdminId        uint32 `field:"adminId"`        // 管理员ID
 | 
						AdminId        uint32   `field:"adminId"`        // 管理员ID
 | 
				
			||||||
	UserId         uint32 `field:"userId"`         // 用户ID
 | 
						UserId         uint32   `field:"userId"`         // 用户ID
 | 
				
			||||||
	TemplateId     uint32 `field:"templateId"`     // 模版ID
 | 
						TemplateId     uint32   `field:"templateId"`     // 模版ID
 | 
				
			||||||
	IsOn           uint8  `field:"isOn"`           // 是否启用
 | 
						IsOn           uint8    `field:"isOn"`           // 是否启用
 | 
				
			||||||
	State          uint8  `field:"state"`          // 状态
 | 
						State          uint8    `field:"state"`          // 状态
 | 
				
			||||||
	CreatedAt      uint64 `field:"createdAt"`      // 创建时间
 | 
						CreatedAt      uint64   `field:"createdAt"`      // 创建时间
 | 
				
			||||||
	Pattern        string `field:"pattern"`        // 匹配规则
 | 
						Pattern        string   `field:"pattern"`        // 匹配规则
 | 
				
			||||||
	Replace        string `field:"replace"`        // 跳转后的地址
 | 
						Replace        string   `field:"replace"`        // 跳转后的地址
 | 
				
			||||||
	Mode           string `field:"mode"`           // 替换模式
 | 
						Mode           string   `field:"mode"`           // 替换模式
 | 
				
			||||||
	RedirectStatus uint32 `field:"redirectStatus"` // 跳转的状态码
 | 
						RedirectStatus uint32   `field:"redirectStatus"` // 跳转的状态码
 | 
				
			||||||
	ProxyHost      string `field:"proxyHost"`      // 代理的主机名
 | 
						ProxyHost      string   `field:"proxyHost"`      // 代理的主机名
 | 
				
			||||||
	IsBreak        uint8  `field:"isBreak"`        // 是否终止解析
 | 
						IsBreak        uint8    `field:"isBreak"`        // 是否终止解析
 | 
				
			||||||
	WithQuery      uint8  `field:"withQuery"`      // 是否保留URI参数
 | 
						WithQuery      uint8    `field:"withQuery"`      // 是否保留URI参数
 | 
				
			||||||
	Conds          string `field:"conds"`          // 匹配条件
 | 
						Conds          dbs.JSON `field:"conds"`          // 匹配条件
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPRewriteRuleOperator struct {
 | 
					type HTTPRewriteRuleOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,40 +1,42 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HTTPWeb HTTP Web
 | 
					// HTTPWeb HTTP Web
 | 
				
			||||||
type HTTPWeb struct {
 | 
					type HTTPWeb struct {
 | 
				
			||||||
	Id                 uint32 `field:"id"`                 // ID
 | 
						Id                 uint32   `field:"id"`                 // ID
 | 
				
			||||||
	IsOn               uint8  `field:"isOn"`               // 是否启用
 | 
						IsOn               uint8    `field:"isOn"`               // 是否启用
 | 
				
			||||||
	TemplateId         uint32 `field:"templateId"`         // 模版ID
 | 
						TemplateId         uint32   `field:"templateId"`         // 模版ID
 | 
				
			||||||
	AdminId            uint32 `field:"adminId"`            // 管理员ID
 | 
						AdminId            uint32   `field:"adminId"`            // 管理员ID
 | 
				
			||||||
	UserId             uint32 `field:"userId"`             // 用户ID
 | 
						UserId             uint32   `field:"userId"`             // 用户ID
 | 
				
			||||||
	State              uint8  `field:"state"`              // 状态
 | 
						State              uint8    `field:"state"`              // 状态
 | 
				
			||||||
	CreatedAt          uint64 `field:"createdAt"`          // 创建时间
 | 
						CreatedAt          uint64   `field:"createdAt"`          // 创建时间
 | 
				
			||||||
	Root               string `field:"root"`               // 根目录
 | 
						Root               dbs.JSON `field:"root"`               // 根目录
 | 
				
			||||||
	Charset            string `field:"charset"`            // 字符集
 | 
						Charset            dbs.JSON `field:"charset"`            // 字符集
 | 
				
			||||||
	Shutdown           string `field:"shutdown"`           // 临时关闭页面配置
 | 
						Shutdown           dbs.JSON `field:"shutdown"`           // 临时关闭页面配置
 | 
				
			||||||
	Pages              string `field:"pages"`              // 特殊页面
 | 
						Pages              dbs.JSON `field:"pages"`              // 特殊页面
 | 
				
			||||||
	RedirectToHttps    string `field:"redirectToHttps"`    // 跳转到HTTPS设置
 | 
						RedirectToHttps    dbs.JSON `field:"redirectToHttps"`    // 跳转到HTTPS设置
 | 
				
			||||||
	Indexes            string `field:"indexes"`            // 首页文件列表
 | 
						Indexes            dbs.JSON `field:"indexes"`            // 首页文件列表
 | 
				
			||||||
	MaxRequestBodySize string `field:"maxRequestBodySize"` // 最大允许的请求内容尺寸
 | 
						MaxRequestBodySize dbs.JSON `field:"maxRequestBodySize"` // 最大允许的请求内容尺寸
 | 
				
			||||||
	RequestHeader      string `field:"requestHeader"`      // 请求Header配置
 | 
						RequestHeader      dbs.JSON `field:"requestHeader"`      // 请求Header配置
 | 
				
			||||||
	ResponseHeader     string `field:"responseHeader"`     // 响应Header配置
 | 
						ResponseHeader     dbs.JSON `field:"responseHeader"`     // 响应Header配置
 | 
				
			||||||
	AccessLog          string `field:"accessLog"`          // 访问日志配置
 | 
						AccessLog          dbs.JSON `field:"accessLog"`          // 访问日志配置
 | 
				
			||||||
	Stat               string `field:"stat"`               // 统计配置
 | 
						Stat               dbs.JSON `field:"stat"`               // 统计配置
 | 
				
			||||||
	Gzip               string `field:"gzip"`               // Gzip配置(v0.3.2弃用)
 | 
						Gzip               dbs.JSON `field:"gzip"`               // Gzip配置(v0.3.2弃用)
 | 
				
			||||||
	Compression        string `field:"compression"`        // 压缩配置
 | 
						Compression        dbs.JSON `field:"compression"`        // 压缩配置
 | 
				
			||||||
	Cache              string `field:"cache"`              // 缓存配置
 | 
						Cache              dbs.JSON `field:"cache"`              // 缓存配置
 | 
				
			||||||
	Firewall           string `field:"firewall"`           // 防火墙设置
 | 
						Firewall           dbs.JSON `field:"firewall"`           // 防火墙设置
 | 
				
			||||||
	Locations          string `field:"locations"`          // 路由规则配置
 | 
						Locations          dbs.JSON `field:"locations"`          // 路由规则配置
 | 
				
			||||||
	Websocket          string `field:"websocket"`          // Websocket设置
 | 
						Websocket          dbs.JSON `field:"websocket"`          // Websocket设置
 | 
				
			||||||
	RewriteRules       string `field:"rewriteRules"`       // 重写规则配置
 | 
						RewriteRules       dbs.JSON `field:"rewriteRules"`       // 重写规则配置
 | 
				
			||||||
	HostRedirects      string `field:"hostRedirects"`      // 域名跳转
 | 
						HostRedirects      dbs.JSON `field:"hostRedirects"`      // 域名跳转
 | 
				
			||||||
	Fastcgi            string `field:"fastcgi"`            // Fastcgi配置
 | 
						Fastcgi            dbs.JSON `field:"fastcgi"`            // Fastcgi配置
 | 
				
			||||||
	Auth               string `field:"auth"`               // 认证策略配置
 | 
						Auth               dbs.JSON `field:"auth"`               // 认证策略配置
 | 
				
			||||||
	Webp               string `field:"webp"`               // WebP配置
 | 
						Webp               dbs.JSON `field:"webp"`               // WebP配置
 | 
				
			||||||
	RemoteAddr         string `field:"remoteAddr"`         // 客户端IP配置
 | 
						RemoteAddr         dbs.JSON `field:"remoteAddr"`         // 客户端IP配置
 | 
				
			||||||
	MergeSlashes       uint8  `field:"mergeSlashes"`       // 是否合并路径中的斜杠
 | 
						MergeSlashes       uint8    `field:"mergeSlashes"`       // 是否合并路径中的斜杠
 | 
				
			||||||
	RequestLimit       string `field:"requestLimit"`       // 请求限制
 | 
						RequestLimit       dbs.JSON `field:"requestLimit"`       // 请求限制
 | 
				
			||||||
	RequestScripts     string `field:"requestScripts"`     // 请求脚本
 | 
						RequestScripts     dbs.JSON `field:"requestScripts"`     // 请求脚本
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPWebOperator struct {
 | 
					type HTTPWebOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,18 +1,20 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Websocket设置
 | 
					// Websocket设置
 | 
				
			||||||
type HTTPWebsocket struct {
 | 
					type HTTPWebsocket struct {
 | 
				
			||||||
	Id                uint32 `field:"id"`                // ID
 | 
						Id                uint32   `field:"id"`                // ID
 | 
				
			||||||
	AdminId           uint32 `field:"adminId"`           // 管理员ID
 | 
						AdminId           uint32   `field:"adminId"`           // 管理员ID
 | 
				
			||||||
	UserId            uint32 `field:"userId"`            // 用户ID
 | 
						UserId            uint32   `field:"userId"`            // 用户ID
 | 
				
			||||||
	CreatedAt         uint64 `field:"createdAt"`         // 创建时间
 | 
						CreatedAt         uint64   `field:"createdAt"`         // 创建时间
 | 
				
			||||||
	State             uint8  `field:"state"`             // 状态
 | 
						State             uint8    `field:"state"`             // 状态
 | 
				
			||||||
	IsOn              uint8  `field:"isOn"`              // 是否启用
 | 
						IsOn              uint8    `field:"isOn"`              // 是否启用
 | 
				
			||||||
	HandshakeTimeout  string `field:"handshakeTimeout"`  // 握手超时时间
 | 
						HandshakeTimeout  dbs.JSON `field:"handshakeTimeout"`  // 握手超时时间
 | 
				
			||||||
	AllowAllOrigins   uint8  `field:"allowAllOrigins"`   // 是否支持所有源
 | 
						AllowAllOrigins   uint8    `field:"allowAllOrigins"`   // 是否支持所有源
 | 
				
			||||||
	AllowedOrigins    string `field:"allowedOrigins"`    // 支持的源域名列表
 | 
						AllowedOrigins    dbs.JSON `field:"allowedOrigins"`    // 支持的源域名列表
 | 
				
			||||||
	RequestSameOrigin uint8  `field:"requestSameOrigin"` // 是否请求一样的Origin
 | 
						RequestSameOrigin uint8    `field:"requestSameOrigin"` // 是否请求一样的Origin
 | 
				
			||||||
	RequestOrigin     string `field:"requestOrigin"`     // 请求Origin
 | 
						RequestOrigin     string   `field:"requestOrigin"`     // 请求Origin
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPWebsocketOperator struct {
 | 
					type HTTPWebsocketOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,23 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// IPList IP名单
 | 
					// IPList IP名单
 | 
				
			||||||
type IPList struct {
 | 
					type IPList struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	Type        string `field:"type"`        // 类型
 | 
						Type        string   `field:"type"`        // 类型
 | 
				
			||||||
	AdminId     uint32 `field:"adminId"`     // 用户ID
 | 
						AdminId     uint32   `field:"adminId"`     // 用户ID
 | 
				
			||||||
	UserId      uint32 `field:"userId"`      // 用户ID
 | 
						UserId      uint32   `field:"userId"`      // 用户ID
 | 
				
			||||||
	Name        string `field:"name"`        // 列表名
 | 
						Name        string   `field:"name"`        // 列表名
 | 
				
			||||||
	Code        string `field:"code"`        // 代号
 | 
						Code        string   `field:"code"`        // 代号
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	Timeout     string `field:"timeout"`     // 默认超时时间
 | 
						Timeout     dbs.JSON `field:"timeout"`     // 默认超时时间
 | 
				
			||||||
	Actions     string `field:"actions"`     // IP触发的动作
 | 
						Actions     dbs.JSON `field:"actions"`     // IP触发的动作
 | 
				
			||||||
	Description string `field:"description"` // 描述
 | 
						Description string   `field:"description"` // 描述
 | 
				
			||||||
	IsPublic    uint8  `field:"isPublic"`    // 是否公用
 | 
						IsPublic    uint8    `field:"isPublic"`    // 是否公用
 | 
				
			||||||
	IsGlobal    uint8  `field:"isGlobal"`    // 是否全局
 | 
						IsGlobal    uint8    `field:"isGlobal"`    // 是否全局
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type IPListOperator struct {
 | 
					type IPListOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,16 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 第三方登录认证
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Login 第三方登录认证
 | 
				
			||||||
type Login struct {
 | 
					type Login struct {
 | 
				
			||||||
	Id      uint32 `field:"id"`      // ID
 | 
						Id      uint32   `field:"id"`      // ID
 | 
				
			||||||
	AdminId uint32 `field:"adminId"` // 管理员ID
 | 
						AdminId uint32   `field:"adminId"` // 管理员ID
 | 
				
			||||||
	UserId  uint32 `field:"userId"`  // 用户ID
 | 
						UserId  uint32   `field:"userId"`  // 用户ID
 | 
				
			||||||
	IsOn    uint8  `field:"isOn"`    // 是否启用
 | 
						IsOn    uint8    `field:"isOn"`    // 是否启用
 | 
				
			||||||
	Type    string `field:"type"`    // 认证方式
 | 
						Type    string   `field:"type"`    // 认证方式
 | 
				
			||||||
	Params  string `field:"params"`  // 参数
 | 
						Params  dbs.JSON `field:"params"`  // 参数
 | 
				
			||||||
	State   uint8  `field:"state"`   // 状态
 | 
						State   uint8    `field:"state"`   // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type LoginOperator struct {
 | 
					type LoginOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,18 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MessageMediaInstance 消息媒介接收人
 | 
					// MessageMediaInstance 消息媒介接收人
 | 
				
			||||||
type MessageMediaInstance struct {
 | 
					type MessageMediaInstance struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	Name        string `field:"name"`        // 名称
 | 
						Name        string   `field:"name"`        // 名称
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	MediaType   string `field:"mediaType"`   // 媒介类型
 | 
						MediaType   string   `field:"mediaType"`   // 媒介类型
 | 
				
			||||||
	Params      string `field:"params"`      // 媒介参数
 | 
						Params      dbs.JSON `field:"params"`      // 媒介参数
 | 
				
			||||||
	Description string `field:"description"` // 备注
 | 
						Description string   `field:"description"` // 备注
 | 
				
			||||||
	Rate        string `field:"rate"`        // 发送频率
 | 
						Rate        dbs.JSON `field:"rate"`        // 发送频率
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	HashLife    int32  `field:"hashLife"`    // HASH有效期(秒)
 | 
						HashLife    int32    `field:"hashLife"`    // HASH有效期(秒)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MessageMediaInstanceOperator struct {
 | 
					type MessageMediaInstanceOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,23 +1,25 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Message 消息通知
 | 
					// Message 消息通知
 | 
				
			||||||
type Message struct {
 | 
					type Message struct {
 | 
				
			||||||
	Id        uint64 `field:"id"`        // ID
 | 
						Id        uint64   `field:"id"`        // ID
 | 
				
			||||||
	AdminId   uint32 `field:"adminId"`   // 管理员ID
 | 
						AdminId   uint32   `field:"adminId"`   // 管理员ID
 | 
				
			||||||
	UserId    uint32 `field:"userId"`    // 用户ID
 | 
						UserId    uint32   `field:"userId"`    // 用户ID
 | 
				
			||||||
	Role      string `field:"role"`      // 角色
 | 
						Role      string   `field:"role"`      // 角色
 | 
				
			||||||
	ClusterId uint32 `field:"clusterId"` // 集群ID
 | 
						ClusterId uint32   `field:"clusterId"` // 集群ID
 | 
				
			||||||
	NodeId    uint32 `field:"nodeId"`    // 节点ID
 | 
						NodeId    uint32   `field:"nodeId"`    // 节点ID
 | 
				
			||||||
	Level     string `field:"level"`     // 级别
 | 
						Level     string   `field:"level"`     // 级别
 | 
				
			||||||
	Subject   string `field:"subject"`   // 标题
 | 
						Subject   string   `field:"subject"`   // 标题
 | 
				
			||||||
	Body      string `field:"body"`      // 内容
 | 
						Body      string   `field:"body"`      // 内容
 | 
				
			||||||
	Type      string `field:"type"`      // 消息类型
 | 
						Type      string   `field:"type"`      // 消息类型
 | 
				
			||||||
	Params    string `field:"params"`    // 额外的参数
 | 
						Params    dbs.JSON `field:"params"`    // 额外的参数
 | 
				
			||||||
	IsRead    uint8  `field:"isRead"`    // 是否已读
 | 
						IsRead    uint8    `field:"isRead"`    // 是否已读
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
	Day       string `field:"day"`       // 日期YYYYMMDD
 | 
						Day       string   `field:"day"`       // 日期YYYYMMDD
 | 
				
			||||||
	Hash      string `field:"hash"`      // 消息内容的Hash
 | 
						Hash      string   `field:"hash"`      // 消息内容的Hash
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MessageOperator struct {
 | 
					type MessageOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,19 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MessageReceiver 消息通知接收人
 | 
					// MessageReceiver 消息通知接收人
 | 
				
			||||||
type MessageReceiver struct {
 | 
					type MessageReceiver struct {
 | 
				
			||||||
	Id               uint32 `field:"id"`               // ID
 | 
						Id               uint32   `field:"id"`               // ID
 | 
				
			||||||
	Role             string `field:"role"`             // 节点角色
 | 
						Role             string   `field:"role"`             // 节点角色
 | 
				
			||||||
	ClusterId        uint32 `field:"clusterId"`        // 集群ID
 | 
						ClusterId        uint32   `field:"clusterId"`        // 集群ID
 | 
				
			||||||
	NodeId           uint32 `field:"nodeId"`           // 节点ID
 | 
						NodeId           uint32   `field:"nodeId"`           // 节点ID
 | 
				
			||||||
	ServerId         uint32 `field:"serverId"`         // 服务ID
 | 
						ServerId         uint32   `field:"serverId"`         // 服务ID
 | 
				
			||||||
	Type             string `field:"type"`             // 类型
 | 
						Type             string   `field:"type"`             // 类型
 | 
				
			||||||
	Params           string `field:"params"`           // 参数
 | 
						Params           dbs.JSON `field:"params"`           // 参数
 | 
				
			||||||
	RecipientId      uint32 `field:"recipientId"`      // 接收人ID
 | 
						RecipientId      uint32   `field:"recipientId"`      // 接收人ID
 | 
				
			||||||
	RecipientGroupId uint32 `field:"recipientGroupId"` // 接收人分组ID
 | 
						RecipientGroupId uint32   `field:"recipientGroupId"` // 接收人分组ID
 | 
				
			||||||
	State            uint8  `field:"state"`            // 状态
 | 
						State            uint8    `field:"state"`            // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MessageReceiverOperator struct {
 | 
					type MessageReceiverOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,19 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MessageRecipient 消息媒介接收人
 | 
					// MessageRecipient 消息媒介接收人
 | 
				
			||||||
type MessageRecipient struct {
 | 
					type MessageRecipient struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	AdminId     uint32 `field:"adminId"`     // 管理员ID
 | 
						AdminId     uint32   `field:"adminId"`     // 管理员ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	InstanceId  uint32 `field:"instanceId"`  // 实例ID
 | 
						InstanceId  uint32   `field:"instanceId"`  // 实例ID
 | 
				
			||||||
	User        string `field:"user"`        // 接收人信息
 | 
						User        string   `field:"user"`        // 接收人信息
 | 
				
			||||||
	GroupIds    string `field:"groupIds"`    // 分组ID
 | 
						GroupIds    dbs.JSON `field:"groupIds"`    // 分组ID
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	TimeFrom    string `field:"timeFrom"`    // 开始时间
 | 
						TimeFrom    string   `field:"timeFrom"`    // 开始时间
 | 
				
			||||||
	TimeTo      string `field:"timeTo"`      // 结束时间
 | 
						TimeTo      string   `field:"timeTo"`      // 结束时间
 | 
				
			||||||
	Description string `field:"description"` // 备注
 | 
						Description string   `field:"description"` // 备注
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MessageRecipientOperator struct {
 | 
					type MessageRecipientOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,23 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MessageTask 消息发送相关任务
 | 
					// MessageTask 消息发送相关任务
 | 
				
			||||||
type MessageTask struct {
 | 
					type MessageTask struct {
 | 
				
			||||||
	Id          uint64 `field:"id"`          // ID
 | 
						Id          uint64   `field:"id"`          // ID
 | 
				
			||||||
	RecipientId uint32 `field:"recipientId"` // 接收人ID
 | 
						RecipientId uint32   `field:"recipientId"` // 接收人ID
 | 
				
			||||||
	Hash        string `field:"hash"`        // SUM标识
 | 
						Hash        string   `field:"hash"`        // SUM标识
 | 
				
			||||||
	InstanceId  uint32 `field:"instanceId"`  // 媒介实例ID
 | 
						InstanceId  uint32   `field:"instanceId"`  // 媒介实例ID
 | 
				
			||||||
	User        string `field:"user"`        // 接收用户标识
 | 
						User        string   `field:"user"`        // 接收用户标识
 | 
				
			||||||
	Subject     string `field:"subject"`     // 标题
 | 
						Subject     string   `field:"subject"`     // 标题
 | 
				
			||||||
	Body        string `field:"body"`        // 内容
 | 
						Body        string   `field:"body"`        // 内容
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	Status      uint8  `field:"status"`      // 发送状态
 | 
						Status      uint8    `field:"status"`      // 发送状态
 | 
				
			||||||
	SentAt      uint64 `field:"sentAt"`      // 最后一次发送时间
 | 
						SentAt      uint64   `field:"sentAt"`      // 最后一次发送时间
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	Result      string `field:"result"`      // 结果
 | 
						Result      dbs.JSON `field:"result"`      // 结果
 | 
				
			||||||
	Day         string `field:"day"`         // YYYYMMDD
 | 
						Day         string   `field:"day"`         // YYYYMMDD
 | 
				
			||||||
	IsPrimary   uint8  `field:"isPrimary"`   // 是否优先
 | 
						IsPrimary   uint8    `field:"isPrimary"`   // 是否优先
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MessageTaskOperator struct {
 | 
					type MessageTaskOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,20 +1,22 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MetricChart 指标图表
 | 
					// MetricChart 指标图表
 | 
				
			||||||
type MetricChart struct {
 | 
					type MetricChart struct {
 | 
				
			||||||
	Id              uint32 `field:"id"`              // ID
 | 
						Id              uint32   `field:"id"`              // ID
 | 
				
			||||||
	ItemId          uint32 `field:"itemId"`          // 指标ID
 | 
						ItemId          uint32   `field:"itemId"`          // 指标ID
 | 
				
			||||||
	Name            string `field:"name"`            // 名称
 | 
						Name            string   `field:"name"`            // 名称
 | 
				
			||||||
	Code            string `field:"code"`            // 代号
 | 
						Code            string   `field:"code"`            // 代号
 | 
				
			||||||
	Type            string `field:"type"`            // 图形类型
 | 
						Type            string   `field:"type"`            // 图形类型
 | 
				
			||||||
	WidthDiv        int32  `field:"widthDiv"`        // 宽度划分
 | 
						WidthDiv        int32    `field:"widthDiv"`        // 宽度划分
 | 
				
			||||||
	Params          string `field:"params"`          // 图形参数
 | 
						Params          dbs.JSON `field:"params"`          // 图形参数
 | 
				
			||||||
	Order           uint32 `field:"order"`           // 排序
 | 
						Order           uint32   `field:"order"`           // 排序
 | 
				
			||||||
	IsOn            uint8  `field:"isOn"`            // 是否启用
 | 
						IsOn            uint8    `field:"isOn"`            // 是否启用
 | 
				
			||||||
	State           uint8  `field:"state"`           // 状态
 | 
						State           uint8    `field:"state"`           // 状态
 | 
				
			||||||
	MaxItems        uint32 `field:"maxItems"`        // 最多条目
 | 
						MaxItems        uint32   `field:"maxItems"`        // 最多条目
 | 
				
			||||||
	IgnoreEmptyKeys uint8  `field:"ignoreEmptyKeys"` // 忽略空的键值
 | 
						IgnoreEmptyKeys uint8    `field:"ignoreEmptyKeys"` // 忽略空的键值
 | 
				
			||||||
	IgnoredKeys     string `field:"ignoredKeys"`     // 忽略键值
 | 
						IgnoredKeys     dbs.JSON `field:"ignoredKeys"`     // 忽略键值
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MetricChartOperator struct {
 | 
					type MetricChartOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,23 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MetricItem 指标定义
 | 
					// MetricItem 指标定义
 | 
				
			||||||
type MetricItem struct {
 | 
					type MetricItem struct {
 | 
				
			||||||
	Id         uint64 `field:"id"`         // ID
 | 
						Id         uint64   `field:"id"`         // ID
 | 
				
			||||||
	IsOn       uint8  `field:"isOn"`       // 是否启用
 | 
						IsOn       uint8    `field:"isOn"`       // 是否启用
 | 
				
			||||||
	Code       string `field:"code"`       // 代号(用来区分是否内置)
 | 
						Code       string   `field:"code"`       // 代号(用来区分是否内置)
 | 
				
			||||||
	Category   string `field:"category"`   // 类型,比如http, tcp等
 | 
						Category   string   `field:"category"`   // 类型,比如http, tcp等
 | 
				
			||||||
	AdminId    uint32 `field:"adminId"`    // 管理员ID
 | 
						AdminId    uint32   `field:"adminId"`    // 管理员ID
 | 
				
			||||||
	UserId     uint32 `field:"userId"`     // 用户ID
 | 
						UserId     uint32   `field:"userId"`     // 用户ID
 | 
				
			||||||
	Name       string `field:"name"`       // 指标名称
 | 
						Name       string   `field:"name"`       // 指标名称
 | 
				
			||||||
	Keys       string `field:"keys"`       // 统计的Key
 | 
						Keys       dbs.JSON `field:"keys"`       // 统计的Key
 | 
				
			||||||
	Period     uint32 `field:"period"`     // 周期
 | 
						Period     uint32   `field:"period"`     // 周期
 | 
				
			||||||
	PeriodUnit string `field:"periodUnit"` // 周期单位
 | 
						PeriodUnit string   `field:"periodUnit"` // 周期单位
 | 
				
			||||||
	Value      string `field:"value"`      // 值运算
 | 
						Value      string   `field:"value"`      // 值运算
 | 
				
			||||||
	State      uint8  `field:"state"`      // 状态
 | 
						State      uint8    `field:"state"`      // 状态
 | 
				
			||||||
	Version    uint32 `field:"version"`    // 版本号
 | 
						Version    uint32   `field:"version"`    // 版本号
 | 
				
			||||||
	IsPublic   uint8  `field:"isPublic"`   // 是否为公用
 | 
						IsPublic   uint8    `field:"isPublic"`   // 是否为公用
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MetricItemOperator struct {
 | 
					type MetricItemOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,18 +1,20 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MetricStat 指标统计数据
 | 
					// MetricStat 指标统计数据
 | 
				
			||||||
type MetricStat struct {
 | 
					type MetricStat struct {
 | 
				
			||||||
	Id         uint64  `field:"id"`         // ID
 | 
						Id         uint64   `field:"id"`         // ID
 | 
				
			||||||
	Hash       string  `field:"hash"`       // Hash值
 | 
						Hash       string   `field:"hash"`       // Hash值
 | 
				
			||||||
	ClusterId  uint32  `field:"clusterId"`  // 集群ID
 | 
						ClusterId  uint32   `field:"clusterId"`  // 集群ID
 | 
				
			||||||
	NodeId     uint32  `field:"nodeId"`     // 节点ID
 | 
						NodeId     uint32   `field:"nodeId"`     // 节点ID
 | 
				
			||||||
	ServerId   uint32  `field:"serverId"`   // 服务ID
 | 
						ServerId   uint32   `field:"serverId"`   // 服务ID
 | 
				
			||||||
	ItemId     uint64  `field:"itemId"`     // 指标
 | 
						ItemId     uint64   `field:"itemId"`     // 指标
 | 
				
			||||||
	Keys       string  `field:"keys"`       // 键值
 | 
						Keys       dbs.JSON `field:"keys"`       // 键值
 | 
				
			||||||
	Value      float64 `field:"value"`      // 数值
 | 
						Value      float64  `field:"value"`      // 数值
 | 
				
			||||||
	Time       string  `field:"time"`       // 分钟值YYYYMMDDHHII
 | 
						Time       string   `field:"time"`       // 分钟值YYYYMMDDHHII
 | 
				
			||||||
	Version    uint32  `field:"version"`    // 版本号
 | 
						Version    uint32   `field:"version"`    // 版本号
 | 
				
			||||||
	CreatedDay string  `field:"createdDay"` // YYYYMMDD
 | 
						CreatedDay string   `field:"createdDay"` // YYYYMMDD
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MetricStatOperator struct {
 | 
					type MetricStatOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,21 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 监控节点
 | 
					// 监控节点
 | 
				
			||||||
type MonitorNode struct {
 | 
					type MonitorNode struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	UniqueId    string `field:"uniqueId"`    // 唯一ID
 | 
						UniqueId    string   `field:"uniqueId"`    // 唯一ID
 | 
				
			||||||
	Secret      string `field:"secret"`      // 密钥
 | 
						Secret      string   `field:"secret"`      // 密钥
 | 
				
			||||||
	Name        string `field:"name"`        // 名称
 | 
						Name        string   `field:"name"`        // 名称
 | 
				
			||||||
	Description string `field:"description"` // 描述
 | 
						Description string   `field:"description"` // 描述
 | 
				
			||||||
	Order       uint32 `field:"order"`       // 排序
 | 
						Order       uint32   `field:"order"`       // 排序
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	AdminId     uint32 `field:"adminId"`     // 管理员ID
 | 
						AdminId     uint32   `field:"adminId"`     // 管理员ID
 | 
				
			||||||
	Weight      uint32 `field:"weight"`      // 权重
 | 
						Weight      uint32   `field:"weight"`      // 权重
 | 
				
			||||||
	Status      string `field:"status"`      // 运行状态
 | 
						Status      dbs.JSON `field:"status"`      // 运行状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MonitorNodeOperator struct {
 | 
					type MonitorNodeOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,18 @@
 | 
				
			|||||||
package nameservers
 | 
					package nameservers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSDomain DNS域名
 | 
					// NSDomain DNS域名
 | 
				
			||||||
type NSDomain struct {
 | 
					type NSDomain struct {
 | 
				
			||||||
	Id        uint32 `field:"id"`        // ID
 | 
						Id        uint32   `field:"id"`        // ID
 | 
				
			||||||
	ClusterId uint32 `field:"clusterId"` // 集群ID
 | 
						ClusterId uint32   `field:"clusterId"` // 集群ID
 | 
				
			||||||
	UserId    uint32 `field:"userId"`    // 用户ID
 | 
						UserId    uint32   `field:"userId"`    // 用户ID
 | 
				
			||||||
	IsOn      uint8  `field:"isOn"`      // 是否启用
 | 
						IsOn      uint8    `field:"isOn"`      // 是否启用
 | 
				
			||||||
	Name      string `field:"name"`      // 域名
 | 
						Name      string   `field:"name"`      // 域名
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
	Version   uint64 `field:"version"`   // 版本
 | 
						Version   uint64   `field:"version"`   // 版本
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
	Tsig      string `field:"tsig"`      // TSIG配置
 | 
						Tsig      dbs.JSON `field:"tsig"`      // TSIG配置
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NSDomainOperator struct {
 | 
					type NSDomainOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,13 @@
 | 
				
			|||||||
package nameservers
 | 
					package nameservers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSQuestionOption DNS请求选项
 | 
					// NSQuestionOption DNS请求选项
 | 
				
			||||||
type NSQuestionOption struct {
 | 
					type NSQuestionOption struct {
 | 
				
			||||||
	Id        uint64 `field:"id"`        // ID
 | 
						Id        uint64   `field:"id"`        // ID
 | 
				
			||||||
	Name      string `field:"name"`      // 选项名
 | 
						Name      string   `field:"name"`      // 选项名
 | 
				
			||||||
	Values    string `field:"values"`    // 选项值
 | 
						Values    dbs.JSON `field:"values"`    // 选项值
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NSQuestionOptionOperator struct {
 | 
					type NSQuestionOptionOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,17 +13,17 @@ func TestNSRecord_DecodeRouteIds(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		record := &NSRecord{RouteIds: "[]"}
 | 
							record := &NSRecord{RouteIds: []byte("[]")}
 | 
				
			||||||
		t.Log(record.DecodeRouteIds())
 | 
							t.Log(record.DecodeRouteIds())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		record := &NSRecord{RouteIds: "[1, 2, 3]"}
 | 
							record := &NSRecord{RouteIds: []byte("[1, 2, 3]")}
 | 
				
			||||||
		t.Log(record.DecodeRouteIds())
 | 
							t.Log(record.DecodeRouteIds())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		record := &NSRecord{RouteIds: `["id:1", "id:2", "isp:liantong"]`}
 | 
							record := &NSRecord{RouteIds: []byte(`["id:1", "id:2", "isp:liantong"]`)}
 | 
				
			||||||
		t.Log(record.DecodeRouteIds())
 | 
							t.Log(record.DecodeRouteIds())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,20 +1,22 @@
 | 
				
			|||||||
package nameservers
 | 
					package nameservers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSRecord DNS记录
 | 
					// NSRecord DNS记录
 | 
				
			||||||
type NSRecord struct {
 | 
					type NSRecord struct {
 | 
				
			||||||
	Id          uint64 `field:"id"`          // ID
 | 
						Id          uint64   `field:"id"`          // ID
 | 
				
			||||||
	DomainId    uint32 `field:"domainId"`    // 域名ID
 | 
						DomainId    uint32   `field:"domainId"`    // 域名ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	Description string `field:"description"` // 备注
 | 
						Description string   `field:"description"` // 备注
 | 
				
			||||||
	Name        string `field:"name"`        // 记录名
 | 
						Name        string   `field:"name"`        // 记录名
 | 
				
			||||||
	Type        string `field:"type"`        // 类型
 | 
						Type        string   `field:"type"`        // 类型
 | 
				
			||||||
	Value       string `field:"value"`       // 值
 | 
						Value       string   `field:"value"`       // 值
 | 
				
			||||||
	Ttl         uint32 `field:"ttl"`         // TTL(秒)
 | 
						Ttl         uint32   `field:"ttl"`         // TTL(秒)
 | 
				
			||||||
	Weight      uint32 `field:"weight"`      // 权重
 | 
						Weight      uint32   `field:"weight"`      // 权重
 | 
				
			||||||
	RouteIds    string `field:"routeIds"`    // 线路
 | 
						RouteIds    dbs.JSON `field:"routeIds"`    // 线路
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	Version     uint64 `field:"version"`     //
 | 
						Version     uint64   `field:"version"`     //
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NSRecordOperator struct {
 | 
					type NSRecordOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,18 +1,20 @@
 | 
				
			|||||||
package nameservers
 | 
					package nameservers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSRoute DNS线路
 | 
					// NSRoute DNS线路
 | 
				
			||||||
type NSRoute struct {
 | 
					type NSRoute struct {
 | 
				
			||||||
	Id        uint32 `field:"id"`        // ID
 | 
						Id        uint32   `field:"id"`        // ID
 | 
				
			||||||
	IsOn      uint8  `field:"isOn"`      // 是否启用
 | 
						IsOn      uint8    `field:"isOn"`      // 是否启用
 | 
				
			||||||
	ClusterId uint32 `field:"clusterId"` // 集群ID
 | 
						ClusterId uint32   `field:"clusterId"` // 集群ID
 | 
				
			||||||
	DomainId  uint32 `field:"domainId"`  // 域名ID
 | 
						DomainId  uint32   `field:"domainId"`  // 域名ID
 | 
				
			||||||
	UserId    uint32 `field:"userId"`    // 用户ID
 | 
						UserId    uint32   `field:"userId"`    // 用户ID
 | 
				
			||||||
	Name      string `field:"name"`      // 名称
 | 
						Name      string   `field:"name"`      // 名称
 | 
				
			||||||
	Ranges    string `field:"ranges"`    // 范围
 | 
						Ranges    dbs.JSON `field:"ranges"`    // 范围
 | 
				
			||||||
	Order     uint32 `field:"order"`     // 排序
 | 
						Order     uint32   `field:"order"`     // 排序
 | 
				
			||||||
	Version   uint64 `field:"version"`   // 版本号
 | 
						Version   uint64   `field:"version"`   // 版本号
 | 
				
			||||||
	Code      string `field:"code"`      // 代号
 | 
						Code      string   `field:"code"`      // 代号
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NSRouteOperator struct {
 | 
					type NSRouteOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,16 @@
 | 
				
			|||||||
package nameservers
 | 
					package nameservers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSZone 域名子域
 | 
					// NSZone 域名子域
 | 
				
			||||||
type NSZone struct {
 | 
					type NSZone struct {
 | 
				
			||||||
	Id       uint64 `field:"id"`       // ID
 | 
						Id       uint64   `field:"id"`       // ID
 | 
				
			||||||
	DomainId uint64 `field:"domainId"` // 域名ID
 | 
						DomainId uint64   `field:"domainId"` // 域名ID
 | 
				
			||||||
	IsOn     uint8  `field:"isOn"`     // 是否启用
 | 
						IsOn     uint8    `field:"isOn"`     // 是否启用
 | 
				
			||||||
	Order    uint32 `field:"order"`    // 排序
 | 
						Order    uint32   `field:"order"`    // 排序
 | 
				
			||||||
	Version  uint64 `field:"version"`  // 版本
 | 
						Version  uint64   `field:"version"`  // 版本
 | 
				
			||||||
	Tsig     string `field:"tsig"`     // TSIG配置
 | 
						Tsig     dbs.JSON `field:"tsig"`     // TSIG配置
 | 
				
			||||||
	State    uint8  `field:"state"`    // 状态
 | 
						State    uint8    `field:"state"`    // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NSZoneOperator struct {
 | 
					type NSZoneOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -279,7 +279,7 @@ func (this *NodeClusterDAO) FindAllAPINodeAddrsWithCluster(tx *dbs.Tx, clusterId
 | 
				
			|||||||
	if !IsNotNull(cluster.ApiNodes) {
 | 
						if !IsNotNull(cluster.ApiNodes) {
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err = json.Unmarshal([]byte(cluster.ApiNodes), &apiNodeIds)
 | 
						err = json.Unmarshal(cluster.ApiNodes, &apiNodeIds)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -526,7 +526,7 @@ func (this *NodeClusterDAO) FindClusterTOAConfig(tx *dbs.Tx, clusterId int64, ca
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !IsNotNull(toa) {
 | 
						if !IsNotNull([]byte(toa)) {
 | 
				
			||||||
		return nodeconfigs.DefaultTOAConfig(), nil
 | 
							return nodeconfigs.DefaultTOAConfig(), nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -719,16 +719,16 @@ func (this *NodeClusterDAO) UpdateNodeClusterSystemService(tx *dbs.Tx, clusterId
 | 
				
			|||||||
	if clusterId <= 0 {
 | 
						if clusterId <= 0 {
 | 
				
			||||||
		return errors.New("invalid clusterId")
 | 
							return errors.New("invalid clusterId")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	service, err := this.Query(tx).
 | 
						serviceData, err := this.Query(tx).
 | 
				
			||||||
		Pk(clusterId).
 | 
							Pk(clusterId).
 | 
				
			||||||
		Result("systemServices").
 | 
							Result("systemServices").
 | 
				
			||||||
		FindStringCol("")
 | 
							FindBytesCol()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	servicesMap := map[string]maps.Map{}
 | 
						servicesMap := map[string]maps.Map{}
 | 
				
			||||||
	if IsNotNull(service) {
 | 
						if IsNotNull(serviceData) {
 | 
				
			||||||
		err = json.Unmarshal([]byte(service), &servicesMap)
 | 
							err = json.Unmarshal(serviceData, &servicesMap)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -766,7 +766,7 @@ func (this *NodeClusterDAO) FindNodeClusterSystemServiceParams(tx *dbs.Tx, clust
 | 
				
			|||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	servicesMap := map[string]maps.Map{}
 | 
						servicesMap := map[string]maps.Map{}
 | 
				
			||||||
	if IsNotNull(service) {
 | 
						if IsNotNull([]byte(service)) {
 | 
				
			||||||
		err = json.Unmarshal([]byte(service), &servicesMap)
 | 
							err = json.Unmarshal([]byte(service), &servicesMap)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
@@ -797,7 +797,7 @@ func (this *NodeClusterDAO) FindNodeClusterSystemServices(tx *dbs.Tx, clusterId
 | 
				
			|||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	servicesMap := map[string]maps.Map{}
 | 
						servicesMap := map[string]maps.Map{}
 | 
				
			||||||
	if IsNotNull(service) {
 | 
						if IsNotNull([]byte(service)) {
 | 
				
			||||||
		err = json.Unmarshal([]byte(service), &servicesMap)
 | 
							err = json.Unmarshal([]byte(service), &servicesMap)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,17 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 防火墙动作
 | 
					// 防火墙动作
 | 
				
			||||||
type NodeClusterFirewallAction struct {
 | 
					type NodeClusterFirewallAction struct {
 | 
				
			||||||
	Id         uint32 `field:"id"`         // ID
 | 
						Id         uint32   `field:"id"`         // ID
 | 
				
			||||||
	AdminId    uint32 `field:"adminId"`    // 管理员ID
 | 
						AdminId    uint32   `field:"adminId"`    // 管理员ID
 | 
				
			||||||
	ClusterId  uint32 `field:"clusterId"`  // 集群ID
 | 
						ClusterId  uint32   `field:"clusterId"`  // 集群ID
 | 
				
			||||||
	Name       string `field:"name"`       // 名称
 | 
						Name       string   `field:"name"`       // 名称
 | 
				
			||||||
	EventLevel string `field:"eventLevel"` // 级别
 | 
						EventLevel string   `field:"eventLevel"` // 级别
 | 
				
			||||||
	Type       string `field:"type"`       // 动作类型
 | 
						Type       string   `field:"type"`       // 动作类型
 | 
				
			||||||
	Params     string `field:"params"`     // 参数
 | 
						Params     dbs.JSON `field:"params"`     // 参数
 | 
				
			||||||
	State      uint8  `field:"state"`      // 状态
 | 
						State      uint8    `field:"state"`      // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeClusterFirewallActionOperator struct {
 | 
					type NodeClusterFirewallActionOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,36 +1,38 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NodeCluster 节点集群
 | 
					// NodeCluster 节点集群
 | 
				
			||||||
type NodeCluster struct {
 | 
					type NodeCluster struct {
 | 
				
			||||||
	Id                    uint32 `field:"id"`                    // ID
 | 
						Id                    uint32   `field:"id"`                    // ID
 | 
				
			||||||
	AdminId               uint32 `field:"adminId"`               // 管理员ID
 | 
						AdminId               uint32   `field:"adminId"`               // 管理员ID
 | 
				
			||||||
	UserId                uint32 `field:"userId"`                // 用户ID
 | 
						UserId                uint32   `field:"userId"`                // 用户ID
 | 
				
			||||||
	IsOn                  uint8  `field:"isOn"`                  // 是否启用
 | 
						IsOn                  uint8    `field:"isOn"`                  // 是否启用
 | 
				
			||||||
	Name                  string `field:"name"`                  // 名称
 | 
						Name                  string   `field:"name"`                  // 名称
 | 
				
			||||||
	UseAllAPINodes        uint8  `field:"useAllAPINodes"`        // 是否使用所有API节点
 | 
						UseAllAPINodes        uint8    `field:"useAllAPINodes"`        // 是否使用所有API节点
 | 
				
			||||||
	ApiNodes              string `field:"apiNodes"`              // 使用的API节点
 | 
						ApiNodes              dbs.JSON `field:"apiNodes"`              // 使用的API节点
 | 
				
			||||||
	InstallDir            string `field:"installDir"`            // 安装目录
 | 
						InstallDir            string   `field:"installDir"`            // 安装目录
 | 
				
			||||||
	Order                 uint32 `field:"order"`                 // 排序
 | 
						Order                 uint32   `field:"order"`                 // 排序
 | 
				
			||||||
	CreatedAt             uint64 `field:"createdAt"`             // 创建时间
 | 
						CreatedAt             uint64   `field:"createdAt"`             // 创建时间
 | 
				
			||||||
	GrantId               uint32 `field:"grantId"`               // 默认认证方式
 | 
						GrantId               uint32   `field:"grantId"`               // 默认认证方式
 | 
				
			||||||
	State                 uint8  `field:"state"`                 // 状态
 | 
						State                 uint8    `field:"state"`                 // 状态
 | 
				
			||||||
	AutoRegister          uint8  `field:"autoRegister"`          // 是否开启自动注册
 | 
						AutoRegister          uint8    `field:"autoRegister"`          // 是否开启自动注册
 | 
				
			||||||
	UniqueId              string `field:"uniqueId"`              // 唯一ID
 | 
						UniqueId              string   `field:"uniqueId"`              // 唯一ID
 | 
				
			||||||
	Secret                string `field:"secret"`                // 密钥
 | 
						Secret                string   `field:"secret"`                // 密钥
 | 
				
			||||||
	HealthCheck           string `field:"healthCheck"`           // 健康检查
 | 
						HealthCheck           dbs.JSON `field:"healthCheck"`           // 健康检查
 | 
				
			||||||
	DnsName               string `field:"dnsName"`               // DNS名称
 | 
						DnsName               string   `field:"dnsName"`               // DNS名称
 | 
				
			||||||
	DnsDomainId           uint32 `field:"dnsDomainId"`           // 域名ID
 | 
						DnsDomainId           uint32   `field:"dnsDomainId"`           // 域名ID
 | 
				
			||||||
	Dns                   string `field:"dns"`                   // DNS配置
 | 
						Dns                   dbs.JSON `field:"dns"`                   // DNS配置
 | 
				
			||||||
	Toa                   string `field:"toa"`                   // TOA配置
 | 
						Toa                   dbs.JSON `field:"toa"`                   // TOA配置
 | 
				
			||||||
	CachePolicyId         uint32 `field:"cachePolicyId"`         // 缓存策略ID
 | 
						CachePolicyId         uint32   `field:"cachePolicyId"`         // 缓存策略ID
 | 
				
			||||||
	HttpFirewallPolicyId  uint32 `field:"httpFirewallPolicyId"`  // WAF策略ID
 | 
						HttpFirewallPolicyId  uint32   `field:"httpFirewallPolicyId"`  // WAF策略ID
 | 
				
			||||||
	AccessLog             string `field:"accessLog"`             // 访问日志设置
 | 
						AccessLog             dbs.JSON `field:"accessLog"`             // 访问日志设置
 | 
				
			||||||
	SystemServices        string `field:"systemServices"`        // 系统服务设置
 | 
						SystemServices        dbs.JSON `field:"systemServices"`        // 系统服务设置
 | 
				
			||||||
	TimeZone              string `field:"timeZone"`              // 时区
 | 
						TimeZone              string   `field:"timeZone"`              // 时区
 | 
				
			||||||
	NodeMaxThreads        uint32 `field:"nodeMaxThreads"`        // 节点最大线程数
 | 
						NodeMaxThreads        uint32   `field:"nodeMaxThreads"`        // 节点最大线程数
 | 
				
			||||||
	NodeTCPMaxConnections uint32 `field:"nodeTCPMaxConnections"` // TCP最大连接数
 | 
						NodeTCPMaxConnections uint32   `field:"nodeTCPMaxConnections"` // TCP最大连接数
 | 
				
			||||||
	AutoOpenPorts         uint8  `field:"autoOpenPorts"`         // 是否自动尝试开放端口
 | 
						AutoOpenPorts         uint8    `field:"autoOpenPorts"`         // 是否自动尝试开放端口
 | 
				
			||||||
	IsPinned              uint8  `field:"isPinned"`              // 是否置顶
 | 
						IsPinned              uint8    `field:"isPinned"`              // 是否置顶
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeClusterOperator struct {
 | 
					type NodeClusterOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeDNSConfig 解析DNS配置
 | 
					// DecodeDNSConfig 解析DNS配置
 | 
				
			||||||
func (this *NodeCluster) DecodeDNSConfig() (*dnsconfigs.ClusterDNSConfig, error) {
 | 
					func (this *NodeCluster) DecodeDNSConfig() (*dnsconfigs.ClusterDNSConfig, error) {
 | 
				
			||||||
	if len(this.Dns) == 0 || this.Dns == "null" {
 | 
						if len(this.Dns) == 0 {
 | 
				
			||||||
		// 一定要返回一个默认的值,防止产生nil
 | 
							// 一定要返回一个默认的值,防止产生nil
 | 
				
			||||||
		return &dnsconfigs.ClusterDNSConfig{
 | 
							return &dnsconfigs.ClusterDNSConfig{
 | 
				
			||||||
			NodesAutoSync:   false,
 | 
								NodesAutoSync:   false,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,26 +1,28 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NodeIPAddress 节点IP地址
 | 
					// NodeIPAddress 节点IP地址
 | 
				
			||||||
type NodeIPAddress struct {
 | 
					type NodeIPAddress struct {
 | 
				
			||||||
	Id                uint32 `field:"id"`                // ID
 | 
						Id                uint32   `field:"id"`                // ID
 | 
				
			||||||
	NodeId            uint32 `field:"nodeId"`            // 节点ID
 | 
						NodeId            uint32   `field:"nodeId"`            // 节点ID
 | 
				
			||||||
	Role              string `field:"role"`              // 节点角色
 | 
						Role              string   `field:"role"`              // 节点角色
 | 
				
			||||||
	GroupId           uint32 `field:"groupId"`           // 所属分组ID
 | 
						GroupId           uint32   `field:"groupId"`           // 所属分组ID
 | 
				
			||||||
	Name              string `field:"name"`              // 名称
 | 
						Name              string   `field:"name"`              // 名称
 | 
				
			||||||
	Ip                string `field:"ip"`                // IP地址
 | 
						Ip                string   `field:"ip"`                // IP地址
 | 
				
			||||||
	Description       string `field:"description"`       // 描述
 | 
						Description       string   `field:"description"`       // 描述
 | 
				
			||||||
	State             uint8  `field:"state"`             // 状态
 | 
						State             uint8    `field:"state"`             // 状态
 | 
				
			||||||
	Order             uint32 `field:"order"`             // 排序
 | 
						Order             uint32   `field:"order"`             // 排序
 | 
				
			||||||
	CanAccess         uint8  `field:"canAccess"`         // 是否可以访问
 | 
						CanAccess         uint8    `field:"canAccess"`         // 是否可以访问
 | 
				
			||||||
	IsOn              uint8  `field:"isOn"`              // 是否启用
 | 
						IsOn              uint8    `field:"isOn"`              // 是否启用
 | 
				
			||||||
	IsUp              uint8  `field:"isUp"`              // 是否上线
 | 
						IsUp              uint8    `field:"isUp"`              // 是否上线
 | 
				
			||||||
	IsHealthy         uint8  `field:"isHealthy"`         // 是否健康
 | 
						IsHealthy         uint8    `field:"isHealthy"`         // 是否健康
 | 
				
			||||||
	Thresholds        string `field:"thresholds"`        // 上线阈值
 | 
						Thresholds        dbs.JSON `field:"thresholds"`        // 上线阈值
 | 
				
			||||||
	Connectivity      string `field:"connectivity"`      // 连通性状态
 | 
						Connectivity      dbs.JSON `field:"connectivity"`      // 连通性状态
 | 
				
			||||||
	BackupIP          string `field:"backupIP"`          // 备用IP
 | 
						BackupIP          string   `field:"backupIP"`          // 备用IP
 | 
				
			||||||
	BackupThresholdId uint32 `field:"backupThresholdId"` // 触发备用IP的阈值
 | 
						BackupThresholdId uint32   `field:"backupThresholdId"` // 触发备用IP的阈值
 | 
				
			||||||
	CountUp           uint32 `field:"countUp"`           // UP状态次数
 | 
						CountUp           uint32   `field:"countUp"`           // UP状态次数
 | 
				
			||||||
	CountDown         uint32 `field:"countDown"`         // DOWN状态次数
 | 
						CountDown         uint32   `field:"countDown"`         // DOWN状态次数
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeIPAddressOperator struct {
 | 
					type NodeIPAddressOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -230,7 +230,7 @@ func (this *NodeIPAddressThresholdDAO) formatThreshold(tx *dbs.Tx, threshold *No
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	threshold.Items = string(itemsJSON)
 | 
						threshold.Items = itemsJSON
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,17 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NodeIPAddressThreshold IP地址阈值
 | 
					// NodeIPAddressThreshold IP地址阈值
 | 
				
			||||||
type NodeIPAddressThreshold struct {
 | 
					type NodeIPAddressThreshold struct {
 | 
				
			||||||
	Id         uint64 `field:"id"`         // ID
 | 
						Id         uint64   `field:"id"`         // ID
 | 
				
			||||||
	AddressId  uint64 `field:"addressId"`  // IP地址ID
 | 
						AddressId  uint64   `field:"addressId"`  // IP地址ID
 | 
				
			||||||
	Items      string `field:"items"`      // 阈值条目
 | 
						Items      dbs.JSON `field:"items"`      // 阈值条目
 | 
				
			||||||
	Actions    string `field:"actions"`    // 动作
 | 
						Actions    dbs.JSON `field:"actions"`    // 动作
 | 
				
			||||||
	NotifiedAt uint64 `field:"notifiedAt"` // 上次通知时间
 | 
						NotifiedAt uint64   `field:"notifiedAt"` // 上次通知时间
 | 
				
			||||||
	IsMatched  uint8  `field:"isMatched"`  // 上次是否匹配
 | 
						IsMatched  uint8    `field:"isMatched"`  // 上次是否匹配
 | 
				
			||||||
	State      uint8  `field:"state"`      // 状态
 | 
						State      uint8    `field:"state"`      // 状态
 | 
				
			||||||
	Order      uint32 `field:"order"`      // 排序
 | 
						Order      uint32   `field:"order"`      // 排序
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeIPAddressThresholdOperator struct {
 | 
					type NodeIPAddressThresholdOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,23 +1,25 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NodeLog 节点日志
 | 
					// NodeLog 节点日志
 | 
				
			||||||
type NodeLog struct {
 | 
					type NodeLog struct {
 | 
				
			||||||
	Id          uint64 `field:"id"`          // ID
 | 
						Id          uint64   `field:"id"`          // ID
 | 
				
			||||||
	Role        string `field:"role"`        // 节点角色
 | 
						Role        string   `field:"role"`        // 节点角色
 | 
				
			||||||
	Type        string `field:"type"`        // 类型
 | 
						Type        string   `field:"type"`        // 类型
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	Tag         string `field:"tag"`         // 标签
 | 
						Tag         string   `field:"tag"`         // 标签
 | 
				
			||||||
	Description string `field:"description"` // 描述
 | 
						Description string   `field:"description"` // 描述
 | 
				
			||||||
	Level       string `field:"level"`       // 级别
 | 
						Level       string   `field:"level"`       // 级别
 | 
				
			||||||
	NodeId      uint32 `field:"nodeId"`      // 节点ID
 | 
						NodeId      uint32   `field:"nodeId"`      // 节点ID
 | 
				
			||||||
	Day         string `field:"day"`         // 日期
 | 
						Day         string   `field:"day"`         // 日期
 | 
				
			||||||
	ServerId    uint32 `field:"serverId"`    // 服务ID
 | 
						ServerId    uint32   `field:"serverId"`    // 服务ID
 | 
				
			||||||
	OriginId    uint32 `field:"originId"`    // 源站ID
 | 
						OriginId    uint32   `field:"originId"`    // 源站ID
 | 
				
			||||||
	Hash        string `field:"hash"`        // 信息内容Hash
 | 
						Hash        string   `field:"hash"`        // 信息内容Hash
 | 
				
			||||||
	Count       uint32 `field:"count"`       // 重复次数
 | 
						Count       uint32   `field:"count"`       // 重复次数
 | 
				
			||||||
	IsFixed     uint8  `field:"isFixed"`     // 是否已处理
 | 
						IsFixed     uint8    `field:"isFixed"`     // 是否已处理
 | 
				
			||||||
	IsRead      uint8  `field:"isRead"`      // 是否已读
 | 
						IsRead      uint8    `field:"isRead"`      // 是否已读
 | 
				
			||||||
	Params      string `field:"params"`      // 参数
 | 
						Params      dbs.JSON `field:"params"`      // 参数
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeLogOperator struct {
 | 
					type NodeLogOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,16 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NodeLogin 节点登录信息
 | 
					// NodeLogin 节点登录信息
 | 
				
			||||||
type NodeLogin struct {
 | 
					type NodeLogin struct {
 | 
				
			||||||
	Id     uint32 `field:"id"`     // ID
 | 
						Id     uint32   `field:"id"`     // ID
 | 
				
			||||||
	NodeId uint32 `field:"nodeId"` // 节点ID
 | 
						NodeId uint32   `field:"nodeId"` // 节点ID
 | 
				
			||||||
	Role   string `field:"role"`   // 角色
 | 
						Role   string   `field:"role"`   // 角色
 | 
				
			||||||
	Name   string `field:"name"`   // 名称
 | 
						Name   string   `field:"name"`   // 名称
 | 
				
			||||||
	Type   string `field:"type"`   // 类型:ssh,agent
 | 
						Type   string   `field:"type"`   // 类型:ssh,agent
 | 
				
			||||||
	Params string `field:"params"` // 配置参数
 | 
						Params dbs.JSON `field:"params"` // 配置参数
 | 
				
			||||||
	State  uint8  `field:"state"`  // 状态
 | 
						State  uint8    `field:"state"`  // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeLoginOperator struct {
 | 
					type NodeLoginOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,13 +5,13 @@ import (
 | 
				
			|||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 解析SSH登录参数
 | 
					// DecodeSSHParams 解析SSH登录参数
 | 
				
			||||||
func (this *NodeLogin) DecodeSSHParams() (*NodeLoginSSHParams, error) {
 | 
					func (this *NodeLogin) DecodeSSHParams() (*NodeLoginSSHParams, error) {
 | 
				
			||||||
	if this.Type != NodeLoginTypeSSH {
 | 
						if this.Type != NodeLoginTypeSSH {
 | 
				
			||||||
		return nil, errors.New("invalid login type '" + this.Type + "'")
 | 
							return nil, errors.New("invalid login type '" + this.Type + "'")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(this.Params) == 0 || this.Params == "null" {
 | 
						if len(this.Params) == 0 {
 | 
				
			||||||
		return nil, errors.New("'params' should not be empty")
 | 
							return nil, errors.New("'params' should not be empty")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,37 +1,39 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Node 节点
 | 
					// Node 节点
 | 
				
			||||||
type Node struct {
 | 
					type Node struct {
 | 
				
			||||||
	Id                     uint32 `field:"id"`                     // ID
 | 
						Id                     uint32   `field:"id"`                     // ID
 | 
				
			||||||
	AdminId                uint32 `field:"adminId"`                // 管理员ID
 | 
						AdminId                uint32   `field:"adminId"`                // 管理员ID
 | 
				
			||||||
	UserId                 uint32 `field:"userId"`                 // 用户ID
 | 
						UserId                 uint32   `field:"userId"`                 // 用户ID
 | 
				
			||||||
	IsOn                   uint8  `field:"isOn"`                   // 是否启用
 | 
						IsOn                   uint8    `field:"isOn"`                   // 是否启用
 | 
				
			||||||
	IsUp                   uint8  `field:"isUp"`                   // 是否在线
 | 
						IsUp                   uint8    `field:"isUp"`                   // 是否在线
 | 
				
			||||||
	CountUp                uint32 `field:"countUp"`                // 连续在线次数
 | 
						CountUp                uint32   `field:"countUp"`                // 连续在线次数
 | 
				
			||||||
	CountDown              uint32 `field:"countDown"`              // 连续下线次数
 | 
						CountDown              uint32   `field:"countDown"`              // 连续下线次数
 | 
				
			||||||
	IsActive               uint8  `field:"isActive"`               // 是否活跃
 | 
						IsActive               uint8    `field:"isActive"`               // 是否活跃
 | 
				
			||||||
	UniqueId               string `field:"uniqueId"`               // 节点ID
 | 
						UniqueId               string   `field:"uniqueId"`               // 节点ID
 | 
				
			||||||
	Secret                 string `field:"secret"`                 // 密钥
 | 
						Secret                 string   `field:"secret"`                 // 密钥
 | 
				
			||||||
	Name                   string `field:"name"`                   // 节点名
 | 
						Name                   string   `field:"name"`                   // 节点名
 | 
				
			||||||
	Code                   string `field:"code"`                   // 代号
 | 
						Code                   string   `field:"code"`                   // 代号
 | 
				
			||||||
	ClusterId              uint32 `field:"clusterId"`              // 主集群ID
 | 
						ClusterId              uint32   `field:"clusterId"`              // 主集群ID
 | 
				
			||||||
	SecondaryClusterIds    string `field:"secondaryClusterIds"`    // 从集群ID
 | 
						SecondaryClusterIds    dbs.JSON `field:"secondaryClusterIds"`    // 从集群ID
 | 
				
			||||||
	RegionId               uint32 `field:"regionId"`               // 区域ID
 | 
						RegionId               uint32   `field:"regionId"`               // 区域ID
 | 
				
			||||||
	GroupId                uint32 `field:"groupId"`                // 分组ID
 | 
						GroupId                uint32   `field:"groupId"`                // 分组ID
 | 
				
			||||||
	CreatedAt              uint64 `field:"createdAt"`              // 创建时间
 | 
						CreatedAt              uint64   `field:"createdAt"`              // 创建时间
 | 
				
			||||||
	Status                 string `field:"status"`                 // 最新的状态
 | 
						Status                 dbs.JSON `field:"status"`                 // 最新的状态
 | 
				
			||||||
	Version                uint32 `field:"version"`                // 当前版本号
 | 
						Version                uint32   `field:"version"`                // 当前版本号
 | 
				
			||||||
	LatestVersion          uint32 `field:"latestVersion"`          // 最后版本号
 | 
						LatestVersion          uint32   `field:"latestVersion"`          // 最后版本号
 | 
				
			||||||
	InstallDir             string `field:"installDir"`             // 安装目录
 | 
						InstallDir             string   `field:"installDir"`             // 安装目录
 | 
				
			||||||
	IsInstalled            uint8  `field:"isInstalled"`            // 是否已安装
 | 
						IsInstalled            uint8    `field:"isInstalled"`            // 是否已安装
 | 
				
			||||||
	InstallStatus          string `field:"installStatus"`          // 安装状态
 | 
						InstallStatus          dbs.JSON `field:"installStatus"`          // 安装状态
 | 
				
			||||||
	State                  uint8  `field:"state"`                  // 状态
 | 
						State                  uint8    `field:"state"`                  // 状态
 | 
				
			||||||
	ConnectedAPINodes      string `field:"connectedAPINodes"`      // 当前连接的API节点
 | 
						ConnectedAPINodes      dbs.JSON `field:"connectedAPINodes"`      // 当前连接的API节点
 | 
				
			||||||
	MaxCPU                 uint32 `field:"maxCPU"`                 // 可以使用的最多CPU
 | 
						MaxCPU                 uint32   `field:"maxCPU"`                 // 可以使用的最多CPU
 | 
				
			||||||
	DnsRoutes              string `field:"dnsRoutes"`              // DNS线路设置
 | 
						DnsRoutes              dbs.JSON `field:"dnsRoutes"`              // DNS线路设置
 | 
				
			||||||
	MaxCacheDiskCapacity   string `field:"maxCacheDiskCapacity"`   // 硬盘缓存容量
 | 
						MaxCacheDiskCapacity   dbs.JSON `field:"maxCacheDiskCapacity"`   // 硬盘缓存容量
 | 
				
			||||||
	MaxCacheMemoryCapacity string `field:"maxCacheMemoryCapacity"` // 内存缓存容量
 | 
						MaxCacheMemoryCapacity dbs.JSON `field:"maxCacheMemoryCapacity"` // 内存缓存容量
 | 
				
			||||||
	CacheDiskDir           string `field:"cacheDiskDir"`           // 缓存目录
 | 
						CacheDiskDir           string   `field:"cacheDiskDir"`           // 缓存目录
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeOperator struct {
 | 
					type NodeOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeInstallStatus 安装状态
 | 
					// DecodeInstallStatus 安装状态
 | 
				
			||||||
func (this *Node) DecodeInstallStatus() (*NodeInstallStatus, error) {
 | 
					func (this *Node) DecodeInstallStatus() (*NodeInstallStatus, error) {
 | 
				
			||||||
	if len(this.InstallStatus) == 0 || this.InstallStatus == "null" {
 | 
						if len(this.InstallStatus) == 0 {
 | 
				
			||||||
		return NewNodeInstallStatus(), nil
 | 
							return NewNodeInstallStatus(), nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	status := &NodeInstallStatus{}
 | 
						status := &NodeInstallStatus{}
 | 
				
			||||||
@@ -30,7 +30,7 @@ func (this *Node) DecodeInstallStatus() (*NodeInstallStatus, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeStatus 节点状态
 | 
					// DecodeStatus 节点状态
 | 
				
			||||||
func (this *Node) DecodeStatus() (*nodeconfigs.NodeStatus, error) {
 | 
					func (this *Node) DecodeStatus() (*nodeconfigs.NodeStatus, error) {
 | 
				
			||||||
	if len(this.Status) == 0 || this.Status == "null" {
 | 
						if len(this.Status) == 0 {
 | 
				
			||||||
		return nil, nil
 | 
							return nil, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	status := &nodeconfigs.NodeStatus{}
 | 
						status := &nodeconfigs.NodeStatus{}
 | 
				
			||||||
@@ -44,7 +44,7 @@ func (this *Node) DecodeStatus() (*nodeconfigs.NodeStatus, error) {
 | 
				
			|||||||
// DNSRouteCodes 所有的DNS线路
 | 
					// DNSRouteCodes 所有的DNS线路
 | 
				
			||||||
func (this *Node) DNSRouteCodes() map[int64][]string {
 | 
					func (this *Node) DNSRouteCodes() map[int64][]string {
 | 
				
			||||||
	routes := map[int64][]string{} // domainId => routes
 | 
						routes := map[int64][]string{} // domainId => routes
 | 
				
			||||||
	if len(this.DnsRoutes) == 0 || this.DnsRoutes == "null" {
 | 
						if len(this.DnsRoutes) == 0 {
 | 
				
			||||||
		return routes
 | 
							return routes
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err := json.Unmarshal([]byte(this.DnsRoutes), &routes)
 | 
						err := json.Unmarshal([]byte(this.DnsRoutes), &routes)
 | 
				
			||||||
@@ -58,7 +58,7 @@ func (this *Node) DNSRouteCodes() map[int64][]string {
 | 
				
			|||||||
// DNSRouteCodesForDomainId DNS线路
 | 
					// DNSRouteCodesForDomainId DNS线路
 | 
				
			||||||
func (this *Node) DNSRouteCodesForDomainId(dnsDomainId int64) ([]string, error) {
 | 
					func (this *Node) DNSRouteCodesForDomainId(dnsDomainId int64) ([]string, error) {
 | 
				
			||||||
	routes := map[int64][]string{} // domainId => routes
 | 
						routes := map[int64][]string{} // domainId => routes
 | 
				
			||||||
	if len(this.DnsRoutes) == 0 || this.DnsRoutes == "null" {
 | 
						if len(this.DnsRoutes) == 0 {
 | 
				
			||||||
		return nil, nil
 | 
							return nil, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err := json.Unmarshal([]byte(this.DnsRoutes), &routes)
 | 
						err := json.Unmarshal([]byte(this.DnsRoutes), &routes)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -162,8 +162,8 @@ func (this *NodeRegionDAO) UpdateRegionItemPrice(tx *dbs.Tx, regionId int64, ite
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	prices := one.(*NodeRegion).Prices
 | 
						prices := one.(*NodeRegion).Prices
 | 
				
			||||||
	pricesMap := map[string]float32{}
 | 
						pricesMap := map[string]float32{}
 | 
				
			||||||
	if len(prices) > 0 && prices != "null" {
 | 
						if IsNotNull(prices) {
 | 
				
			||||||
		err = json.Unmarshal([]byte(prices), &pricesMap)
 | 
							err = json.Unmarshal(prices, &pricesMap)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,18 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NodeRegion 节点区域
 | 
					// NodeRegion 节点区域
 | 
				
			||||||
type NodeRegion struct {
 | 
					type NodeRegion struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	AdminId     uint32 `field:"adminId"`     // 管理员ID
 | 
						AdminId     uint32   `field:"adminId"`     // 管理员ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	Name        string `field:"name"`        // 名称
 | 
						Name        string   `field:"name"`        // 名称
 | 
				
			||||||
	Description string `field:"description"` // 描述
 | 
						Description string   `field:"description"` // 描述
 | 
				
			||||||
	Order       uint32 `field:"order"`       // 排序
 | 
						Order       uint32   `field:"order"`       // 排序
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	Prices      string `field:"prices"`      // 价格
 | 
						Prices      dbs.JSON `field:"prices"`      // 价格
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeRegionOperator struct {
 | 
					type NodeRegionOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,24 +1,26 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NodeThreshold 集群阈值设置
 | 
					// NodeThreshold 集群阈值设置
 | 
				
			||||||
type NodeThreshold struct {
 | 
					type NodeThreshold struct {
 | 
				
			||||||
	Id             uint64 `field:"id"`             // ID
 | 
						Id             uint64   `field:"id"`             // ID
 | 
				
			||||||
	Role           string `field:"role"`           // 节点角色
 | 
						Role           string   `field:"role"`           // 节点角色
 | 
				
			||||||
	ClusterId      uint32 `field:"clusterId"`      // 集群ID
 | 
						ClusterId      uint32   `field:"clusterId"`      // 集群ID
 | 
				
			||||||
	NodeId         uint32 `field:"nodeId"`         // 节点ID
 | 
						NodeId         uint32   `field:"nodeId"`         // 节点ID
 | 
				
			||||||
	IsOn           uint8  `field:"isOn"`           // 是否启用
 | 
						IsOn           uint8    `field:"isOn"`           // 是否启用
 | 
				
			||||||
	Item           string `field:"item"`           // 监控项
 | 
						Item           string   `field:"item"`           // 监控项
 | 
				
			||||||
	Param          string `field:"param"`          // 参数
 | 
						Param          string   `field:"param"`          // 参数
 | 
				
			||||||
	Operator       string `field:"operator"`       // 操作符
 | 
						Operator       string   `field:"operator"`       // 操作符
 | 
				
			||||||
	Value          string `field:"value"`          // 对比值
 | 
						Value          dbs.JSON `field:"value"`          // 对比值
 | 
				
			||||||
	Message        string `field:"message"`        // 消息内容
 | 
						Message        string   `field:"message"`        // 消息内容
 | 
				
			||||||
	NotifyDuration uint32 `field:"notifyDuration"` // 通知间隔
 | 
						NotifyDuration uint32   `field:"notifyDuration"` // 通知间隔
 | 
				
			||||||
	NotifiedAt     uint32 `field:"notifiedAt"`     // 上次通知时间
 | 
						NotifiedAt     uint32   `field:"notifiedAt"`     // 上次通知时间
 | 
				
			||||||
	Duration       uint32 `field:"duration"`       // 时间段
 | 
						Duration       uint32   `field:"duration"`       // 时间段
 | 
				
			||||||
	DurationUnit   string `field:"durationUnit"`   // 时间段单位
 | 
						DurationUnit   string   `field:"durationUnit"`   // 时间段单位
 | 
				
			||||||
	SumMethod      string `field:"sumMethod"`      // 聚合方法
 | 
						SumMethod      string   `field:"sumMethod"`      // 聚合方法
 | 
				
			||||||
	Order          uint32 `field:"order"`          // 排序
 | 
						Order          uint32   `field:"order"`          // 排序
 | 
				
			||||||
	State          uint8  `field:"state"`          // 状态
 | 
						State          uint8    `field:"state"`          // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeThresholdOperator struct {
 | 
					type NodeThresholdOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,19 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NodeValue 节点监控数据
 | 
					// NodeValue 节点监控数据
 | 
				
			||||||
type NodeValue struct {
 | 
					type NodeValue struct {
 | 
				
			||||||
	Id        uint64 `field:"id"`        // ID
 | 
						Id        uint64   `field:"id"`        // ID
 | 
				
			||||||
	ClusterId uint32 `field:"clusterId"` // 集群ID
 | 
						ClusterId uint32   `field:"clusterId"` // 集群ID
 | 
				
			||||||
	NodeId    uint32 `field:"nodeId"`    // 节点ID
 | 
						NodeId    uint32   `field:"nodeId"`    // 节点ID
 | 
				
			||||||
	Role      string `field:"role"`      // 节点角色
 | 
						Role      string   `field:"role"`      // 节点角色
 | 
				
			||||||
	Item      string `field:"item"`      // 监控项
 | 
						Item      string   `field:"item"`      // 监控项
 | 
				
			||||||
	Value     string `field:"value"`     // 数据
 | 
						Value     dbs.JSON `field:"value"`     // 数据
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
	Day       string `field:"day"`       // 日期
 | 
						Day       string   `field:"day"`       // 日期
 | 
				
			||||||
	Hour      string `field:"hour"`      // 小时
 | 
						Hour      string   `field:"hour"`      // 小时
 | 
				
			||||||
	Minute    string `field:"minute"`    // 分钟
 | 
						Minute    string   `field:"minute"`    // 分钟
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NodeValueOperator struct {
 | 
					type NodeValueOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,17 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSAccessLog 域名服务访问日志
 | 
					// NSAccessLog 域名服务访问日志
 | 
				
			||||||
type NSAccessLog struct {
 | 
					type NSAccessLog struct {
 | 
				
			||||||
	Id         uint64 `field:"id"`         // ID
 | 
						Id         uint64   `field:"id"`         // ID
 | 
				
			||||||
	NodeId     uint32 `field:"nodeId"`     // 节点ID
 | 
						NodeId     uint32   `field:"nodeId"`     // 节点ID
 | 
				
			||||||
	DomainId   uint32 `field:"domainId"`   // 域名ID
 | 
						DomainId   uint32   `field:"domainId"`   // 域名ID
 | 
				
			||||||
	RecordId   uint32 `field:"recordId"`   // 记录ID
 | 
						RecordId   uint32   `field:"recordId"`   // 记录ID
 | 
				
			||||||
	Content    string `field:"content"`    // 访问数据
 | 
						Content    dbs.JSON `field:"content"`    // 访问数据
 | 
				
			||||||
	RequestId  string `field:"requestId"`  // 请求ID
 | 
						RequestId  string   `field:"requestId"`  // 请求ID
 | 
				
			||||||
	CreatedAt  uint64 `field:"createdAt"`  // 创建时间
 | 
						CreatedAt  uint64   `field:"createdAt"`  // 创建时间
 | 
				
			||||||
	RemoteAddr string `field:"remoteAddr"` // IP
 | 
						RemoteAddr string   `field:"remoteAddr"` // IP
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NSAccessLogOperator struct {
 | 
					type NSAccessLogOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,17 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSCluster 域名服务器集群
 | 
					// NSCluster 域名服务器集群
 | 
				
			||||||
type NSCluster struct {
 | 
					type NSCluster struct {
 | 
				
			||||||
	Id         uint32 `field:"id"`         // ID
 | 
						Id         uint32   `field:"id"`         // ID
 | 
				
			||||||
	IsOn       uint8  `field:"isOn"`       // 是否启用
 | 
						IsOn       uint8    `field:"isOn"`       // 是否启用
 | 
				
			||||||
	Name       string `field:"name"`       // 集群名
 | 
						Name       string   `field:"name"`       // 集群名
 | 
				
			||||||
	InstallDir string `field:"installDir"` // 安装目录
 | 
						InstallDir string   `field:"installDir"` // 安装目录
 | 
				
			||||||
	State      uint8  `field:"state"`      // 状态
 | 
						State      uint8    `field:"state"`      // 状态
 | 
				
			||||||
	AccessLog  string `field:"accessLog"`  // 访问日志配置
 | 
						AccessLog  dbs.JSON `field:"accessLog"`  // 访问日志配置
 | 
				
			||||||
	GrantId    uint32 `field:"grantId"`    // 授权ID
 | 
						GrantId    uint32   `field:"grantId"`    // 授权ID
 | 
				
			||||||
	Recursion  string `field:"recursion"`  // 递归DNS设置
 | 
						Recursion  dbs.JSON `field:"recursion"`  // 递归DNS设置
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NSClusterOperator struct {
 | 
					type NSClusterOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,23 +1,25 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSNode 域名服务器节点
 | 
					// NSNode 域名服务器节点
 | 
				
			||||||
type NSNode struct {
 | 
					type NSNode struct {
 | 
				
			||||||
	Id                uint32 `field:"id"`                // ID
 | 
						Id                uint32   `field:"id"`                // ID
 | 
				
			||||||
	AdminId           uint32 `field:"adminId"`           // 管理员ID
 | 
						AdminId           uint32   `field:"adminId"`           // 管理员ID
 | 
				
			||||||
	ClusterId         uint32 `field:"clusterId"`         // 集群ID
 | 
						ClusterId         uint32   `field:"clusterId"`         // 集群ID
 | 
				
			||||||
	Name              string `field:"name"`              // 节点名称
 | 
						Name              string   `field:"name"`              // 节点名称
 | 
				
			||||||
	IsOn              uint8  `field:"isOn"`              // 是否启用
 | 
						IsOn              uint8    `field:"isOn"`              // 是否启用
 | 
				
			||||||
	Status            string `field:"status"`            // 运行状态
 | 
						Status            dbs.JSON `field:"status"`            // 运行状态
 | 
				
			||||||
	UniqueId          string `field:"uniqueId"`          // 节点ID
 | 
						UniqueId          string   `field:"uniqueId"`          // 节点ID
 | 
				
			||||||
	Secret            string `field:"secret"`            // 密钥
 | 
						Secret            string   `field:"secret"`            // 密钥
 | 
				
			||||||
	IsUp              uint8  `field:"isUp"`              // 是否运行
 | 
						IsUp              uint8    `field:"isUp"`              // 是否运行
 | 
				
			||||||
	IsInstalled       uint8  `field:"isInstalled"`       // 是否已安装
 | 
						IsInstalled       uint8    `field:"isInstalled"`       // 是否已安装
 | 
				
			||||||
	InstallStatus     string `field:"installStatus"`     // 安装状态
 | 
						InstallStatus     dbs.JSON `field:"installStatus"`     // 安装状态
 | 
				
			||||||
	InstallDir        string `field:"installDir"`        // 安装目录
 | 
						InstallDir        string   `field:"installDir"`        // 安装目录
 | 
				
			||||||
	State             uint8  `field:"state"`             // 状态
 | 
						State             uint8    `field:"state"`             // 状态
 | 
				
			||||||
	IsActive          uint8  `field:"isActive"`          // 是否活跃
 | 
						IsActive          uint8    `field:"isActive"`          // 是否活跃
 | 
				
			||||||
	StatusIsNotified  uint8  `field:"statusIsNotified"`  // 活跃状态已经通知
 | 
						StatusIsNotified  uint8    `field:"statusIsNotified"`  // 活跃状态已经通知
 | 
				
			||||||
	ConnectedAPINodes string `field:"connectedAPINodes"` // 当前连接的API节点
 | 
						ConnectedAPINodes dbs.JSON `field:"connectedAPINodes"` // 当前连接的API节点
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NSNodeOperator struct {
 | 
					type NSNodeOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeInstallStatus 安装状态
 | 
					// DecodeInstallStatus 安装状态
 | 
				
			||||||
func (this *NSNode) DecodeInstallStatus() (*NodeInstallStatus, error) {
 | 
					func (this *NSNode) DecodeInstallStatus() (*NodeInstallStatus, error) {
 | 
				
			||||||
	if len(this.InstallStatus) == 0 || this.InstallStatus == "null" {
 | 
						if len(this.InstallStatus) == 0 {
 | 
				
			||||||
		return NewNodeInstallStatus(), nil
 | 
							return NewNodeInstallStatus(), nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	status := &NodeInstallStatus{}
 | 
						status := &NodeInstallStatus{}
 | 
				
			||||||
@@ -29,7 +29,7 @@ func (this *NSNode) DecodeInstallStatus() (*NodeInstallStatus, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeStatus 节点状态
 | 
					// DecodeStatus 节点状态
 | 
				
			||||||
func (this *NSNode) DecodeStatus() (*nodeconfigs.NodeStatus, error) {
 | 
					func (this *NSNode) DecodeStatus() (*nodeconfigs.NodeStatus, error) {
 | 
				
			||||||
	if len(this.Status) == 0 || this.Status == "null" {
 | 
						if len(this.Status) == 0 {
 | 
				
			||||||
		return nil, nil
 | 
							return nil, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	status := &nodeconfigs.NodeStatus{}
 | 
						status := &nodeconfigs.NodeStatus{}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,33 +1,35 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Origin 源站
 | 
					// Origin 源站
 | 
				
			||||||
type Origin struct {
 | 
					type Origin struct {
 | 
				
			||||||
	Id                 uint32 `field:"id"`                 // ID
 | 
						Id                 uint32   `field:"id"`                 // ID
 | 
				
			||||||
	AdminId            uint32 `field:"adminId"`            // 管理员ID
 | 
						AdminId            uint32   `field:"adminId"`            // 管理员ID
 | 
				
			||||||
	UserId             uint32 `field:"userId"`             // 用户ID
 | 
						UserId             uint32   `field:"userId"`             // 用户ID
 | 
				
			||||||
	IsOn               uint8  `field:"isOn"`               // 是否启用
 | 
						IsOn               uint8    `field:"isOn"`               // 是否启用
 | 
				
			||||||
	Name               string `field:"name"`               // 名称
 | 
						Name               string   `field:"name"`               // 名称
 | 
				
			||||||
	Version            uint32 `field:"version"`            // 版本
 | 
						Version            uint32   `field:"version"`            // 版本
 | 
				
			||||||
	Addr               string `field:"addr"`               // 地址
 | 
						Addr               dbs.JSON `field:"addr"`               // 地址
 | 
				
			||||||
	Description        string `field:"description"`        // 描述
 | 
						Description        string   `field:"description"`        // 描述
 | 
				
			||||||
	Code               string `field:"code"`               // 代号
 | 
						Code               string   `field:"code"`               // 代号
 | 
				
			||||||
	Weight             uint32 `field:"weight"`             // 权重
 | 
						Weight             uint32   `field:"weight"`             // 权重
 | 
				
			||||||
	ConnTimeout        string `field:"connTimeout"`        // 连接超时
 | 
						ConnTimeout        dbs.JSON `field:"connTimeout"`        // 连接超时
 | 
				
			||||||
	ReadTimeout        string `field:"readTimeout"`        // 读超时
 | 
						ReadTimeout        dbs.JSON `field:"readTimeout"`        // 读超时
 | 
				
			||||||
	IdleTimeout        string `field:"idleTimeout"`        // 空闲连接超时
 | 
						IdleTimeout        dbs.JSON `field:"idleTimeout"`        // 空闲连接超时
 | 
				
			||||||
	MaxFails           uint32 `field:"maxFails"`           // 最多失败次数
 | 
						MaxFails           uint32   `field:"maxFails"`           // 最多失败次数
 | 
				
			||||||
	MaxConns           uint32 `field:"maxConns"`           // 最大并发连接数
 | 
						MaxConns           uint32   `field:"maxConns"`           // 最大并发连接数
 | 
				
			||||||
	MaxIdleConns       uint32 `field:"maxIdleConns"`       // 最多空闲连接数
 | 
						MaxIdleConns       uint32   `field:"maxIdleConns"`       // 最多空闲连接数
 | 
				
			||||||
	HttpRequestURI     string `field:"httpRequestURI"`     // 转发后的请求URI
 | 
						HttpRequestURI     string   `field:"httpRequestURI"`     // 转发后的请求URI
 | 
				
			||||||
	HttpRequestHeader  string `field:"httpRequestHeader"`  // 请求Header配置
 | 
						HttpRequestHeader  dbs.JSON `field:"httpRequestHeader"`  // 请求Header配置
 | 
				
			||||||
	HttpResponseHeader string `field:"httpResponseHeader"` // 响应Header配置
 | 
						HttpResponseHeader dbs.JSON `field:"httpResponseHeader"` // 响应Header配置
 | 
				
			||||||
	Host               string `field:"host"`               // 自定义主机名
 | 
						Host               string   `field:"host"`               // 自定义主机名
 | 
				
			||||||
	HealthCheck        string `field:"healthCheck"`        // 健康检查设置
 | 
						HealthCheck        dbs.JSON `field:"healthCheck"`        // 健康检查设置
 | 
				
			||||||
	Cert               string `field:"cert"`               // 证书设置
 | 
						Cert               dbs.JSON `field:"cert"`               // 证书设置
 | 
				
			||||||
	Ftp                string `field:"ftp"`                // FTP相关设置
 | 
						Ftp                dbs.JSON `field:"ftp"`                // FTP相关设置
 | 
				
			||||||
	CreatedAt          uint64 `field:"createdAt"`          // 创建时间
 | 
						CreatedAt          uint64   `field:"createdAt"`          // 创建时间
 | 
				
			||||||
	Domains            string `field:"domains"`            // 所属域名
 | 
						Domains            dbs.JSON `field:"domains"`            // 所属域名
 | 
				
			||||||
	State              uint8  `field:"state"`              // 状态
 | 
						State              uint8    `field:"state"`              // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type OriginOperator struct {
 | 
					type OriginOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,18 +9,18 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeAddr 解析地址
 | 
					// DecodeAddr 解析地址
 | 
				
			||||||
func (this *Origin) DecodeAddr() (*serverconfigs.NetworkAddressConfig, error) {
 | 
					func (this *Origin) DecodeAddr() (*serverconfigs.NetworkAddressConfig, error) {
 | 
				
			||||||
	if len(this.Addr) == 0 || this.Addr == "null" {
 | 
						if len(this.Addr) == 0 {
 | 
				
			||||||
		return nil, errors.New("addr is empty")
 | 
							return nil, errors.New("addr is empty")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	addr := &serverconfigs.NetworkAddressConfig{}
 | 
						addr := &serverconfigs.NetworkAddressConfig{}
 | 
				
			||||||
	err := json.Unmarshal([]byte(this.Addr), addr)
 | 
						err := json.Unmarshal(this.Addr, addr)
 | 
				
			||||||
	return addr, err
 | 
						return addr, err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (this *Origin) DecodeDomains() []string {
 | 
					func (this *Origin) DecodeDomains() []string {
 | 
				
			||||||
	var result = []string{}
 | 
						var result = []string{}
 | 
				
			||||||
	if len(this.Domains) > 0 {
 | 
						if len(this.Domains) > 0 {
 | 
				
			||||||
		err := json.Unmarshal([]byte(this.Domains), &result)
 | 
							err := json.Unmarshal(this.Domains, &result)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			remotelogs.Error("Origin.DecodeDomains", err.Error())
 | 
								remotelogs.Error("Origin.DecodeDomains", err.Error())
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,23 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Plan 用户套餐
 | 
					// Plan 用户套餐
 | 
				
			||||||
type Plan struct {
 | 
					type Plan struct {
 | 
				
			||||||
	Id              uint32  `field:"id"`              // ID
 | 
						Id              uint32   `field:"id"`              // ID
 | 
				
			||||||
	IsOn            uint8   `field:"isOn"`            // 是否启用
 | 
						IsOn            uint8    `field:"isOn"`            // 是否启用
 | 
				
			||||||
	Name            string  `field:"name"`            // 套餐名
 | 
						Name            string   `field:"name"`            // 套餐名
 | 
				
			||||||
	ClusterId       uint32  `field:"clusterId"`       // 集群ID
 | 
						ClusterId       uint32   `field:"clusterId"`       // 集群ID
 | 
				
			||||||
	TrafficLimit    string  `field:"trafficLimit"`    // 流量限制
 | 
						TrafficLimit    dbs.JSON `field:"trafficLimit"`    // 流量限制
 | 
				
			||||||
	Features        string  `field:"features"`        // 允许的功能
 | 
						Features        dbs.JSON `field:"features"`        // 允许的功能
 | 
				
			||||||
	TrafficPrice    string  `field:"trafficPrice"`    // 流量价格设定
 | 
						TrafficPrice    dbs.JSON `field:"trafficPrice"`    // 流量价格设定
 | 
				
			||||||
	BandwidthPrice  string  `field:"bandwidthPrice"`  // 带宽价格
 | 
						BandwidthPrice  dbs.JSON `field:"bandwidthPrice"`  // 带宽价格
 | 
				
			||||||
	MonthlyPrice    float64 `field:"monthlyPrice"`    // 月付
 | 
						MonthlyPrice    float64  `field:"monthlyPrice"`    // 月付
 | 
				
			||||||
	SeasonallyPrice float64 `field:"seasonallyPrice"` // 季付
 | 
						SeasonallyPrice float64  `field:"seasonallyPrice"` // 季付
 | 
				
			||||||
	YearlyPrice     float64 `field:"yearlyPrice"`     // 年付
 | 
						YearlyPrice     float64  `field:"yearlyPrice"`     // 年付
 | 
				
			||||||
	PriceType       string  `field:"priceType"`       // 价格类型
 | 
						PriceType       string   `field:"priceType"`       // 价格类型
 | 
				
			||||||
	Order           uint32  `field:"order"`           // 排序
 | 
						Order           uint32   `field:"order"`           // 排序
 | 
				
			||||||
	State           uint8   `field:"state"`           // 状态
 | 
						State           uint8    `field:"state"`           // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type PlanOperator struct {
 | 
					type PlanOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +1,15 @@
 | 
				
			|||||||
package regions
 | 
					package regions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// RegionCity 区域城市
 | 
				
			||||||
type RegionCity struct {
 | 
					type RegionCity struct {
 | 
				
			||||||
	Id         uint32 `field:"id"`         // ID
 | 
						Id         uint32   `field:"id"`         // ID
 | 
				
			||||||
	ProvinceId uint32 `field:"provinceId"` // 省份ID
 | 
						ProvinceId uint32   `field:"provinceId"` // 省份ID
 | 
				
			||||||
	Name       string `field:"name"`       // 名称
 | 
						Name       string   `field:"name"`       // 名称
 | 
				
			||||||
	Codes      string `field:"codes"`      // 代号
 | 
						Codes      dbs.JSON `field:"codes"`      // 代号
 | 
				
			||||||
	State      uint8  `field:"state"`      // 状态
 | 
						State      uint8    `field:"state"`      // 状态
 | 
				
			||||||
	DataId     string `field:"dataId"`     // 原始数据ID
 | 
						DataId     string   `field:"dataId"`     // 原始数据ID
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RegionCityOperator struct {
 | 
					type RegionCityOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +1,15 @@
 | 
				
			|||||||
package regions
 | 
					package regions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// RegionCountry 区域国家|地区
 | 
				
			||||||
type RegionCountry struct {
 | 
					type RegionCountry struct {
 | 
				
			||||||
	Id     uint32 `field:"id"`     // ID
 | 
						Id     uint32   `field:"id"`     // ID
 | 
				
			||||||
	Name   string `field:"name"`   // 名称
 | 
						Name   string   `field:"name"`   // 名称
 | 
				
			||||||
	Codes  string `field:"codes"`  // 代号
 | 
						Codes  dbs.JSON `field:"codes"`  // 代号
 | 
				
			||||||
	State  uint8  `field:"state"`  // 状态
 | 
						State  uint8    `field:"state"`  // 状态
 | 
				
			||||||
	DataId string `field:"dataId"` // 原始数据ID
 | 
						DataId string   `field:"dataId"` // 原始数据ID
 | 
				
			||||||
	Pinyin string `field:"pinyin"` // 拼音
 | 
						Pinyin dbs.JSON `field:"pinyin"` // 拼音
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RegionCountryOperator struct {
 | 
					type RegionCountryOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,13 @@
 | 
				
			|||||||
package regions
 | 
					package regions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// RegionProvider 区域ISP
 | 
				
			||||||
type RegionProvider struct {
 | 
					type RegionProvider struct {
 | 
				
			||||||
	Id    uint32 `field:"id"`    // ID
 | 
						Id    uint32   `field:"id"`    // ID
 | 
				
			||||||
	Name  string `field:"name"`  // 名称
 | 
						Name  string   `field:"name"`  // 名称
 | 
				
			||||||
	Codes string `field:"codes"` // 代号
 | 
						Codes dbs.JSON `field:"codes"` // 代号
 | 
				
			||||||
	State uint8  `field:"state"` // 状态
 | 
						State uint8    `field:"state"` // 状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RegionProviderOperator struct {
 | 
					type RegionProviderOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +1,15 @@
 | 
				
			|||||||
package regions
 | 
					package regions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// RegionProvince 区域省份
 | 
				
			||||||
type RegionProvince struct {
 | 
					type RegionProvince struct {
 | 
				
			||||||
	Id        uint32 `field:"id"`        // ID
 | 
						Id        uint32   `field:"id"`        // ID
 | 
				
			||||||
	CountryId uint32 `field:"countryId"` // 国家ID
 | 
						CountryId uint32   `field:"countryId"` // 国家ID
 | 
				
			||||||
	Name      string `field:"name"`      // 名称
 | 
						Name      string   `field:"name"`      // 名称
 | 
				
			||||||
	Codes     string `field:"codes"`     // 代号
 | 
						Codes     dbs.JSON `field:"codes"`     // 代号
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
	DataId    string `field:"dataId"`    // 原始数据ID
 | 
						DataId    string   `field:"dataId"`    // 原始数据ID
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RegionProvinceOperator struct {
 | 
					type RegionProvinceOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,20 +1,22 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ReportNode 连通性报告终端
 | 
					// ReportNode 连通性报告终端
 | 
				
			||||||
type ReportNode struct {
 | 
					type ReportNode struct {
 | 
				
			||||||
	Id        uint32 `field:"id"`        // ID
 | 
						Id        uint32   `field:"id"`        // ID
 | 
				
			||||||
	UniqueId  string `field:"uniqueId"`  // 唯一ID
 | 
						UniqueId  string   `field:"uniqueId"`  // 唯一ID
 | 
				
			||||||
	Secret    string `field:"secret"`    // 密钥
 | 
						Secret    string   `field:"secret"`    // 密钥
 | 
				
			||||||
	IsOn      uint8  `field:"isOn"`      // 是否启用
 | 
						IsOn      uint8    `field:"isOn"`      // 是否启用
 | 
				
			||||||
	Name      string `field:"name"`      // 名称
 | 
						Name      string   `field:"name"`      // 名称
 | 
				
			||||||
	Location  string `field:"location"`  // 所在区域
 | 
						Location  string   `field:"location"`  // 所在区域
 | 
				
			||||||
	Isp       string `field:"isp"`       // 网络服务商
 | 
						Isp       string   `field:"isp"`       // 网络服务商
 | 
				
			||||||
	AllowIPs  string `field:"allowIPs"`  // 允许的IP
 | 
						AllowIPs  dbs.JSON `field:"allowIPs"`  // 允许的IP
 | 
				
			||||||
	IsActive  uint8  `field:"isActive"`  // 是否活跃
 | 
						IsActive  uint8    `field:"isActive"`  // 是否活跃
 | 
				
			||||||
	Status    string `field:"status"`    // 状态
 | 
						Status    dbs.JSON `field:"status"`    // 状态
 | 
				
			||||||
	State     uint8  `field:"state"`     // 状态
 | 
						State     uint8    `field:"state"`     // 状态
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
	GroupIds  string `field:"groupIds"`  // 分组ID
 | 
						GroupIds  dbs.JSON `field:"groupIds"`  // 分组ID
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ReportNodeOperator struct {
 | 
					type ReportNodeOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -110,16 +110,16 @@ func (this *ReverseProxyDAO) ComposeReverseProxyConfig(tx *dbs.Tx, reverseProxyI
 | 
				
			|||||||
	config.FollowRedirects = reverseProxy.FollowRedirects == 1
 | 
						config.FollowRedirects = reverseProxy.FollowRedirects == 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	schedulingConfig := &serverconfigs.SchedulingConfig{}
 | 
						schedulingConfig := &serverconfigs.SchedulingConfig{}
 | 
				
			||||||
	if len(reverseProxy.Scheduling) > 0 && reverseProxy.Scheduling != "null" {
 | 
						if IsNotNull(reverseProxy.Scheduling) {
 | 
				
			||||||
		err = json.Unmarshal([]byte(reverseProxy.Scheduling), schedulingConfig)
 | 
							err = json.Unmarshal(reverseProxy.Scheduling, schedulingConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		config.Scheduling = schedulingConfig
 | 
							config.Scheduling = schedulingConfig
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(reverseProxy.PrimaryOrigins) > 0 && reverseProxy.PrimaryOrigins != "null" {
 | 
						if IsNotNull(reverseProxy.PrimaryOrigins) {
 | 
				
			||||||
		originRefs := []*serverconfigs.OriginRef{}
 | 
							originRefs := []*serverconfigs.OriginRef{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(reverseProxy.PrimaryOrigins), &originRefs)
 | 
							err = json.Unmarshal(reverseProxy.PrimaryOrigins, &originRefs)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -134,9 +134,9 @@ func (this *ReverseProxyDAO) ComposeReverseProxyConfig(tx *dbs.Tx, reverseProxyI
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(reverseProxy.BackupOrigins) > 0 && reverseProxy.BackupOrigins != "null" {
 | 
						if IsNotNull(reverseProxy.BackupOrigins) {
 | 
				
			||||||
		originRefs := []*serverconfigs.OriginRef{}
 | 
							originRefs := []*serverconfigs.OriginRef{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(reverseProxy.BackupOrigins), &originRefs)
 | 
							err = json.Unmarshal(reverseProxy.BackupOrigins, &originRefs)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -154,7 +154,7 @@ func (this *ReverseProxyDAO) ComposeReverseProxyConfig(tx *dbs.Tx, reverseProxyI
 | 
				
			|||||||
	// add headers
 | 
						// add headers
 | 
				
			||||||
	if IsNotNull(reverseProxy.AddHeaders) {
 | 
						if IsNotNull(reverseProxy.AddHeaders) {
 | 
				
			||||||
		addHeaders := []string{}
 | 
							addHeaders := []string{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(reverseProxy.AddHeaders), &addHeaders)
 | 
							err = json.Unmarshal(reverseProxy.AddHeaders, &addHeaders)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -167,7 +167,7 @@ func (this *ReverseProxyDAO) ComposeReverseProxyConfig(tx *dbs.Tx, reverseProxyI
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if IsNotNull(reverseProxy.ConnTimeout) {
 | 
						if IsNotNull(reverseProxy.ConnTimeout) {
 | 
				
			||||||
		connTimeout := &shared.TimeDuration{}
 | 
							connTimeout := &shared.TimeDuration{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(reverseProxy.ConnTimeout), &connTimeout)
 | 
							err = json.Unmarshal(reverseProxy.ConnTimeout, &connTimeout)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -176,7 +176,7 @@ func (this *ReverseProxyDAO) ComposeReverseProxyConfig(tx *dbs.Tx, reverseProxyI
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if IsNotNull(reverseProxy.ReadTimeout) {
 | 
						if IsNotNull(reverseProxy.ReadTimeout) {
 | 
				
			||||||
		readTimeout := &shared.TimeDuration{}
 | 
							readTimeout := &shared.TimeDuration{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(reverseProxy.ReadTimeout), &readTimeout)
 | 
							err = json.Unmarshal(reverseProxy.ReadTimeout, &readTimeout)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -185,7 +185,7 @@ func (this *ReverseProxyDAO) ComposeReverseProxyConfig(tx *dbs.Tx, reverseProxyI
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if IsNotNull(reverseProxy.IdleTimeout) {
 | 
						if IsNotNull(reverseProxy.IdleTimeout) {
 | 
				
			||||||
		idleTimeout := &shared.TimeDuration{}
 | 
							idleTimeout := &shared.TimeDuration{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(reverseProxy.IdleTimeout), &idleTimeout)
 | 
							err = json.Unmarshal(reverseProxy.IdleTimeout, &idleTimeout)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -195,7 +195,7 @@ func (this *ReverseProxyDAO) ComposeReverseProxyConfig(tx *dbs.Tx, reverseProxyI
 | 
				
			|||||||
	// PROXY Protocol
 | 
						// PROXY Protocol
 | 
				
			||||||
	if IsNotNull(reverseProxy.ProxyProtocol) {
 | 
						if IsNotNull(reverseProxy.ProxyProtocol) {
 | 
				
			||||||
		var proxyProtocolConfig = &serverconfigs.ProxyProtocolConfig{}
 | 
							var proxyProtocolConfig = &serverconfigs.ProxyProtocolConfig{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(reverseProxy.ProxyProtocol), proxyProtocolConfig)
 | 
							err = json.Unmarshal(reverseProxy.ProxyProtocol, proxyProtocolConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -225,13 +225,13 @@ func (this *ReverseProxyDAO) CreateReverseProxy(tx *dbs.Tx, adminId int64, userI
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	op.AddHeaders = defaultHeadersJSON
 | 
						op.AddHeaders = defaultHeadersJSON
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(schedulingJSON) > 0 {
 | 
						if IsNotNull(schedulingJSON) {
 | 
				
			||||||
		op.Scheduling = string(schedulingJSON)
 | 
							op.Scheduling = string(schedulingJSON)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(primaryOriginsJSON) > 0 {
 | 
						if IsNotNull(primaryOriginsJSON) {
 | 
				
			||||||
		op.PrimaryOrigins = string(primaryOriginsJSON)
 | 
							op.PrimaryOrigins = string(primaryOriginsJSON)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(backupOriginsJSON) > 0 {
 | 
						if IsNotNull(backupOriginsJSON) {
 | 
				
			||||||
		op.BackupOrigins = string(backupOriginsJSON)
 | 
							op.BackupOrigins = string(backupOriginsJSON)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err = this.Save(tx, op)
 | 
						err = this.Save(tx, op)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,30 +1,32 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ReverseProxy 反向代理配置
 | 
					// ReverseProxy 反向代理配置
 | 
				
			||||||
type ReverseProxy struct {
 | 
					type ReverseProxy struct {
 | 
				
			||||||
	Id              uint32 `field:"id"`              // ID
 | 
						Id              uint32   `field:"id"`              // ID
 | 
				
			||||||
	AdminId         uint32 `field:"adminId"`         // 管理员ID
 | 
						AdminId         uint32   `field:"adminId"`         // 管理员ID
 | 
				
			||||||
	UserId          uint32 `field:"userId"`          // 用户ID
 | 
						UserId          uint32   `field:"userId"`          // 用户ID
 | 
				
			||||||
	TemplateId      uint32 `field:"templateId"`      // 模版ID
 | 
						TemplateId      uint32   `field:"templateId"`      // 模版ID
 | 
				
			||||||
	IsOn            uint8  `field:"isOn"`            // 是否启用
 | 
						IsOn            uint8    `field:"isOn"`            // 是否启用
 | 
				
			||||||
	Scheduling      string `field:"scheduling"`      // 调度算法
 | 
						Scheduling      dbs.JSON `field:"scheduling"`      // 调度算法
 | 
				
			||||||
	PrimaryOrigins  string `field:"primaryOrigins"`  // 主要源站
 | 
						PrimaryOrigins  dbs.JSON `field:"primaryOrigins"`  // 主要源站
 | 
				
			||||||
	BackupOrigins   string `field:"backupOrigins"`   // 备用源站
 | 
						BackupOrigins   dbs.JSON `field:"backupOrigins"`   // 备用源站
 | 
				
			||||||
	StripPrefix     string `field:"stripPrefix"`     // 去除URL前缀
 | 
						StripPrefix     string   `field:"stripPrefix"`     // 去除URL前缀
 | 
				
			||||||
	RequestHostType uint8  `field:"requestHostType"` // 请求Host类型
 | 
						RequestHostType uint8    `field:"requestHostType"` // 请求Host类型
 | 
				
			||||||
	RequestHost     string `field:"requestHost"`     // 请求Host
 | 
						RequestHost     string   `field:"requestHost"`     // 请求Host
 | 
				
			||||||
	RequestURI      string `field:"requestURI"`      // 请求URI
 | 
						RequestURI      string   `field:"requestURI"`      // 请求URI
 | 
				
			||||||
	AutoFlush       uint8  `field:"autoFlush"`       // 是否自动刷新缓冲区
 | 
						AutoFlush       uint8    `field:"autoFlush"`       // 是否自动刷新缓冲区
 | 
				
			||||||
	AddHeaders      string `field:"addHeaders"`      // 自动添加的Header列表
 | 
						AddHeaders      dbs.JSON `field:"addHeaders"`      // 自动添加的Header列表
 | 
				
			||||||
	State           uint8  `field:"state"`           // 状态
 | 
						State           uint8    `field:"state"`           // 状态
 | 
				
			||||||
	CreatedAt       uint64 `field:"createdAt"`       // 创建时间
 | 
						CreatedAt       uint64   `field:"createdAt"`       // 创建时间
 | 
				
			||||||
	ConnTimeout     string `field:"connTimeout"`     // 连接超时时间
 | 
						ConnTimeout     dbs.JSON `field:"connTimeout"`     // 连接超时时间
 | 
				
			||||||
	ReadTimeout     string `field:"readTimeout"`     // 读取超时时间
 | 
						ReadTimeout     dbs.JSON `field:"readTimeout"`     // 读取超时时间
 | 
				
			||||||
	IdleTimeout     string `field:"idleTimeout"`     // 空闲超时时间
 | 
						IdleTimeout     dbs.JSON `field:"idleTimeout"`     // 空闲超时时间
 | 
				
			||||||
	MaxConns        uint32 `field:"maxConns"`        // 最大并发连接数
 | 
						MaxConns        uint32   `field:"maxConns"`        // 最大并发连接数
 | 
				
			||||||
	MaxIdleConns    uint32 `field:"maxIdleConns"`    // 最大空闲连接数
 | 
						MaxIdleConns    uint32   `field:"maxIdleConns"`    // 最大空闲连接数
 | 
				
			||||||
	ProxyProtocol   string `field:"proxyProtocol"`   // Proxy Protocol配置
 | 
						ProxyProtocol   dbs.JSON `field:"proxyProtocol"`   // Proxy Protocol配置
 | 
				
			||||||
	FollowRedirects uint8  `field:"followRedirects"` // 回源跟随
 | 
						FollowRedirects uint8    `field:"followRedirects"` // 回源跟随
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ReverseProxyOperator struct {
 | 
					type ReverseProxyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -145,12 +145,12 @@ func (this *ServerDAO) CreateServer(tx *dbs.Tx,
 | 
				
			|||||||
	serverNamesJSON []byte,
 | 
						serverNamesJSON []byte,
 | 
				
			||||||
	isAuditing bool,
 | 
						isAuditing bool,
 | 
				
			||||||
	auditingServerNamesJSON []byte,
 | 
						auditingServerNamesJSON []byte,
 | 
				
			||||||
	httpJSON string,
 | 
						httpJSON []byte,
 | 
				
			||||||
	httpsJSON string,
 | 
						httpsJSON []byte,
 | 
				
			||||||
	tcpJSON string,
 | 
						tcpJSON []byte,
 | 
				
			||||||
	tlsJSON string,
 | 
						tlsJSON []byte,
 | 
				
			||||||
	unixJSON string,
 | 
						unixJSON []byte,
 | 
				
			||||||
	udpJSON string,
 | 
						udpJSON []byte,
 | 
				
			||||||
	webId int64,
 | 
						webId int64,
 | 
				
			||||||
	reverseProxyJSON []byte,
 | 
						reverseProxyJSON []byte,
 | 
				
			||||||
	clusterId int64,
 | 
						clusterId int64,
 | 
				
			||||||
@@ -550,7 +550,7 @@ func (this *ServerDAO) FindServerServerNames(tx *dbs.Tx, serverId int64) (server
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	server := one.(*Server)
 | 
						server := one.(*Server)
 | 
				
			||||||
	return []byte(server.ServerNames), server.IsAuditing == 1, int64(server.AuditingAt), []byte(server.AuditingServerNames), []byte(server.AuditingResult), nil
 | 
						return server.ServerNames, server.IsAuditing == 1, int64(server.AuditingAt), server.AuditingServerNames, server.AuditingResult, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// UpdateServerNames 修改ServerNames配置
 | 
					// UpdateServerNames 修改ServerNames配置
 | 
				
			||||||
@@ -909,9 +909,9 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	config.Group = groupConfig
 | 
						config.Group = groupConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// ServerNames
 | 
						// ServerNames
 | 
				
			||||||
	if len(server.ServerNames) > 0 && server.ServerNames != "null" {
 | 
						if IsNotNull(server.ServerNames) {
 | 
				
			||||||
		serverNames := []*serverconfigs.ServerNameConfig{}
 | 
							serverNames := []*serverconfigs.ServerNameConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.ServerNames), &serverNames)
 | 
							err := json.Unmarshal(server.ServerNames, &serverNames)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -938,9 +938,9 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// HTTP
 | 
						// HTTP
 | 
				
			||||||
	if len(server.Http) > 0 && server.Http != "null" {
 | 
						if IsNotNull(server.Http) {
 | 
				
			||||||
		httpConfig := &serverconfigs.HTTPProtocolConfig{}
 | 
							httpConfig := &serverconfigs.HTTPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Http), httpConfig)
 | 
							err := json.Unmarshal(server.Http, httpConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -948,9 +948,9 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// HTTPS
 | 
						// HTTPS
 | 
				
			||||||
	if len(server.Https) > 0 && server.Https != "null" {
 | 
						if IsNotNull(server.Https) {
 | 
				
			||||||
		httpsConfig := &serverconfigs.HTTPSProtocolConfig{}
 | 
							httpsConfig := &serverconfigs.HTTPSProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Https), httpsConfig)
 | 
							err := json.Unmarshal(server.Https, httpsConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -970,9 +970,9 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TCP
 | 
						// TCP
 | 
				
			||||||
	if len(server.Tcp) > 0 && server.Tcp != "null" {
 | 
						if IsNotNull(server.Tcp) {
 | 
				
			||||||
		tcpConfig := &serverconfigs.TCPProtocolConfig{}
 | 
							tcpConfig := &serverconfigs.TCPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Tcp), tcpConfig)
 | 
							err := json.Unmarshal(server.Tcp, tcpConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -980,9 +980,9 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TLS
 | 
						// TLS
 | 
				
			||||||
	if len(server.Tls) > 0 && server.Tls != "null" {
 | 
						if IsNotNull(server.Tls) {
 | 
				
			||||||
		tlsConfig := &serverconfigs.TLSProtocolConfig{}
 | 
							tlsConfig := &serverconfigs.TLSProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Tls), tlsConfig)
 | 
							err := json.Unmarshal(server.Tls, tlsConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1002,9 +1002,9 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Unix
 | 
						// Unix
 | 
				
			||||||
	if len(server.Unix) > 0 && server.Unix != "null" {
 | 
						if IsNotNull(server.Unix) {
 | 
				
			||||||
		unixConfig := &serverconfigs.UnixProtocolConfig{}
 | 
							unixConfig := &serverconfigs.UnixProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Unix), unixConfig)
 | 
							err := json.Unmarshal(server.Unix, unixConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1012,9 +1012,9 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// UDP
 | 
						// UDP
 | 
				
			||||||
	if len(server.Udp) > 0 && server.Udp != "null" {
 | 
						if IsNotNull(server.Udp) {
 | 
				
			||||||
		udpConfig := &serverconfigs.UDPProtocolConfig{}
 | 
							udpConfig := &serverconfigs.UDPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Udp), udpConfig)
 | 
							err := json.Unmarshal(server.Udp, udpConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1035,7 +1035,7 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	// ReverseProxy
 | 
						// ReverseProxy
 | 
				
			||||||
	if IsNotNull(server.ReverseProxy) {
 | 
						if IsNotNull(server.ReverseProxy) {
 | 
				
			||||||
		reverseProxyRef := &serverconfigs.ReverseProxyRef{}
 | 
							reverseProxyRef := &serverconfigs.ReverseProxyRef{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.ReverseProxy), reverseProxyRef)
 | 
							err := json.Unmarshal(server.ReverseProxy, reverseProxyRef)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1072,7 +1072,7 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	// traffic limit
 | 
						// traffic limit
 | 
				
			||||||
	if len(server.TrafficLimit) > 0 {
 | 
						if len(server.TrafficLimit) > 0 {
 | 
				
			||||||
		var trafficLimitConfig = &serverconfigs.TrafficLimitConfig{}
 | 
							var trafficLimitConfig = &serverconfigs.TrafficLimitConfig{}
 | 
				
			||||||
		err = json.Unmarshal([]byte(server.TrafficLimit), trafficLimitConfig)
 | 
							err = json.Unmarshal(server.TrafficLimit, trafficLimitConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1106,7 +1106,7 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				if len(plan.TrafficLimit) > 0 && (config.TrafficLimit == nil || !config.TrafficLimit.IsOn) {
 | 
									if len(plan.TrafficLimit) > 0 && (config.TrafficLimit == nil || !config.TrafficLimit.IsOn) {
 | 
				
			||||||
					var trafficLimitConfig = &serverconfigs.TrafficLimitConfig{}
 | 
										var trafficLimitConfig = &serverconfigs.TrafficLimitConfig{}
 | 
				
			||||||
					err = json.Unmarshal([]byte(plan.TrafficLimit), trafficLimitConfig)
 | 
										err = json.Unmarshal(plan.TrafficLimit, trafficLimitConfig)
 | 
				
			||||||
					if err != nil {
 | 
										if err != nil {
 | 
				
			||||||
						return nil, err
 | 
											return nil, err
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
@@ -1119,7 +1119,7 @@ func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, cacheMap
 | 
				
			|||||||
	if config.TrafficLimit != nil && config.TrafficLimit.IsOn && !config.TrafficLimit.IsEmpty() {
 | 
						if config.TrafficLimit != nil && config.TrafficLimit.IsOn && !config.TrafficLimit.IsEmpty() {
 | 
				
			||||||
		if len(server.TrafficLimitStatus) > 0 {
 | 
							if len(server.TrafficLimitStatus) > 0 {
 | 
				
			||||||
			var status = &serverconfigs.TrafficLimitStatus{}
 | 
								var status = &serverconfigs.TrafficLimitStatus{}
 | 
				
			||||||
			err = json.Unmarshal([]byte(server.TrafficLimitStatus), status)
 | 
								err = json.Unmarshal(server.TrafficLimitStatus, status)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				return nil, err
 | 
									return nil, err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -1829,9 +1829,9 @@ func (this *ServerDAO) NotifyServerPortsUpdate(tx *dbs.Tx, serverId int64) error
 | 
				
			|||||||
	// HTTP
 | 
						// HTTP
 | 
				
			||||||
	var tcpListens = []*serverconfigs.NetworkAddressConfig{}
 | 
						var tcpListens = []*serverconfigs.NetworkAddressConfig{}
 | 
				
			||||||
	var udpListens = []*serverconfigs.NetworkAddressConfig{}
 | 
						var udpListens = []*serverconfigs.NetworkAddressConfig{}
 | 
				
			||||||
	if len(server.Http) > 0 && server.Http != "null" {
 | 
						if IsNotNull(server.Http) {
 | 
				
			||||||
		httpConfig := &serverconfigs.HTTPProtocolConfig{}
 | 
							httpConfig := &serverconfigs.HTTPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Http), httpConfig)
 | 
							err := json.Unmarshal(server.Http, httpConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1839,9 +1839,9 @@ func (this *ServerDAO) NotifyServerPortsUpdate(tx *dbs.Tx, serverId int64) error
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// HTTPS
 | 
						// HTTPS
 | 
				
			||||||
	if len(server.Https) > 0 && server.Https != "null" {
 | 
						if IsNotNull(server.Https) {
 | 
				
			||||||
		httpsConfig := &serverconfigs.HTTPSProtocolConfig{}
 | 
							httpsConfig := &serverconfigs.HTTPSProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Https), httpsConfig)
 | 
							err := json.Unmarshal(server.Https, httpsConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1849,9 +1849,9 @@ func (this *ServerDAO) NotifyServerPortsUpdate(tx *dbs.Tx, serverId int64) error
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TCP
 | 
						// TCP
 | 
				
			||||||
	if len(server.Tcp) > 0 && server.Tcp != "null" {
 | 
						if IsNotNull(server.Tcp) {
 | 
				
			||||||
		tcpConfig := &serverconfigs.TCPProtocolConfig{}
 | 
							tcpConfig := &serverconfigs.TCPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Tcp), tcpConfig)
 | 
							err := json.Unmarshal(server.Tcp, tcpConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1859,9 +1859,9 @@ func (this *ServerDAO) NotifyServerPortsUpdate(tx *dbs.Tx, serverId int64) error
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TLS
 | 
						// TLS
 | 
				
			||||||
	if len(server.Tls) > 0 && server.Tls != "null" {
 | 
						if IsNotNull(server.Tls) {
 | 
				
			||||||
		tlsConfig := &serverconfigs.TLSProtocolConfig{}
 | 
							tlsConfig := &serverconfigs.TLSProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Tls), tlsConfig)
 | 
							err := json.Unmarshal(server.Tls, tlsConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1869,9 +1869,9 @@ func (this *ServerDAO) NotifyServerPortsUpdate(tx *dbs.Tx, serverId int64) error
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// UDP
 | 
						// UDP
 | 
				
			||||||
	if len(server.Udp) > 0 && server.Udp != "null" {
 | 
						if IsNotNull(server.Udp) {
 | 
				
			||||||
		udpConfig := &serverconfigs.UDPProtocolConfig{}
 | 
							udpConfig := &serverconfigs.UDPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(server.Udp), udpConfig)
 | 
							err := json.Unmarshal(server.Udp, udpConfig)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -2006,7 +2006,7 @@ func (this *ServerDAO) CalculateServerTrafficLimitConfig(tx *dbs.Tx, serverId in
 | 
				
			|||||||
		return limitConfig, nil
 | 
							return limitConfig, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = json.Unmarshal([]byte(trafficLimit), limitConfig)
 | 
						err = json.Unmarshal(trafficLimit, limitConfig)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -2081,8 +2081,8 @@ func (this *ServerDAO) UpdateServerTrafficLimitStatus(tx *dbs.Tx, trafficLimitCo
 | 
				
			|||||||
	var server = serverOne.(*Server)
 | 
						var server = serverOne.(*Server)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var oldStatus = &serverconfigs.TrafficLimitStatus{}
 | 
						var oldStatus = &serverconfigs.TrafficLimitStatus{}
 | 
				
			||||||
	if len(server.TrafficLimitStatus) > 0 {
 | 
						if IsNotNull(server.TrafficLimitStatus) {
 | 
				
			||||||
		err = json.Unmarshal([]byte(server.TrafficLimitStatus), oldStatus)
 | 
							err = json.Unmarshal(server.TrafficLimitStatus, oldStatus)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -186,7 +186,7 @@ func TestServerDAO_FindAllEnabledServersWithDomain(t *testing.T) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		if len(servers) > 0 {
 | 
							if len(servers) > 0 {
 | 
				
			||||||
			for _, server := range servers {
 | 
								for _, server := range servers {
 | 
				
			||||||
				t.Log(domain + ": " + server.ServerNames)
 | 
									t.Log(domain + ": " + string(server.ServerNames))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			t.Log(domain + ": not found")
 | 
								t.Log(domain + ": not found")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,21 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ServerGroup 服务分组
 | 
					// ServerGroup 服务分组
 | 
				
			||||||
type ServerGroup struct {
 | 
					type ServerGroup struct {
 | 
				
			||||||
	Id               uint32 `field:"id"`               // ID
 | 
						Id               uint32   `field:"id"`               // ID
 | 
				
			||||||
	AdminId          uint32 `field:"adminId"`          // 管理员ID
 | 
						AdminId          uint32   `field:"adminId"`          // 管理员ID
 | 
				
			||||||
	UserId           uint32 `field:"userId"`           // 用户ID
 | 
						UserId           uint32   `field:"userId"`           // 用户ID
 | 
				
			||||||
	IsOn             uint8  `field:"isOn"`             // 是否启用
 | 
						IsOn             uint8    `field:"isOn"`             // 是否启用
 | 
				
			||||||
	Name             string `field:"name"`             // 名称
 | 
						Name             string   `field:"name"`             // 名称
 | 
				
			||||||
	Order            uint32 `field:"order"`            // 排序
 | 
						Order            uint32   `field:"order"`            // 排序
 | 
				
			||||||
	CreatedAt        uint64 `field:"createdAt"`        // 创建时间
 | 
						CreatedAt        uint64   `field:"createdAt"`        // 创建时间
 | 
				
			||||||
	State            uint8  `field:"state"`            // 状态
 | 
						State            uint8    `field:"state"`            // 状态
 | 
				
			||||||
	HttpReverseProxy string `field:"httpReverseProxy"` // 反向代理设置
 | 
						HttpReverseProxy dbs.JSON `field:"httpReverseProxy"` // 反向代理设置
 | 
				
			||||||
	TcpReverseProxy  string `field:"tcpReverseProxy"`  // TCP反向代理
 | 
						TcpReverseProxy  dbs.JSON `field:"tcpReverseProxy"`  // TCP反向代理
 | 
				
			||||||
	UdpReverseProxy  string `field:"udpReverseProxy"`  // UDP反向代理
 | 
						UdpReverseProxy  dbs.JSON `field:"udpReverseProxy"`  // UDP反向代理
 | 
				
			||||||
	WebId            uint32 `field:"webId"`            // Web配置ID
 | 
						WebId            uint32   `field:"webId"`            // Web配置ID
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ServerGroupOperator struct {
 | 
					type ServerGroupOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,49 +1,51 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Server 服务
 | 
					// Server 服务
 | 
				
			||||||
type Server struct {
 | 
					type Server struct {
 | 
				
			||||||
	Id                  uint32  `field:"id"`                  // ID
 | 
						Id                  uint32   `field:"id"`                  // ID
 | 
				
			||||||
	IsOn                uint8   `field:"isOn"`                // 是否启用
 | 
						IsOn                uint8    `field:"isOn"`                // 是否启用
 | 
				
			||||||
	UserId              uint32  `field:"userId"`              // 用户ID
 | 
						UserId              uint32   `field:"userId"`              // 用户ID
 | 
				
			||||||
	AdminId             uint32  `field:"adminId"`             // 管理员ID
 | 
						AdminId             uint32   `field:"adminId"`             // 管理员ID
 | 
				
			||||||
	Type                string  `field:"type"`                // 服务类型
 | 
						Type                string   `field:"type"`                // 服务类型
 | 
				
			||||||
	Name                string  `field:"name"`                // 名称
 | 
						Name                string   `field:"name"`                // 名称
 | 
				
			||||||
	Description         string  `field:"description"`         // 描述
 | 
						Description         string   `field:"description"`         // 描述
 | 
				
			||||||
	ServerNames         string  `field:"serverNames"`         // 域名列表
 | 
						ServerNames         dbs.JSON `field:"serverNames"`         // 域名列表
 | 
				
			||||||
	AuditingAt          uint64  `field:"auditingAt"`          // 审核提交时间
 | 
						AuditingAt          uint64   `field:"auditingAt"`          // 审核提交时间
 | 
				
			||||||
	AuditingServerNames string  `field:"auditingServerNames"` // 审核中的域名
 | 
						AuditingServerNames dbs.JSON `field:"auditingServerNames"` // 审核中的域名
 | 
				
			||||||
	IsAuditing          uint8   `field:"isAuditing"`          // 是否正在审核
 | 
						IsAuditing          uint8    `field:"isAuditing"`          // 是否正在审核
 | 
				
			||||||
	AuditingResult      string  `field:"auditingResult"`      // 审核结果
 | 
						AuditingResult      dbs.JSON `field:"auditingResult"`      // 审核结果
 | 
				
			||||||
	Http                string  `field:"http"`                // HTTP配置
 | 
						Http                dbs.JSON `field:"http"`                // HTTP配置
 | 
				
			||||||
	Https               string  `field:"https"`               // HTTPS配置
 | 
						Https               dbs.JSON `field:"https"`               // HTTPS配置
 | 
				
			||||||
	Tcp                 string  `field:"tcp"`                 // TCP配置
 | 
						Tcp                 dbs.JSON `field:"tcp"`                 // TCP配置
 | 
				
			||||||
	Tls                 string  `field:"tls"`                 // TLS配置
 | 
						Tls                 dbs.JSON `field:"tls"`                 // TLS配置
 | 
				
			||||||
	Unix                string  `field:"unix"`                // Unix配置
 | 
						Unix                dbs.JSON `field:"unix"`                // Unix配置
 | 
				
			||||||
	Udp                 string  `field:"udp"`                 // UDP配置
 | 
						Udp                 dbs.JSON `field:"udp"`                 // UDP配置
 | 
				
			||||||
	WebId               uint32  `field:"webId"`               // WEB配置
 | 
						WebId               uint32   `field:"webId"`               // WEB配置
 | 
				
			||||||
	ReverseProxy        string  `field:"reverseProxy"`        // 反向代理配置
 | 
						ReverseProxy        dbs.JSON `field:"reverseProxy"`        // 反向代理配置
 | 
				
			||||||
	GroupIds            string  `field:"groupIds"`            // 分组ID列表
 | 
						GroupIds            dbs.JSON `field:"groupIds"`            // 分组ID列表
 | 
				
			||||||
	Config              string  `field:"config"`              // 服务配置,自动生成
 | 
						Config              dbs.JSON `field:"config"`              // 服务配置,自动生成
 | 
				
			||||||
	ConfigMd5           string  `field:"configMd5"`           // Md5
 | 
						ConfigMd5           string   `field:"configMd5"`           // Md5
 | 
				
			||||||
	ClusterId           uint32  `field:"clusterId"`           // 集群ID
 | 
						ClusterId           uint32   `field:"clusterId"`           // 集群ID
 | 
				
			||||||
	IncludeNodes        string  `field:"includeNodes"`        // 部署条件
 | 
						IncludeNodes        dbs.JSON `field:"includeNodes"`        // 部署条件
 | 
				
			||||||
	ExcludeNodes        string  `field:"excludeNodes"`        // 节点排除条件
 | 
						ExcludeNodes        dbs.JSON `field:"excludeNodes"`        // 节点排除条件
 | 
				
			||||||
	Version             uint32  `field:"version"`             // 版本号
 | 
						Version             uint32   `field:"version"`             // 版本号
 | 
				
			||||||
	CreatedAt           uint64  `field:"createdAt"`           // 创建时间
 | 
						CreatedAt           uint64   `field:"createdAt"`           // 创建时间
 | 
				
			||||||
	State               uint8   `field:"state"`               // 状态
 | 
						State               uint8    `field:"state"`               // 状态
 | 
				
			||||||
	DnsName             string  `field:"dnsName"`             // DNS名称
 | 
						DnsName             string   `field:"dnsName"`             // DNS名称
 | 
				
			||||||
	TcpPorts            string  `field:"tcpPorts"`            // 所包含TCP端口
 | 
						TcpPorts            dbs.JSON `field:"tcpPorts"`            // 所包含TCP端口
 | 
				
			||||||
	UdpPorts            string  `field:"udpPorts"`            // 所包含UDP端口
 | 
						UdpPorts            dbs.JSON `field:"udpPorts"`            // 所包含UDP端口
 | 
				
			||||||
	SupportCNAME        uint8   `field:"supportCNAME"`        // 允许CNAME不在域名名单
 | 
						SupportCNAME        uint8    `field:"supportCNAME"`        // 允许CNAME不在域名名单
 | 
				
			||||||
	TrafficLimit        string  `field:"trafficLimit"`        // 流量限制
 | 
						TrafficLimit        dbs.JSON `field:"trafficLimit"`        // 流量限制
 | 
				
			||||||
	TrafficDay          string  `field:"trafficDay"`          // YYYYMMDD
 | 
						TrafficDay          string   `field:"trafficDay"`          // YYYYMMDD
 | 
				
			||||||
	TrafficMonth        string  `field:"trafficMonth"`        // YYYYMM
 | 
						TrafficMonth        string   `field:"trafficMonth"`        // YYYYMM
 | 
				
			||||||
	TotalDailyTraffic   float64 `field:"totalDailyTraffic"`   // 日流量
 | 
						TotalDailyTraffic   float64  `field:"totalDailyTraffic"`   // 日流量
 | 
				
			||||||
	TotalMonthlyTraffic float64 `field:"totalMonthlyTraffic"` // 月流量
 | 
						TotalMonthlyTraffic float64  `field:"totalMonthlyTraffic"` // 月流量
 | 
				
			||||||
	TrafficLimitStatus  string  `field:"trafficLimitStatus"`  // 流量限制状态
 | 
						TrafficLimitStatus  dbs.JSON `field:"trafficLimitStatus"`  // 流量限制状态
 | 
				
			||||||
	TotalTraffic        float64 `field:"totalTraffic"`        // 总流量
 | 
						TotalTraffic        float64  `field:"totalTraffic"`        // 总流量
 | 
				
			||||||
	UserPlanId          uint32  `field:"userPlanId"`          // 所属套餐ID
 | 
						UserPlanId          uint32   `field:"userPlanId"`          // 所属套餐ID
 | 
				
			||||||
	LastUserPlanId      uint32  `field:"lastUserPlanId"`      // 上一次使用的套餐
 | 
						LastUserPlanId      uint32   `field:"lastUserPlanId"`      // 上一次使用的套餐
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ServerOperator struct {
 | 
					type ServerOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ func (this *Server) DecodeGroupIds() []int64 {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var result = []int64{}
 | 
						var result = []int64{}
 | 
				
			||||||
	err := json.Unmarshal([]byte(this.GroupIds), &result)
 | 
						err := json.Unmarshal(this.GroupIds, &result)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		remotelogs.Error("Server.DecodeGroupIds", err.Error())
 | 
							remotelogs.Error("Server.DecodeGroupIds", err.Error())
 | 
				
			||||||
		// 忽略错误
 | 
							// 忽略错误
 | 
				
			||||||
@@ -23,9 +23,9 @@ func (this *Server) DecodeGroupIds() []int64 {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeHTTPPorts 获取HTTP所有端口
 | 
					// DecodeHTTPPorts 获取HTTP所有端口
 | 
				
			||||||
func (this *Server) DecodeHTTPPorts() (ports []int) {
 | 
					func (this *Server) DecodeHTTPPorts() (ports []int) {
 | 
				
			||||||
	if len(this.Http) > 0 && this.Http != "null" {
 | 
						if len(this.Http) > 0 {
 | 
				
			||||||
		config := &serverconfigs.HTTPProtocolConfig{}
 | 
							config := &serverconfigs.HTTPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(this.Http), config)
 | 
							err := json.Unmarshal(this.Http, config)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil
 | 
								return nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -44,9 +44,9 @@ func (this *Server) DecodeHTTPPorts() (ports []int) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeHTTPSPorts 获取HTTPS所有端口
 | 
					// DecodeHTTPSPorts 获取HTTPS所有端口
 | 
				
			||||||
func (this *Server) DecodeHTTPSPorts() (ports []int) {
 | 
					func (this *Server) DecodeHTTPSPorts() (ports []int) {
 | 
				
			||||||
	if len(this.Https) > 0 && this.Https != "null" {
 | 
						if len(this.Https) > 0 {
 | 
				
			||||||
		config := &serverconfigs.HTTPSProtocolConfig{}
 | 
							config := &serverconfigs.HTTPSProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(this.Https), config)
 | 
							err := json.Unmarshal(this.Https, config)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil
 | 
								return nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -65,9 +65,9 @@ func (this *Server) DecodeHTTPSPorts() (ports []int) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeTCPPorts 获取TCP所有端口
 | 
					// DecodeTCPPorts 获取TCP所有端口
 | 
				
			||||||
func (this *Server) DecodeTCPPorts() (ports []int) {
 | 
					func (this *Server) DecodeTCPPorts() (ports []int) {
 | 
				
			||||||
	if len(this.Tcp) > 0 && this.Tcp != "null" {
 | 
						if len(this.Tcp) > 0 {
 | 
				
			||||||
		config := &serverconfigs.TCPProtocolConfig{}
 | 
							config := &serverconfigs.TCPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(this.Tcp), config)
 | 
							err := json.Unmarshal(this.Tcp, config)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil
 | 
								return nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -86,9 +86,9 @@ func (this *Server) DecodeTCPPorts() (ports []int) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeTLSPorts 获取TLS所有端口
 | 
					// DecodeTLSPorts 获取TLS所有端口
 | 
				
			||||||
func (this *Server) DecodeTLSPorts() (ports []int) {
 | 
					func (this *Server) DecodeTLSPorts() (ports []int) {
 | 
				
			||||||
	if len(this.Tls) > 0 && this.Tls != "null" {
 | 
						if len(this.Tls) > 0 {
 | 
				
			||||||
		config := &serverconfigs.TLSProtocolConfig{}
 | 
							config := &serverconfigs.TLSProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(this.Tls), config)
 | 
							err := json.Unmarshal(this.Tls, config)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil
 | 
								return nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -107,9 +107,9 @@ func (this *Server) DecodeTLSPorts() (ports []int) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// DecodeUDPPorts 获取UDP所有端口
 | 
					// DecodeUDPPorts 获取UDP所有端口
 | 
				
			||||||
func (this *Server) DecodeUDPPorts() (ports []int) {
 | 
					func (this *Server) DecodeUDPPorts() (ports []int) {
 | 
				
			||||||
	if len(this.Udp) > 0 && this.Udp != "null" {
 | 
						if len(this.Udp) > 0 {
 | 
				
			||||||
		config := &serverconfigs.UDPProtocolConfig{}
 | 
							config := &serverconfigs.UDPProtocolConfig{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(this.Udp), config)
 | 
							err := json.Unmarshal(this.Udp, config)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil
 | 
								return nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -148,7 +148,7 @@ func (this *SSLCertDAO) UpdateCert(tx *dbs.Tx,
 | 
				
			|||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	var oldCert = oldOne.(*SSLCert)
 | 
						var oldCert = oldOne.(*SSLCert)
 | 
				
			||||||
	var dataIsChanged = bytes.Compare(certData, []byte(oldCert.CertData)) != 0 || bytes.Compare(keyData, []byte(oldCert.KeyData)) != 0
 | 
						var dataIsChanged = bytes.Compare(certData, oldCert.CertData) != 0 || bytes.Compare(keyData, oldCert.KeyData) != 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var op = NewSSLCertOperator()
 | 
						var op = NewSSLCertOperator()
 | 
				
			||||||
	op.Id = certId
 | 
						op.Id = certId
 | 
				
			||||||
@@ -224,31 +224,31 @@ func (this *SSLCertDAO) ComposeCertConfig(tx *dbs.Tx, certId int64, cacheMap *ut
 | 
				
			|||||||
	config.IsACME = cert.IsACME == 1
 | 
						config.IsACME = cert.IsACME == 1
 | 
				
			||||||
	config.Name = cert.Name
 | 
						config.Name = cert.Name
 | 
				
			||||||
	config.Description = cert.Description
 | 
						config.Description = cert.Description
 | 
				
			||||||
	config.CertData = []byte(cert.CertData)
 | 
						config.CertData = cert.CertData
 | 
				
			||||||
	config.KeyData = []byte(cert.KeyData)
 | 
						config.KeyData = cert.KeyData
 | 
				
			||||||
	config.ServerName = cert.ServerName
 | 
						config.ServerName = cert.ServerName
 | 
				
			||||||
	config.TimeBeginAt = int64(cert.TimeBeginAt)
 | 
						config.TimeBeginAt = int64(cert.TimeBeginAt)
 | 
				
			||||||
	config.TimeEndAt = int64(cert.TimeEndAt)
 | 
						config.TimeEndAt = int64(cert.TimeEndAt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// OCSP
 | 
						// OCSP
 | 
				
			||||||
	if int64(cert.OcspExpiresAt) > time.Now().Unix() {
 | 
						if int64(cert.OcspExpiresAt) > time.Now().Unix() {
 | 
				
			||||||
		config.OCSP = []byte(cert.Ocsp)
 | 
							config.OCSP = cert.Ocsp
 | 
				
			||||||
		config.OCSPExpiresAt = int64(cert.OcspExpiresAt)
 | 
							config.OCSPExpiresAt = int64(cert.OcspExpiresAt)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	config.OCSPError = cert.OcspError
 | 
						config.OCSPError = cert.OcspError
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if IsNotNull(cert.DnsNames) {
 | 
						if IsNotNull(cert.DnsNames) {
 | 
				
			||||||
		dnsNames := []string{}
 | 
							dnsNames := []string{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(cert.DnsNames), &dnsNames)
 | 
							err := json.Unmarshal(cert.DnsNames, &dnsNames)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		config.DNSNames = dnsNames
 | 
							config.DNSNames = dnsNames
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if IsNotNull(cert.CommonNames) {
 | 
						if cert.CommonNames.IsNotNull() {
 | 
				
			||||||
		commonNames := []string{}
 | 
							commonNames := []string{}
 | 
				
			||||||
		err := json.Unmarshal([]byte(cert.CommonNames), &commonNames)
 | 
							err := json.Unmarshal(cert.CommonNames, &commonNames)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,240 @@
 | 
				
			|||||||
package models_test
 | 
					package models_test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"encoding/json"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
						"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
				
			||||||
	_ "github.com/go-sql-driver/mysql"
 | 
						_ "github.com/go-sql-driver/mysql"
 | 
				
			||||||
 | 
						"github.com/iwind/TeaGo/assert"
 | 
				
			||||||
 | 
						"github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
	timeutil "github.com/iwind/TeaGo/utils/time"
 | 
						timeutil "github.com/iwind/TeaGo/utils/time"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestSSLCertDAO_ListCertsToUpdateOCSP(t *testing.T) {
 | 
					func TestSSLCertDAO_ListCertsToUpdateOCSP(t *testing.T) {
 | 
				
			||||||
	var dao = models.NewSSLCertDAO()
 | 
						var dao = models.NewSSLCertDAO()
 | 
				
			||||||
	certs, err := dao.ListCertsToUpdateOCSP(nil, 3600, 10)
 | 
						certs, err := dao.ListCertsToUpdateOCSP(nil, 3, 10)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, cert := range certs {
 | 
						for _, cert := range certs {
 | 
				
			||||||
		t.Log(cert.Id, cert.Name, "updatedAt:", cert.OcspUpdatedAt, timeutil.FormatTime("Y-m-d H:i:s", int64(cert.OcspUpdatedAt)), cert.OcspIsUpdated)
 | 
							t.Log(cert.Id, cert.Name, "updatedAt:", cert.OcspUpdatedAt, timeutil.FormatTime("Y-m-d H:i:s", int64(cert.OcspUpdatedAt)), cert.OcspIsUpdated, string(cert.Ocsp))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestSSLCertDAO_Update_Blob(t *testing.T) {
 | 
				
			||||||
 | 
						var a = assert.NewAssertion(t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var certId = 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("ocsp", 123).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
							if one != nil {
 | 
				
			||||||
 | 
								a.IsTrue(string(one.(*models.SSLCert).Ocsp) == "123")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("ocsp", 456).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
							if one != nil {
 | 
				
			||||||
 | 
								a.IsTrue(string(one.(*models.SSLCert).Ocsp) == "456")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("ocsp", []byte("789")).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
							if one != nil {
 | 
				
			||||||
 | 
								a.IsTrue(string(one.(*models.SSLCert).Ocsp) == "789")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("ocsp", []byte("")).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
							if one != nil {
 | 
				
			||||||
 | 
								a.IsTrue(string(one.(*models.SSLCert).Ocsp) == "")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("ocsp", nil).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
							if one != nil {
 | 
				
			||||||
 | 
								a.IsTrue(string(one.(*models.SSLCert).Ocsp) == "")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("ocsp", []byte("1.2.3")).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
							if one != nil {
 | 
				
			||||||
 | 
								a.IsTrue(string(one.(*models.SSLCert).Ocsp) == "1.2.3")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestSSLCertDAO_Update_JSON(t *testing.T) {
 | 
				
			||||||
 | 
						var a = assert.NewAssertion(t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var certId = 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("commonNames", []byte("null")).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
							if one != nil {
 | 
				
			||||||
 | 
								a.IsTrue(string(one.(*models.SSLCert).CommonNames) == "null")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("commonNames", dbs.JSON(`["a","b"]`)).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
								if one != nil {
 | 
				
			||||||
 | 
									a.IsTrue(string(one.(*models.SSLCert).CommonNames) == `["a", "b"]`)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								commonNames, _ := dao.Query(nil).Pk(certId).Result("commonNames").FindBytesCol()
 | 
				
			||||||
 | 
								t.Log("commonNames:", commonNames)
 | 
				
			||||||
 | 
								a.IsTrue(string(commonNames) == `["a", "b"]`)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var op = models.NewSSLCertOperator()
 | 
				
			||||||
 | 
							op.Id = certId
 | 
				
			||||||
 | 
							op.CommonNames = dbs.JSON(`["a", "b"]`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Save(nil, op)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								commonNames, _ := dao.Query(nil).Pk(certId).Result("commonNames").FindBytesCol()
 | 
				
			||||||
 | 
								t.Log("commonNames:", commonNames)
 | 
				
			||||||
 | 
								a.IsTrue(string(commonNames) == `["a", "b"]`)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var op = models.NewSSLCertOperator()
 | 
				
			||||||
 | 
							op.Id = certId
 | 
				
			||||||
 | 
							op.CommonNames = []byte(`["a", "b"]`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Save(nil, op)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								commonNames, _ := dao.Query(nil).Pk(certId).Result("commonNames").FindBytesCol()
 | 
				
			||||||
 | 
								t.Log("commonNames:", commonNames)
 | 
				
			||||||
 | 
								a.IsTrue(string(commonNames) == `["a", "b"]`)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var dao = models.NewSSLCertDAO()
 | 
				
			||||||
 | 
							err := dao.Query(nil).
 | 
				
			||||||
 | 
								Pk(certId).
 | 
				
			||||||
 | 
								Set("commonNames", []byte("")).
 | 
				
			||||||
 | 
								UpdateQuickly()
 | 
				
			||||||
 | 
							a.IsTrue(err != nil)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								a.Log("expected has error:", err.Error())
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							one, _ := dao.Query(nil).Pk(certId).Find()
 | 
				
			||||||
 | 
							if one != nil {
 | 
				
			||||||
 | 
								a.IsTrue(string(one.(*models.SSLCert).CommonNames) == `["a", "b"]`)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var commonNames = []string{}
 | 
				
			||||||
 | 
							err := json.Unmarshal([]byte("null"), &commonNames)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							t.Log(commonNames)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							var cert = &models.SSLCert{}
 | 
				
			||||||
 | 
							err := json.Unmarshal([]byte("null"), &cert)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Fatal(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							t.Log(cert)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,35 +1,37 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SSLCert SSL证书
 | 
					// SSLCert SSL证书
 | 
				
			||||||
type SSLCert struct {
 | 
					type SSLCert struct {
 | 
				
			||||||
	Id                 uint32 `field:"id"`                 // ID
 | 
						Id                 uint32   `field:"id"`                 // ID
 | 
				
			||||||
	AdminId            uint32 `field:"adminId"`            // 管理员ID
 | 
						AdminId            uint32   `field:"adminId"`            // 管理员ID
 | 
				
			||||||
	UserId             uint32 `field:"userId"`             // 用户ID
 | 
						UserId             uint32   `field:"userId"`             // 用户ID
 | 
				
			||||||
	State              uint8  `field:"state"`              // 状态
 | 
						State              uint8    `field:"state"`              // 状态
 | 
				
			||||||
	CreatedAt          uint64 `field:"createdAt"`          // 创建时间
 | 
						CreatedAt          uint64   `field:"createdAt"`          // 创建时间
 | 
				
			||||||
	UpdatedAt          uint64 `field:"updatedAt"`          // 修改时间
 | 
						UpdatedAt          uint64   `field:"updatedAt"`          // 修改时间
 | 
				
			||||||
	IsOn               uint8  `field:"isOn"`               // 是否启用
 | 
						IsOn               uint8    `field:"isOn"`               // 是否启用
 | 
				
			||||||
	Name               string `field:"name"`               // 证书名
 | 
						Name               string   `field:"name"`               // 证书名
 | 
				
			||||||
	Description        string `field:"description"`        // 描述
 | 
						Description        string   `field:"description"`        // 描述
 | 
				
			||||||
	CertData           string `field:"certData"`           // 证书内容
 | 
						CertData           []byte   `field:"certData"`           // 证书内容
 | 
				
			||||||
	KeyData            string `field:"keyData"`            // 密钥内容
 | 
						KeyData            []byte   `field:"keyData"`            // 密钥内容
 | 
				
			||||||
	ServerName         string `field:"serverName"`         // 证书使用的主机名
 | 
						ServerName         string   `field:"serverName"`         // 证书使用的主机名
 | 
				
			||||||
	IsCA               uint8  `field:"isCA"`               // 是否为CA证书
 | 
						IsCA               uint8    `field:"isCA"`               // 是否为CA证书
 | 
				
			||||||
	GroupIds           string `field:"groupIds"`           // 证书分组
 | 
						GroupIds           dbs.JSON `field:"groupIds"`           // 证书分组
 | 
				
			||||||
	TimeBeginAt        uint64 `field:"timeBeginAt"`        // 开始时间
 | 
						TimeBeginAt        uint64   `field:"timeBeginAt"`        // 开始时间
 | 
				
			||||||
	TimeEndAt          uint64 `field:"timeEndAt"`          // 结束时间
 | 
						TimeEndAt          uint64   `field:"timeEndAt"`          // 结束时间
 | 
				
			||||||
	DnsNames           string `field:"dnsNames"`           // DNS名称列表
 | 
						DnsNames           dbs.JSON `field:"dnsNames"`           // DNS名称列表
 | 
				
			||||||
	CommonNames        string `field:"commonNames"`        // 发行单位列表
 | 
						CommonNames        dbs.JSON `field:"commonNames"`        // 发行单位列表
 | 
				
			||||||
	IsACME             uint8  `field:"isACME"`             // 是否为ACME自动生成的
 | 
						IsACME             uint8    `field:"isACME"`             // 是否为ACME自动生成的
 | 
				
			||||||
	AcmeTaskId         uint64 `field:"acmeTaskId"`         // ACME任务ID
 | 
						AcmeTaskId         uint64   `field:"acmeTaskId"`         // ACME任务ID
 | 
				
			||||||
	NotifiedAt         uint64 `field:"notifiedAt"`         // 最后通知时间
 | 
						NotifiedAt         uint64   `field:"notifiedAt"`         // 最后通知时间
 | 
				
			||||||
	Ocsp               string `field:"ocsp"`               // OCSP缓存
 | 
						Ocsp               []byte   `field:"ocsp"`               // OCSP缓存
 | 
				
			||||||
	OcspIsUpdated      uint8  `field:"ocspIsUpdated"`      // OCSP是否已更新
 | 
						OcspIsUpdated      uint8    `field:"ocspIsUpdated"`      // OCSP是否已更新
 | 
				
			||||||
	OcspUpdatedAt      uint64 `field:"ocspUpdatedAt"`      // OCSP更新时间
 | 
						OcspUpdatedAt      uint64   `field:"ocspUpdatedAt"`      // OCSP更新时间
 | 
				
			||||||
	OcspError          string `field:"ocspError"`          // OCSP更新错误
 | 
						OcspError          string   `field:"ocspError"`          // OCSP更新错误
 | 
				
			||||||
	OcspUpdatedVersion uint64 `field:"ocspUpdatedVersion"` // OCSP更新版本
 | 
						OcspUpdatedVersion uint64   `field:"ocspUpdatedVersion"` // OCSP更新版本
 | 
				
			||||||
	OcspExpiresAt      uint64 `field:"ocspExpiresAt"`      // OCSP过期时间(UTC)
 | 
						OcspExpiresAt      uint64   `field:"ocspExpiresAt"`      // OCSP过期时间(UTC)
 | 
				
			||||||
	OcspTries          uint32 `field:"ocspTries"`          // OCSP尝试次数
 | 
						OcspTries          uint32   `field:"ocspTries"`          // OCSP尝试次数
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type SSLCertOperator struct {
 | 
					type SSLCertOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,22 +1,24 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SSLPolicy SSL配置策略
 | 
					// SSLPolicy SSL配置策略
 | 
				
			||||||
type SSLPolicy struct {
 | 
					type SSLPolicy struct {
 | 
				
			||||||
	Id               uint32 `field:"id"`               // ID
 | 
						Id               uint32   `field:"id"`               // ID
 | 
				
			||||||
	AdminId          uint32 `field:"adminId"`          // 管理员ID
 | 
						AdminId          uint32   `field:"adminId"`          // 管理员ID
 | 
				
			||||||
	UserId           uint32 `field:"userId"`           // 用户ID
 | 
						UserId           uint32   `field:"userId"`           // 用户ID
 | 
				
			||||||
	IsOn             uint8  `field:"isOn"`             // 是否启用
 | 
						IsOn             uint8    `field:"isOn"`             // 是否启用
 | 
				
			||||||
	Certs            string `field:"certs"`            // 证书列表
 | 
						Certs            dbs.JSON `field:"certs"`            // 证书列表
 | 
				
			||||||
	ClientCACerts    string `field:"clientCACerts"`    // 客户端证书
 | 
						ClientCACerts    dbs.JSON `field:"clientCACerts"`    // 客户端证书
 | 
				
			||||||
	ClientAuthType   uint32 `field:"clientAuthType"`   // 客户端认证类型
 | 
						ClientAuthType   uint32   `field:"clientAuthType"`   // 客户端认证类型
 | 
				
			||||||
	MinVersion       string `field:"minVersion"`       // 支持的SSL最小版本
 | 
						MinVersion       string   `field:"minVersion"`       // 支持的SSL最小版本
 | 
				
			||||||
	CipherSuitesIsOn uint8  `field:"cipherSuitesIsOn"` // 是否自定义加密算法套件
 | 
						CipherSuitesIsOn uint8    `field:"cipherSuitesIsOn"` // 是否自定义加密算法套件
 | 
				
			||||||
	CipherSuites     string `field:"cipherSuites"`     // 加密算法套件
 | 
						CipherSuites     dbs.JSON `field:"cipherSuites"`     // 加密算法套件
 | 
				
			||||||
	Hsts             string `field:"hsts"`             // HSTS设置
 | 
						Hsts             dbs.JSON `field:"hsts"`             // HSTS设置
 | 
				
			||||||
	Http2Enabled     uint8  `field:"http2Enabled"`     // 是否启用HTTP/2
 | 
						Http2Enabled     uint8    `field:"http2Enabled"`     // 是否启用HTTP/2
 | 
				
			||||||
	OcspIsOn         uint8  `field:"ocspIsOn"`         // 是否启用OCSP
 | 
						OcspIsOn         uint8    `field:"ocspIsOn"`         // 是否启用OCSP
 | 
				
			||||||
	State            uint8  `field:"state"`            // 状态
 | 
						State            uint8    `field:"state"`            // 状态
 | 
				
			||||||
	CreatedAt        uint64 `field:"createdAt"`        // 创建时间
 | 
						CreatedAt        uint64   `field:"createdAt"`        // 创建时间
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type SSLPolicyOperator struct {
 | 
					type SSLPolicyOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,13 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 系统事件
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SysEvent 系统事件
 | 
				
			||||||
type SysEvent struct {
 | 
					type SysEvent struct {
 | 
				
			||||||
	Id        uint64 `field:"id"`        // ID
 | 
						Id        uint64   `field:"id"`        // ID
 | 
				
			||||||
	Type      string `field:"type"`      // 类型
 | 
						Type      string   `field:"type"`      // 类型
 | 
				
			||||||
	Params    string `field:"params"`    // 参数
 | 
						Params    dbs.JSON `field:"params"`    // 参数
 | 
				
			||||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
						CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type SysEventOperator struct {
 | 
					type SysEventOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,13 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 系统配置
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SysSetting 系统配置
 | 
				
			||||||
type SysSetting struct {
 | 
					type SysSetting struct {
 | 
				
			||||||
	Id     uint32 `field:"id"`     // ID
 | 
						Id     uint32   `field:"id"`     // ID
 | 
				
			||||||
	UserId uint32 `field:"userId"` // 用户ID
 | 
						UserId uint32   `field:"userId"` // 用户ID
 | 
				
			||||||
	Code   string `field:"code"`   // 代号
 | 
						Code   string   `field:"code"`   // 代号
 | 
				
			||||||
	Value  string `field:"value"`  // 配置值
 | 
						Value  dbs.JSON `field:"value"`  // 配置值
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type SysSettingOperator struct {
 | 
					type SysSettingOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,30 +1,32 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// User 用户
 | 
					// User 用户
 | 
				
			||||||
type User struct {
 | 
					type User struct {
 | 
				
			||||||
	Id              uint32 `field:"id"`              // ID
 | 
						Id              uint32   `field:"id"`              // ID
 | 
				
			||||||
	IsOn            uint8  `field:"isOn"`            // 是否启用
 | 
						IsOn            uint8    `field:"isOn"`            // 是否启用
 | 
				
			||||||
	Username        string `field:"username"`        // 用户名
 | 
						Username        string   `field:"username"`        // 用户名
 | 
				
			||||||
	Password        string `field:"password"`        // 密码
 | 
						Password        string   `field:"password"`        // 密码
 | 
				
			||||||
	Fullname        string `field:"fullname"`        // 真实姓名
 | 
						Fullname        string   `field:"fullname"`        // 真实姓名
 | 
				
			||||||
	Mobile          string `field:"mobile"`          // 手机号
 | 
						Mobile          string   `field:"mobile"`          // 手机号
 | 
				
			||||||
	Tel             string `field:"tel"`             // 联系电话
 | 
						Tel             string   `field:"tel"`             // 联系电话
 | 
				
			||||||
	Remark          string `field:"remark"`          // 备注
 | 
						Remark          string   `field:"remark"`          // 备注
 | 
				
			||||||
	Email           string `field:"email"`           // 邮箱地址
 | 
						Email           string   `field:"email"`           // 邮箱地址
 | 
				
			||||||
	EmailIsVerified uint8  `field:"emailIsVerified"` // 邮箱是否已验证
 | 
						EmailIsVerified uint8    `field:"emailIsVerified"` // 邮箱是否已验证
 | 
				
			||||||
	AvatarFileId    uint64 `field:"avatarFileId"`    // 头像文件ID
 | 
						AvatarFileId    uint64   `field:"avatarFileId"`    // 头像文件ID
 | 
				
			||||||
	CreatedAt       uint64 `field:"createdAt"`       // 创建时间
 | 
						CreatedAt       uint64   `field:"createdAt"`       // 创建时间
 | 
				
			||||||
	Day             string `field:"day"`             // YYYYMMDD
 | 
						Day             string   `field:"day"`             // YYYYMMDD
 | 
				
			||||||
	UpdatedAt       uint64 `field:"updatedAt"`       // 修改时间
 | 
						UpdatedAt       uint64   `field:"updatedAt"`       // 修改时间
 | 
				
			||||||
	State           uint8  `field:"state"`           // 状态
 | 
						State           uint8    `field:"state"`           // 状态
 | 
				
			||||||
	Source          string `field:"source"`          // 来源
 | 
						Source          string   `field:"source"`          // 来源
 | 
				
			||||||
	ClusterId       uint32 `field:"clusterId"`       // 集群ID
 | 
						ClusterId       uint32   `field:"clusterId"`       // 集群ID
 | 
				
			||||||
	Features        string `field:"features"`        // 允许操作的特征
 | 
						Features        dbs.JSON `field:"features"`        // 允许操作的特征
 | 
				
			||||||
	RegisteredIP    string `field:"registeredIP"`    // 注册使用的IP
 | 
						RegisteredIP    string   `field:"registeredIP"`    // 注册使用的IP
 | 
				
			||||||
	IsRejected      uint8  `field:"isRejected"`      // 是否已拒绝
 | 
						IsRejected      uint8    `field:"isRejected"`      // 是否已拒绝
 | 
				
			||||||
	RejectReason    string `field:"rejectReason"`    // 拒绝理由
 | 
						RejectReason    string   `field:"rejectReason"`    // 拒绝理由
 | 
				
			||||||
	IsVerified      uint8  `field:"isVerified"`      // 是否验证通过
 | 
						IsVerified      uint8    `field:"isVerified"`      // 是否验证通过
 | 
				
			||||||
	RequirePlans    uint8  `field:"requirePlans"`    // 是否需要购买套餐
 | 
						RequirePlans    uint8    `field:"requirePlans"`    // 是否需要购买套餐
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type UserOperator struct {
 | 
					type UserOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,22 +1,24 @@
 | 
				
			|||||||
package models
 | 
					package models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// API节点
 | 
					import "github.com/iwind/TeaGo/dbs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 用户节点
 | 
				
			||||||
type UserNode struct {
 | 
					type UserNode struct {
 | 
				
			||||||
	Id          uint32 `field:"id"`          // ID
 | 
						Id          uint32   `field:"id"`          // ID
 | 
				
			||||||
	IsOn        uint8  `field:"isOn"`        // 是否启用
 | 
						IsOn        uint8    `field:"isOn"`        // 是否启用
 | 
				
			||||||
	UniqueId    string `field:"uniqueId"`    // 唯一ID
 | 
						UniqueId    string   `field:"uniqueId"`    // 唯一ID
 | 
				
			||||||
	Secret      string `field:"secret"`      // 密钥
 | 
						Secret      string   `field:"secret"`      // 密钥
 | 
				
			||||||
	Name        string `field:"name"`        // 名称
 | 
						Name        string   `field:"name"`        // 名称
 | 
				
			||||||
	Description string `field:"description"` // 描述
 | 
						Description string   `field:"description"` // 描述
 | 
				
			||||||
	Http        string `field:"http"`        // 监听的HTTP配置
 | 
						Http        dbs.JSON `field:"http"`        // 监听的HTTP配置
 | 
				
			||||||
	Https       string `field:"https"`       // 监听的HTTPS配置
 | 
						Https       dbs.JSON `field:"https"`       // 监听的HTTPS配置
 | 
				
			||||||
	AccessAddrs string `field:"accessAddrs"` // 外部访问地址
 | 
						AccessAddrs dbs.JSON `field:"accessAddrs"` // 外部访问地址
 | 
				
			||||||
	Order       uint32 `field:"order"`       // 排序
 | 
						Order       uint32   `field:"order"`       // 排序
 | 
				
			||||||
	State       uint8  `field:"state"`       // 状态
 | 
						State       uint8    `field:"state"`       // 状态
 | 
				
			||||||
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
 | 
						CreatedAt   uint64   `field:"createdAt"`   // 创建时间
 | 
				
			||||||
	AdminId     uint32 `field:"adminId"`     // 管理员ID
 | 
						AdminId     uint32   `field:"adminId"`     // 管理员ID
 | 
				
			||||||
	Weight      uint32 `field:"weight"`      // 权重
 | 
						Weight      uint32   `field:"weight"`      // 权重
 | 
				
			||||||
	Status      string `field:"status"`      // 运行状态
 | 
						Status      dbs.JSON `field:"status"`      // 运行状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type UserNodeOperator struct {
 | 
					type UserNodeOperator struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,10 +5,10 @@ import (
 | 
				
			|||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 缓存专用Locker
 | 
					// SharedCacheLocker 缓存专用Locker
 | 
				
			||||||
var SharedCacheLocker = sync.RWMutex{}
 | 
					var SharedCacheLocker = sync.RWMutex{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 处理JSON字节Slice
 | 
					// JSONBytes 处理JSON字节Slice
 | 
				
			||||||
func JSONBytes(data []byte) []byte {
 | 
					func JSONBytes(data []byte) []byte {
 | 
				
			||||||
	if len(data) == 0 {
 | 
						if len(data) == 0 {
 | 
				
			||||||
		return []byte("null")
 | 
							return []byte("null")
 | 
				
			||||||
@@ -16,12 +16,18 @@ func JSONBytes(data []byte) []byte {
 | 
				
			|||||||
	return data
 | 
						return data
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 判断JSON是否不为空
 | 
					// IsNotNull 判断JSON是否不为空
 | 
				
			||||||
func IsNotNull(data string) bool {
 | 
					func IsNotNull(data []byte) bool {
 | 
				
			||||||
	return len(data) > 0 && data != "null"
 | 
						if len(data) == 0 {
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if len(data) == 4 && string(data) == "null" {
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 构造Query
 | 
					// NewQuery 构造Query
 | 
				
			||||||
func NewQuery(tx *dbs.Tx, dao dbs.DAOWrapper, adminId int64, userId int64) *dbs.Query {
 | 
					func NewQuery(tx *dbs.Tx, dao dbs.DAOWrapper, adminId int64, userId int64) *dbs.Query {
 | 
				
			||||||
	query := dao.Object().Query(tx)
 | 
						query := dao.Object().Query(tx)
 | 
				
			||||||
	if adminId > 0 {
 | 
						if adminId > 0 {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -148,8 +148,8 @@ func (this *AdminService) FindEnabledAdmin(ctx context.Context, req *pb.FindEnab
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	pbModules := []*pb.AdminModule{}
 | 
						pbModules := []*pb.AdminModule{}
 | 
				
			||||||
	modules := []*systemconfigs.AdminModule{}
 | 
						modules := []*systemconfigs.AdminModule{}
 | 
				
			||||||
	if len(admin.Modules) > 0 && admin.Modules != "null" {
 | 
						if len(admin.Modules) > 0 {
 | 
				
			||||||
		err = json.Unmarshal([]byte(admin.Modules), &modules)
 | 
							err = json.Unmarshal(admin.Modules, &modules)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -281,8 +281,8 @@ func (this *AdminService) FindAllAdminModules(ctx context.Context, req *pb.FindA
 | 
				
			|||||||
	result := []*pb.AdminModuleList{}
 | 
						result := []*pb.AdminModuleList{}
 | 
				
			||||||
	for _, admin := range admins {
 | 
						for _, admin := range admins {
 | 
				
			||||||
		modules := []*systemconfigs.AdminModule{}
 | 
							modules := []*systemconfigs.AdminModule{}
 | 
				
			||||||
		if len(admin.Modules) > 0 && admin.Modules != "null" {
 | 
							if len(admin.Modules) > 0 {
 | 
				
			||||||
			err = json.Unmarshal([]byte(admin.Modules), &modules)
 | 
								err = json.Unmarshal(admin.Modules, &modules)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				return nil, err
 | 
									return nil, err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -331,8 +331,8 @@ func (this *DNSDomainService) convertDomainToPB(tx *dbs.Tx, domain *dns.DNSDomai
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	records := []*dnstypes.Record{}
 | 
						records := []*dnstypes.Record{}
 | 
				
			||||||
	if len(domain.Records) > 0 && domain.Records != "null" {
 | 
						if models.IsNotNull(domain.Records) {
 | 
				
			||||||
		err := json.Unmarshal([]byte(domain.Records), &records)
 | 
							err := json.Unmarshal(domain.Records, &records)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -653,8 +653,8 @@ func (this *DNSDomainService) syncClusterDNS(req *pb.SyncDNSDomainDataRequest) (
 | 
				
			|||||||
		return &pb.SyncDNSDomainDataResponse{IsOk: false, Error: "域名没有设置服务商"}, nil
 | 
							return &pb.SyncDNSDomainDataResponse{IsOk: false, Error: "域名没有设置服务商"}, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	apiParams := maps.Map{}
 | 
						apiParams := maps.Map{}
 | 
				
			||||||
	if len(provider.ApiParams) > 0 && provider.ApiParams != "null" {
 | 
						if models.IsNotNull(provider.ApiParams) {
 | 
				
			||||||
		err = json.Unmarshal([]byte(provider.ApiParams), &apiParams)
 | 
							err = json.Unmarshal(provider.ApiParams, &apiParams)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user