:poop:代码改进
This commit is contained in:
@@ -4,7 +4,7 @@ package entity
|
||||
// @description: 服务端
|
||||
type Server struct {
|
||||
Base
|
||||
IpScope string `json:"ipScope" gorm:"type:varchar(30);not null;comment:'ip范围'"`
|
||||
IpScope string `json:"ipScope" gorm:"type:varchar(255);not null;comment:'ip范围'"`
|
||||
ListenPort int `json:"listenPort" gorm:"type:int(10);not null;comment:'服务监听端口'"`
|
||||
PrivateKey string `json:"privateKey" gorm:"type:text;not null;comment:'密钥'"`
|
||||
PublicKey string `json:"publicKey" gorm:"type:text;not null;comment:'公钥'"`
|
||||
@@ -22,20 +22,21 @@ func (*Server) TableName() string {
|
||||
// @description: 客户端
|
||||
type Client struct {
|
||||
Base
|
||||
ServerId string `json:"serverId" gorm:"type:varchar(36);not null;comment:'服务端id'"`
|
||||
Name string `json:"name" gorm:"type:varchar(100);not null;comment:'客户端名称'"`
|
||||
Email string `json:"email" gorm:"type:varchar(100);default null;comment:'联系邮箱'"`
|
||||
SubnetRange string `json:"subnetRange" gorm:"type:varchar(255);default null;comment:'子网范围'"`
|
||||
IpAllocation string `json:"ipAllocation" gorm:"type:varchar(30);not null;comment:'客户端ip'"`
|
||||
AllowedIps string `json:"allowedIps" gorm:"type:varchar(30);not null;comment:'允许访问的ip'"`
|
||||
ExtraAllowedIps string `json:"extraAllowedIps" gorm:"type:varchar(30);default null;comment:'额外允许的ip范围'"`
|
||||
Endpoint string `json:"endpoint" gorm:"type:varchar(255);default null;comment:'端点'"`
|
||||
UseServerDns int `json:"useServerDns" gorm:"type:int(1);default 1;comment:'是否使用服务端dns'"`
|
||||
EnableAfterCreation int `json:"enableAfterCreation" gorm:"type:int(1);default 1;comment:'是否创建后启用'"`
|
||||
Keys string `json:"keys" gorm:"type:text;default null;comment:'公钥和密钥的json串'"`
|
||||
UserId string `json:"userId" gorm:"type:char(36);not null;comment:'创建人id'"`
|
||||
Enabled bool `json:"enabled" gorm:"type:tinyint(1);default 1;comment:'状态(0 - 禁用 | 1 - 正常)'"`
|
||||
User *User `json:"user" gorm:"foreignKey:UserId"`
|
||||
ServerId string `json:"serverId" gorm:"type:varchar(36);not null;comment:'服务端id'"`
|
||||
Name string `json:"name" gorm:"type:varchar(100);not null;comment:'客户端名称'"`
|
||||
Email string `json:"email" gorm:"type:varchar(100);default null;comment:'联系邮箱'"`
|
||||
SubnetRange string `json:"subnetRange" gorm:"type:varchar(255);default null;comment:'子网范围'"`
|
||||
IpAllocation string `json:"ipAllocation" gorm:"type:varchar(255);not null;comment:'客户端ip'"`
|
||||
AllowedIps string `json:"allowedIps" gorm:"type:varchar(255);not null;comment:'允许访问的ip'"`
|
||||
ExtraAllowedIps string `json:"extraAllowedIps" gorm:"type:varchar(255);default null;comment:'额外允许的ip范围'"`
|
||||
Endpoint string `json:"endpoint" gorm:"type:varchar(255);default null;comment:'端点'"`
|
||||
UseServerDns int `json:"useServerDns" gorm:"type:int(1);default 1;comment:'是否使用服务端dns'"`
|
||||
EnableAfterCreation int `json:"enableAfterCreation" gorm:"type:int(1);default 1;comment:'是否创建后启用'"`
|
||||
Keys string `json:"keys" gorm:"type:text;default null;comment:'公钥和密钥的json串'"`
|
||||
UserId string `json:"userId" gorm:"type:char(36);not null;comment:'创建人id'"`
|
||||
Enabled bool `json:"enabled" gorm:"type:tinyint(1);default 1;comment:'状态(0 - 禁用 | 1 - 正常)'"`
|
||||
User *User `json:"user" gorm:"foreignKey:UserId"`
|
||||
Server *Server `json:"server" gorm:"foreignKey:ServerId"`
|
||||
}
|
||||
|
||||
func (*Client) TableName() string {
|
||||
|
||||
@@ -32,3 +32,16 @@ type Keys struct {
|
||||
PublicKey string `json:"publicKey"`
|
||||
PresharedKey string `json:"presharedKey"`
|
||||
}
|
||||
|
||||
type ClientConfig struct {
|
||||
PrivateKey string `json:"privateKey"`
|
||||
IpAllocation string `json:"ipAllocation"`
|
||||
MTU int `json:"MTU"`
|
||||
DNS string `json:"DNS"`
|
||||
PublicKey string `json:"publicKey"`
|
||||
PresharedKey string `json:"presharedKey"`
|
||||
AllowedIPS string `json:"allowedIPS"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
ListenPort int `json:"listenPort"`
|
||||
PersistentKeepalive int `json:"persistentKeepalive"`
|
||||
}
|
||||
|
||||
@@ -10,9 +10,12 @@ type Client struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
SubnetRange string `json:"subnetRange"`
|
||||
IpAllocation string `json:"ipAllocation"`
|
||||
AllowedIps string `json:"allowedIPS"`
|
||||
ExtraAllowedIps string `json:"extraAllowedIPS"`
|
||||
IpAllocation []string `json:"ipAllocation" gorm:"-"`
|
||||
IpAllocationStr string `json:"-" gorm:"ipAllocationStr"`
|
||||
AllowedIps []string `json:"allowedIPS" gorm:"-"`
|
||||
AllowedIpsStr string `json:"-" gorm:"allowedIPSStr"`
|
||||
ExtraAllowedIps []string `json:"extraAllowedIPS"`
|
||||
ExtraAllowedIpsStr string `json:"-" gorm:"extraAllowedIPSStr"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
UseServerDNS int `json:"useServerDNS"`
|
||||
EnableAfterCreation int `json:"enableAfterCreation"`
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package vo
|
||||
|
||||
type ServerSetting struct {
|
||||
EndpointAddress string `json:"endpointAddress"`
|
||||
DnsServer string `json:"dnsServer"`
|
||||
MTU int `json:"MTU"`
|
||||
PersistentKeepalive int `json:"persistentKeepalive"`
|
||||
FirewallMark string `json:"firewallMark"`
|
||||
Table string `json:"table"`
|
||||
ConfigFilePath string `json:"configFilePath"`
|
||||
EndpointAddress string `json:"endpointAddress"`
|
||||
DnsServer []string `json:"dnsServer"`
|
||||
MTU int `json:"MTU"`
|
||||
PersistentKeepalive int `json:"persistentKeepalive"`
|
||||
FirewallMark string `json:"firewallMark"`
|
||||
Table string `json:"table"`
|
||||
ConfigFilePath string `json:"configFilePath"`
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@ package vo
|
||||
// Server
|
||||
// @description: 服务端返回信息
|
||||
type Server struct {
|
||||
Id string `json:"id"` // id
|
||||
IpScope string `json:"ipScope"` // ip范围
|
||||
ListenPort int `json:"listenPort"` // 服务监听端口
|
||||
PrivateKey string `json:"privateKey"` // 私钥
|
||||
PublicKey string `json:"publicKey"` // 公钥
|
||||
PostUpScript string `json:"postUpScript"`
|
||||
PreDownScript string `json:"preDownScript"`
|
||||
PostDownScript string `json:"postDownScript"`
|
||||
Id string `json:"id"` // id
|
||||
IpScope []string `json:"ipScope" gorm:"-"` // ip范围
|
||||
IpScopeStr string `json:"-" gorm:"ipScope"`
|
||||
ListenPort int `json:"listenPort"` // 服务监听端口
|
||||
PrivateKey string `json:"privateKey"` // 私钥
|
||||
PublicKey string `json:"publicKey"` // 公钥
|
||||
PostUpScript string `json:"postUpScript"`
|
||||
PreDownScript string `json:"preDownScript"`
|
||||
PostDownScript string `json:"postDownScript"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user