wireguard-dashboard/model/entity/wireguard.go
coward 6f249d20b0
All checks were successful
continuous-integration/drone/tag Build is passing
🎨新增客户端离线通知选项配置以及监听任务
2024-06-13 14:34:03 +08:00

46 lines
2.7 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package entity
// Server
// @description: 服务端
type Server struct {
Base
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:'公钥'"`
PostUpScript string `json:"postUpScript" gorm:"type:text;default null;comment:'postUpScript'"`
PreDownScript string `json:"preDownScript" gorm:"type:text;default null;comment:'preDownScript'"`
PostDownScript string `json:"postDownScript" gorm:"type:text;default null;comment:postDownScript"`
Clients []Client `json:"clients" gorm:"foreignKey:ServerId"`
}
func (*Server) TableName() string {
return "t_wg_server"
}
// Client
// @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(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 *int `json:"enabled" gorm:"type:tinyint(1);default 1;comment:'状态0 - 禁用 | 1 - 正常)'"`
OfflineMonitoring *int `json:"offlineMonitoring" gorm:"tinyint(1);default 0;comment:'是否启用离线监听0 - 禁用 | 1 - 启用)"`
User *User `json:"user" gorm:"foreignKey:UserId"`
Server *Server `json:"server" gorm:"foreignKey:ServerId"`
}
func (*Client) TableName() string {
return "t_wg_client"
}