:art:做了一些bug修复和变动
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"gitee.ltd/lxh/logger/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
"strings"
|
||||
"wireguard-dashboard/command"
|
||||
"wireguard-dashboard/http/param"
|
||||
"wireguard-dashboard/model/entity"
|
||||
@@ -45,7 +44,7 @@ func (server) SaveServer(c *gin.Context) {
|
||||
}
|
||||
publicKey := privateKey.PublicKey()
|
||||
serverInfo := &entity.Server{
|
||||
IpScope: strings.Join(p.IpScope, ","),
|
||||
IpScope: p.IpScope,
|
||||
ListenPort: p.ListenPort,
|
||||
PrivateKey: privateKey.String(),
|
||||
PublicKey: publicKey.String(),
|
||||
@@ -84,10 +83,6 @@ func (server) GetServer(c *gin.Context) {
|
||||
log.Errorf("获取服务端信息失败: %v", err.Error())
|
||||
}
|
||||
|
||||
if data.IpScopeStr != "" {
|
||||
data.IpScope = strings.Split(data.IpScopeStr, ",")
|
||||
}
|
||||
|
||||
utils.GinResponse(c).OKWithData(data)
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ func (setting) SetServerGlobal(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
data, _ := json.Marshal(p.Data)
|
||||
data, _ := json.Marshal(p)
|
||||
|
||||
var ent entity.Setting
|
||||
ent.Code = "SERVER_SETTING"
|
||||
|
||||
@@ -5,6 +5,11 @@ import "wireguard-dashboard/model/template_data"
|
||||
// ClientList
|
||||
// @description: 客户端列表
|
||||
type ClientList struct {
|
||||
Name string `json:"name" form:"name"`
|
||||
Email string `json:"email" form:"email"`
|
||||
Ip string `json:"ip" form:"ip"`
|
||||
CreateUser string `json:"createUser" form:"createUser"`
|
||||
Enabled *int `json:"enabled" form:"enabled"`
|
||||
page
|
||||
}
|
||||
|
||||
@@ -26,10 +31,10 @@ type SaveClient struct {
|
||||
AllowedIPS []string `json:"allowedIPS" form:"allowedIPS" binding:"required"`
|
||||
ExtraAllowedIPS []string `json:"extraAllowedIPS" form:"extraAllowedIPS" binding:"omitempty"`
|
||||
Endpoint string `json:"endpoint" form:"endpoint" binding:"omitempty"`
|
||||
UseServerDNS int `json:"useServerDNS" form:"useServerDNS" binding:"required,oneof=1 0"`
|
||||
EnabledAfterCreation int `json:"enabledAfterCreation" form:"enabledAfterCreation" binding:"required,oneof=1 0"`
|
||||
UseServerDNS *int `json:"useServerDNS" form:"useServerDNS" binding:"required,oneof=1 0"`
|
||||
EnabledAfterCreation *int `json:"enableAfterCreation" form:"enableAfterCreation" binding:"required,oneof=1 0"`
|
||||
Keys *template_data.Keys `json:"keys" form:"keys" binding:"omitempty"`
|
||||
Enabled int `json:"enabled" form:"enabled" binding:"required,oneof=1 0"`
|
||||
Enabled *int `json:"enabled" form:"enabled" binding:"required,oneof=1 0"`
|
||||
}
|
||||
|
||||
// ControlServer
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package param
|
||||
|
||||
type SaveServer struct {
|
||||
Id string `json:"id" form:"id" binding:"omitempty"` // id
|
||||
IpScope []string `json:"ipScope" form:"ipScope" binding:"required"` // 内网ip范围段
|
||||
ListenPort int `json:"listenPort" form:"listenPort" binding:"required"` // 监听端口
|
||||
PostUpScript string `json:"postUpScript" form:"postUpScript" binding:"omitempty"`
|
||||
PreDownScript string `json:"preDownScript" form:"preDownScript" binding:"omitempty"`
|
||||
PostDownScript string `json:"postDownScript" form:"postDownScript" binding:"omitempty"`
|
||||
Id string `json:"id" form:"id" binding:"omitempty"` // id
|
||||
IpScope string `json:"ipScope" form:"ipScope" binding:"required"` // 内网ip范围段
|
||||
ListenPort int `json:"listenPort" form:"listenPort" binding:"required"` // 监听端口
|
||||
PostUpScript string `json:"postUpScript" form:"postUpScript" binding:"omitempty"`
|
||||
PreDownScript string `json:"preDownScript" form:"preDownScript" binding:"omitempty"`
|
||||
PostDownScript string `json:"postDownScript" form:"postDownScript" binding:"omitempty"`
|
||||
}
|
||||
|
||||
@@ -11,13 +11,11 @@ type SetSetting struct {
|
||||
// SetServerGlobal
|
||||
// @description: 设置服务端全局配置
|
||||
type SetServerGlobal struct {
|
||||
Data struct {
|
||||
EndpointAddress string `json:"endpointAddress" binding:"required"` // 服务公网IP
|
||||
DnsServer []string `json:"dnsServer" binding:"required"` // DNS列表
|
||||
MTU int `json:"MTU" binding:"required"`
|
||||
PersistentKeepalive int `json:"persistentKeepalive" binding:"omitempty"`
|
||||
FirewallMark string `json:"firewallMark" binding:"omitempty"`
|
||||
Table string `json:"table" binding:"omitempty"`
|
||||
ConfigFilePath string `json:"configFilePath" binding:"required"` // 配置文件对外输出目录
|
||||
} `json:"data"`
|
||||
EndpointAddress string `json:"endpointAddress" binding:"required"` // 服务公网IP
|
||||
DnsServer []string `json:"dnsServer" binding:"required"` // DNS列表
|
||||
MTU int `json:"MTU" binding:"required"`
|
||||
PersistentKeepalive int `json:"persistentKeepalive" binding:"omitempty"`
|
||||
FirewallMark string `json:"firewallMark" binding:"omitempty"`
|
||||
Table string `json:"table" binding:"omitempty"`
|
||||
ConfigFilePath string `json:"configFilePath" binding:"required"` // 配置文件对外输出目录
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user