2024-08-08 15:30:09 +08:00
|
|
|
package vo
|
|
|
|
|
2024-09-23 15:58:46 +08:00
|
|
|
import "wireguard-ui/global/constant"
|
|
|
|
|
2024-08-08 15:30:09 +08:00
|
|
|
// SettingItem
|
|
|
|
// @description: 设置单项
|
|
|
|
type SettingItem struct {
|
|
|
|
Code string `json:"code"`
|
|
|
|
Data string `json:"data"`
|
|
|
|
Describe string `json:"describe"`
|
|
|
|
}
|
2024-09-20 17:26:41 +08:00
|
|
|
|
|
|
|
type Export struct {
|
2024-09-23 15:58:46 +08:00
|
|
|
Global *Global `json:"global" label:"全局配置" binding:"required"`
|
|
|
|
Server *Server `json:"server" label:"服务端配置" binding:"required"`
|
|
|
|
Clients []Client `json:"clients" label:"客户端" binding:"omitempty"`
|
2024-11-04 16:50:50 +08:00
|
|
|
Other []Other `json:"other" label:"其他" binding:"omitempty"`
|
2024-09-20 17:26:41 +08:00
|
|
|
}
|
|
|
|
|
2024-11-04 16:50:50 +08:00
|
|
|
// Global
|
|
|
|
// @description: 全局配置
|
2024-09-20 17:26:41 +08:00
|
|
|
type Global struct {
|
2024-09-23 15:58:46 +08:00
|
|
|
MTU int `json:"MTU" label:"MTU" binding:"required"`
|
|
|
|
ConfigFilePath string `json:"configFilePath" label:"配置文件路径" binding:"required"`
|
|
|
|
DnsServer []string `json:"dnsServer" label:"DNS" binding:"omitempty"`
|
|
|
|
EndpointAddress string `json:"endpointAddress" label:"公网地址" binding:"required"`
|
|
|
|
FirewallMark string `json:"firewallMark" label:"firewallMark" binding:"omitempty"`
|
|
|
|
PersistentKeepalive int `json:"persistentKeepalive" label:"persistentKeepalive" binding:"required"`
|
|
|
|
Table string `json:"table" label:"table" binding:"omitempty"`
|
2024-09-20 17:26:41 +08:00
|
|
|
}
|
|
|
|
|
2024-11-04 16:50:50 +08:00
|
|
|
// Server
|
|
|
|
// @description: 服务端信息
|
2024-09-20 17:26:41 +08:00
|
|
|
type Server struct {
|
2024-09-23 15:58:46 +08:00
|
|
|
IpScope []string `json:"ipScope" label:"ipScope" binding:"min=1,dive,required"`
|
|
|
|
ListenPort int `json:"listenPort" label:"listenPort" binding:"required"`
|
|
|
|
PrivateKey string `json:"privateKey" label:"privateKey" binding:"required"`
|
|
|
|
PublicKey string `json:"publicKey" label:"publicKey" binding:"required"`
|
|
|
|
PostUpScript string `json:"postUpScript" label:"postUpScript" binding:"omitempty"`
|
|
|
|
PostDownScript string `json:"postDownScript" label:"postDownScript" binding:"omitempty"`
|
2024-09-20 17:26:41 +08:00
|
|
|
}
|
|
|
|
|
2024-11-04 16:50:50 +08:00
|
|
|
// Client
|
|
|
|
// @description: 客户端信息
|
2024-09-20 17:26:41 +08:00
|
|
|
type Client struct {
|
2024-09-23 15:58:46 +08:00
|
|
|
Name string `json:"name" label:"name" binding:"required"`
|
|
|
|
Email string `json:"email" label:"email" binding:"omitempty"`
|
|
|
|
SubnetRange string `json:"subnetRange" label:"subnetRange" binding:"omitempty"`
|
|
|
|
IpAllocation []string `json:"ipAllocation" label:"ipAllocation" binding:"min=1,dive,required"`
|
|
|
|
AllowedIps []string `json:"allowedIps" label:"allowedIps" binding:"min=1,dive,required"`
|
|
|
|
ExtraAllowedIps []string `json:"extraAllowedIps" label:"extraAllowedIps" binding:"omitempty"`
|
|
|
|
Endpoint string `json:"endpoint" label:"endpoint" binding:"endpoint"`
|
|
|
|
UseServerDns *constant.Status `json:"useServerDns" label:"useServerDns" binding:"omitempty"`
|
2024-09-20 17:26:41 +08:00
|
|
|
Keys struct {
|
2024-09-23 15:58:46 +08:00
|
|
|
PresharedKey string `json:"presharedKey" label:"presharedKey" binding:"required"`
|
|
|
|
PrivateKey string `json:"privateKey" label:"privateKey" binding:"required"`
|
|
|
|
PublicKey string `json:"publicKey" label:"publicKey" binding:"required"`
|
|
|
|
} `json:"keys" label:"keys" binding:"required"`
|
|
|
|
Enabled *constant.Status `json:"enabled" label:"enabled" binding:"required"`
|
|
|
|
OfflineMonitoring *constant.Status `json:"offlineMonitoring" label:"offlineMonitoring" binding:"required"`
|
2024-09-20 17:26:41 +08:00
|
|
|
}
|
2024-11-04 16:50:50 +08:00
|
|
|
|
|
|
|
// Other
|
|
|
|
// @description: 其他配置
|
|
|
|
type Other struct {
|
|
|
|
Code string `json:"code" label:"code" binding:"required"`
|
|
|
|
Data string `json:"data" label:"data" binding:"required"`
|
|
|
|
Describe string `json:"describe" label:"describe" binding:"omitempty"`
|
|
|
|
}
|