🎨服务端的初始化
This commit is contained in:
parent
097505df99
commit
28cdfd1240
15
compoment/wireguard.go
Normal file
15
compoment/wireguard.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package compoment
|
||||||
|
|
||||||
|
type wireguard struct{}
|
||||||
|
|
||||||
|
func Wireguard() wireguard {
|
||||||
|
return wireguard{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply
|
||||||
|
// @description: 应用配置
|
||||||
|
// @receiver wireguard
|
||||||
|
// @return err
|
||||||
|
func (wireguard) Apply() (err error) {
|
||||||
|
return nil
|
||||||
|
}
|
27
http/api/server.go
Normal file
27
http/api/server.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"wireguard-dashboard/repository"
|
||||||
|
"wireguard-dashboard/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
type server struct{}
|
||||||
|
|
||||||
|
func Server() server {
|
||||||
|
return server{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServer
|
||||||
|
// @description: 获取服务端信息
|
||||||
|
// @receiver wireguard
|
||||||
|
// @param c
|
||||||
|
func (server) GetServer(c *gin.Context) {
|
||||||
|
data, err := repository.Server().GetServer()
|
||||||
|
if err != nil {
|
||||||
|
utils.GinResponse(c).FailedWithMsg("获取服务端信息失败")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
utils.GinResponse(c).OKWithData(data)
|
||||||
|
}
|
@ -23,7 +23,7 @@ func UserApi() user {
|
|||||||
// @description: 登陆
|
// @description: 登陆
|
||||||
// @receiver u
|
// @receiver u
|
||||||
// @param c
|
// @param c
|
||||||
func (u user) Login(c *gin.Context) {
|
func (user) Login(c *gin.Context) {
|
||||||
var p param.Login
|
var p param.Login
|
||||||
if err := c.ShouldBind(&p); err != nil {
|
if err := c.ShouldBind(&p); err != nil {
|
||||||
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
||||||
@ -72,7 +72,7 @@ func (u user) Login(c *gin.Context) {
|
|||||||
// @description: 退出登陆
|
// @description: 退出登陆
|
||||||
// @receiver u
|
// @receiver u
|
||||||
// @param c
|
// @param c
|
||||||
func (u user) Logout(c *gin.Context) {
|
func (user) Logout(c *gin.Context) {
|
||||||
data, ok := c.Get("user")
|
data, ok := c.Get("user")
|
||||||
if !ok {
|
if !ok {
|
||||||
utils.GinResponse(c).FailedWithMsg("你还没有登陆")
|
utils.GinResponse(c).FailedWithMsg("你还没有登陆")
|
||||||
@ -90,7 +90,7 @@ func (u user) Logout(c *gin.Context) {
|
|||||||
// @description: 用户列表
|
// @description: 用户列表
|
||||||
// @receiver u
|
// @receiver u
|
||||||
// @param c
|
// @param c
|
||||||
func (u user) List(c *gin.Context) {
|
func (user) List(c *gin.Context) {
|
||||||
var p param.UserList
|
var p param.UserList
|
||||||
if err := c.ShouldBind(&p); err != nil {
|
if err := c.ShouldBind(&p); err != nil {
|
||||||
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
||||||
@ -110,7 +110,7 @@ func (u user) List(c *gin.Context) {
|
|||||||
// @description: 获取登陆用户信息
|
// @description: 获取登陆用户信息
|
||||||
// @receiver u
|
// @receiver u
|
||||||
// @param c
|
// @param c
|
||||||
func (u user) GetUser(c *gin.Context) {
|
func (user) GetUser(c *gin.Context) {
|
||||||
info, ok := c.Get("user")
|
info, ok := c.Get("user")
|
||||||
if !ok {
|
if !ok {
|
||||||
utils.GinResponse(c).FailedWithMsg("获取信息失败")
|
utils.GinResponse(c).FailedWithMsg("获取信息失败")
|
||||||
@ -134,7 +134,7 @@ func (u user) GetUser(c *gin.Context) {
|
|||||||
// @description: 新增/更改用户信息
|
// @description: 新增/更改用户信息
|
||||||
// @receiver u
|
// @receiver u
|
||||||
// @param c
|
// @param c
|
||||||
func (u user) Save(c *gin.Context) {
|
func (user) Save(c *gin.Context) {
|
||||||
var p param.SaveUser
|
var p param.SaveUser
|
||||||
if err := c.ShouldBind(&p); err != nil {
|
if err := c.ShouldBind(&p); err != nil {
|
||||||
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
||||||
@ -179,7 +179,7 @@ func (u user) Save(c *gin.Context) {
|
|||||||
// @description: 更改密码
|
// @description: 更改密码
|
||||||
// @receiver u
|
// @receiver u
|
||||||
// @param c
|
// @param c
|
||||||
func (u user) ChangePassword(c *gin.Context) {
|
func (user) ChangePassword(c *gin.Context) {
|
||||||
var p param.ChangePassword
|
var p param.ChangePassword
|
||||||
if err := c.ShouldBind(&p); err != nil {
|
if err := c.ShouldBind(&p); err != nil {
|
||||||
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
||||||
@ -210,7 +210,7 @@ func (u user) ChangePassword(c *gin.Context) {
|
|||||||
// @description: 改变用户状态
|
// @description: 改变用户状态
|
||||||
// @receiver u
|
// @receiver u
|
||||||
// @param c
|
// @param c
|
||||||
func (u user) ChangeUserState(c *gin.Context) {
|
func (user) ChangeUserState(c *gin.Context) {
|
||||||
var p param.ChangeUserState
|
var p param.ChangeUserState
|
||||||
if err := c.ShouldBind(&p); err != nil {
|
if err := c.ShouldBind(&p); err != nil {
|
||||||
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
||||||
|
@ -521,3 +521,219 @@
|
|||||||
[2024-03-07 14:46:13.620] INFO repository/user.go:68 [0s] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
|
[2024-03-07 14:46:13.620] INFO repository/user.go:68 [0s] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
|
||||||
[2024-03-07 14:46:13.621] INFO repository/user.go:93 [1.504ms] [rows:2] SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`is_admin`,`status` FROM `t_user` ORDER BY created_at DESC LIMIT 10
|
[2024-03-07 14:46:13.621] INFO repository/user.go:93 [1.504ms] [rows:2] SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`is_admin`,`status` FROM `t_user` ORDER BY created_at DESC LIMIT 10
|
||||||
[2024-03-07 14:46:13.622] INFO repository/user.go:93 [519.9µs] [rows:1] SELECT count(*) FROM `t_user`
|
[2024-03-07 14:46:13.622] INFO repository/user.go:93 [519.9µs] [rows:1] SELECT count(*) FROM `t_user`
|
||||||
|
[2024-03-07 15:16:08.290] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
|
||||||
|
[2024-03-07 15:16:08.303] INFO migrator/migrator.go:73 [585.7µs] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 15:16:08.303] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
|
||||||
|
[2024-03-07 15:16:08.303] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:16:08.303] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 15:16:08.305] INFO sqlite@v1.5.5/migrator.go:413 [1.1667ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 15:16:08.305] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 15:16:08.305] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 15:16:08.306] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 15:16:08.309] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:16:08.309] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 15:16:08.311] INFO sqlite@v1.5.5/migrator.go:413 [609.4µs] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 15:16:08.311] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 15:16:08.311] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 15:16:08.312] INFO sqlite@v1.5.5/migrator.go:423 [981.7µs] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 15:16:08.314] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
|
||||||
|
[2024-03-07 15:16:08.314] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 15:16:08.314] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
|
||||||
|
[2024-03-07 15:16:08.314] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:16:08.314] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
|
||||||
|
[2024-03-07 15:16:08.315] INFO sqlite@v1.5.5/migrator.go:413 [1.1598ms] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 15:16:08.315] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
|
||||||
|
[2024-03-07 15:16:08.315] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
|
||||||
|
[2024-03-07 15:16:08.316] INFO sqlite@v1.5.5/migrator.go:423 [1.4555ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
|
||||||
|
[2024-03-07 15:16:08.318] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
|
||||||
|
[2024-03-07 15:16:08.319] INFO migrator/migrator.go:73 [59.5µs] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 15:16:08.319] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
|
||||||
|
[2024-03-07 15:16:08.319] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:16:08.319] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 15:16:08.320] INFO sqlite@v1.5.5/migrator.go:413 [1.0816ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 15:16:08.320] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 15:16:08.320] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 15:16:08.321] INFO sqlite@v1.5.5/migrator.go:423 [1.0777ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 15:16:08.324] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:16:08.324] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 15:16:08.325] INFO sqlite@v1.5.5/migrator.go:413 [1.1425ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 15:16:08.325] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 15:16:08.325] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 15:16:08.327] INFO sqlite@v1.5.5/migrator.go:423 [2.1432ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 15:16:08.329] INFO sqlite@v1.5.5/migrator.go:219 [559.3µs] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
|
||||||
|
[2024-03-07 15:16:08.329] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
|
||||||
|
[2024-03-07 15:16:14.683] INFO repository/user.go:44 [0s] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
|
||||||
|
[2024-03-07 15:16:14.684] INFO repository/user.go:32 [0s] [rows:2] SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`is_admin`,`status` FROM `t_user` ORDER BY created_at DESC LIMIT 10
|
||||||
|
[2024-03-07 15:16:14.684] INFO repository/user.go:32 [0s] [rows:1] SELECT count(*) FROM `t_user`
|
||||||
|
[2024-03-07 15:25:12.973] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
|
||||||
|
[2024-03-07 15:25:12.985] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 15:25:12.986] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
|
||||||
|
[2024-03-07 15:25:12.987] INFO sqlite@v1.5.5/migrator.go:79 [53.1µs] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:25:12.987] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 15:25:12.988] INFO sqlite@v1.5.5/migrator.go:413 [595.4µs] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 15:25:12.988] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 15:25:12.988] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 15:25:12.990] INFO sqlite@v1.5.5/migrator.go:423 [961.5µs] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 15:25:12.990] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:25:12.991] INFO sqlite@v1.5.5/migrator.go:368 [57.9µs] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 15:25:12.991] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 15:25:12.992] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 15:25:12.992] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 15:25:12.993] INFO sqlite@v1.5.5/migrator.go:423 [1.0106ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 15:25:12.994] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
|
||||||
|
[2024-03-07 15:25:12.996] INFO migrator/migrator.go:73 [1.3965ms] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 15:25:12.996] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
|
||||||
|
[2024-03-07 15:25:12.996] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:25:12.996] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
|
||||||
|
[2024-03-07 15:25:12.997] INFO sqlite@v1.5.5/migrator.go:413 [1.0128ms] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 15:25:12.997] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
|
||||||
|
[2024-03-07 15:25:12.998] INFO sqlite@v1.5.5/migrator.go:423 [987.4µs] [rows:0] DROP TABLE `t_wg_server`
|
||||||
|
[2024-03-07 15:25:12.998] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
|
||||||
|
[2024-03-07 15:25:13.000] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
|
||||||
|
[2024-03-07 15:25:13.000] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 15:25:13.000] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
|
||||||
|
[2024-03-07 15:25:13.001] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:25:13.001] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 15:25:13.002] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 15:25:13.002] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 15:25:13.003] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 15:25:13.004] INFO sqlite@v1.5.5/migrator.go:423 [1.0087ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 15:25:13.006] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 15:25:13.006] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 15:25:13.007] INFO sqlite@v1.5.5/migrator.go:413 [999.4µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 15:25:13.007] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 15:25:13.007] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 15:25:13.008] INFO sqlite@v1.5.5/migrator.go:423 [1.0009ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 15:25:13.010] INFO sqlite@v1.5.5/migrator.go:219 [513.4µs] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
|
||||||
|
[2024-03-07 15:25:13.010] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
|
||||||
|
[2024-03-07 16:08:27.564] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
|
||||||
|
[2024-03-07 16:08:27.578] INFO migrator/migrator.go:73 [529.5µs] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:08:27.578] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
|
||||||
|
[2024-03-07 16:08:27.579] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:08:27.579] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 16:08:27.580] INFO sqlite@v1.5.5/migrator.go:413 [1.0482ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:08:27.580] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 16:08:27.581] INFO sqlite@v1.5.5/migrator.go:423 [516.7µs] [rows:2] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 16:08:27.582] INFO sqlite@v1.5.5/migrator.go:423 [1.1006ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 16:08:27.584] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:08:27.585] INFO sqlite@v1.5.5/migrator.go:368 [549.9µs] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 16:08:27.585] INFO sqlite@v1.5.5/migrator.go:413 [518µs] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:08:27.586] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 16:08:27.586] INFO sqlite@v1.5.5/migrator.go:423 [524.7µs] [rows:2] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 16:08:27.587] INFO sqlite@v1.5.5/migrator.go:423 [1.1637ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 16:08:27.589] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
|
||||||
|
[2024-03-07 16:08:27.589] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:08:27.589] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
|
||||||
|
[2024-03-07 16:08:27.589] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:08:27.589] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
|
||||||
|
[2024-03-07 16:08:27.590] INFO sqlite@v1.5.5/migrator.go:413 [520.9µs] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:08:27.591] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
|
||||||
|
[2024-03-07 16:08:27.591] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
|
||||||
|
[2024-03-07 16:08:27.592] INFO sqlite@v1.5.5/migrator.go:423 [1.1759ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
|
||||||
|
[2024-03-07 16:08:27.594] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
|
||||||
|
[2024-03-07 16:08:27.594] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:08:27.595] INFO sqlite@v1.5.5/migrator.go:125 [541.8µs] [-] SELECT * FROM `t_wg_client` LIMIT 1
|
||||||
|
[2024-03-07 16:08:27.595] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:08:27.595] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 16:08:27.596] INFO sqlite@v1.5.5/migrator.go:413 [526.2µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 16:08:27.596] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 16:08:27.596] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 16:08:27.598] INFO sqlite@v1.5.5/migrator.go:423 [1.1396ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 16:08:27.600] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:08:27.600] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 16:08:27.601] INFO sqlite@v1.5.5/migrator.go:413 [532.6µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 16:08:27.601] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 16:08:27.602] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 16:08:27.603] INFO sqlite@v1.5.5/migrator.go:423 [1.5874ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 16:08:27.605] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
|
||||||
|
[2024-03-07 16:08:27.605] INFO script/db_migrate.go:55 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
|
||||||
|
[2024-03-07 16:08:27.605] INFO script/db_migrate.go:92 [0s] [rows:1] SELECT count(*) FROM `t_wg_server`
|
||||||
|
[2024-03-07 16:08:27.609] INFO repository/server.go:40 [3.9316ms] [rows:1] INSERT INTO `t_wg_server` (`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) VALUES ("03a7d57deabd42d6a634ceb2499d63f0","2024-03-07 16:08:27","2024-03-07 16:08:27","10.10.10.1/24",51820,"qMyd0aHQ0tgbVHsYqYZcvloHEsM/vtumc8tNBurIDUE=","Iuk9z5NaiwMA8NiOuqioDPZWL2zfG9hXzY/xL3nXIQA=","","","")
|
||||||
|
[2024-03-07 16:47:48.440] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
|
||||||
|
[2024-03-07 16:47:48.454] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:47:48.454] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
|
||||||
|
[2024-03-07 16:47:48.454] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:47:48.454] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 16:47:48.456] INFO sqlite@v1.5.5/migrator.go:413 [1.0624ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:47:48.456] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 16:47:48.457] INFO sqlite@v1.5.5/migrator.go:423 [607.6µs] [rows:2] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 16:47:48.458] INFO sqlite@v1.5.5/migrator.go:423 [1.0321ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 16:47:48.460] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:47:48.460] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 16:47:48.461] INFO sqlite@v1.5.5/migrator.go:413 [537.7µs] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:47:48.462] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 16:47:48.462] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 16:47:48.463] INFO sqlite@v1.5.5/migrator.go:423 [524.6µs] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 16:47:48.465] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
|
||||||
|
[2024-03-07 16:47:48.465] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:47:48.466] INFO sqlite@v1.5.5/migrator.go:125 [503.5µs] [-] SELECT * FROM `t_wg_server` LIMIT 1
|
||||||
|
[2024-03-07 16:47:48.466] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:47:48.466] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
|
||||||
|
[2024-03-07 16:47:48.467] INFO sqlite@v1.5.5/migrator.go:413 [520.9µs] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:47:48.467] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
|
||||||
|
[2024-03-07 16:47:48.468] INFO sqlite@v1.5.5/migrator.go:423 [517.6µs] [rows:1] DROP TABLE `t_wg_server`
|
||||||
|
[2024-03-07 16:47:48.469] INFO sqlite@v1.5.5/migrator.go:423 [1.1113ms] [rows:1] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
|
||||||
|
[2024-03-07 16:47:48.471] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
|
||||||
|
[2024-03-07 16:47:48.471] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:47:48.472] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
|
||||||
|
[2024-03-07 16:47:48.472] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:47:48.472] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 16:47:48.473] INFO sqlite@v1.5.5/migrator.go:413 [1.0476ms] [rows:1] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 16:47:48.473] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 16:47:48.474] INFO sqlite@v1.5.5/migrator.go:423 [517.4µs] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 16:47:48.475] INFO sqlite@v1.5.5/migrator.go:423 [1.1308ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 16:47:48.477] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:47:48.477] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 16:47:48.478] INFO sqlite@v1.5.5/migrator.go:413 [1.0524ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 16:47:48.478] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 16:47:48.479] INFO sqlite@v1.5.5/migrator.go:423 [525.7µs] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 16:47:48.480] INFO sqlite@v1.5.5/migrator.go:423 [1.6294ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 16:47:48.481] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
|
||||||
|
[2024-03-07 16:47:48.481] INFO script/db_migrate.go:56 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
|
||||||
|
[2024-03-07 16:47:48.482] INFO script/db_migrate.go:93 [0s] [rows:1] SELECT count(*) FROM `t_wg_server`
|
||||||
|
[2024-03-07 16:48:01.634] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
|
||||||
|
[2024-03-07 16:48:01.647] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:48:01.648] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
|
||||||
|
[2024-03-07 16:48:01.648] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:48:01.648] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 16:48:01.649] INFO sqlite@v1.5.5/migrator.go:413 [1.0103ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:48:01.650] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 16:48:01.650] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 16:48:01.651] INFO sqlite@v1.5.5/migrator.go:423 [1.0022ms] [rows:0] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 16:48:01.653] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:48:01.653] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
|
||||||
|
[2024-03-07 16:48:01.654] INFO sqlite@v1.5.5/migrator.go:413 [503.8µs] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` tinyint(1) NOT NULL,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:48:01.654] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
|
||||||
|
[2024-03-07 16:48:01.655] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_user`
|
||||||
|
[2024-03-07 16:48:01.656] INFO sqlite@v1.5.5/migrator.go:423 [998.5µs] [rows:0] ALTER TABLE `t_user__temp` RENAME TO `t_user`
|
||||||
|
[2024-03-07 16:48:01.658] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
|
||||||
|
[2024-03-07 16:48:01.658] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:48:01.659] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
|
||||||
|
[2024-03-07 16:48:01.659] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:48:01.659] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
|
||||||
|
[2024-03-07 16:48:01.660] INFO sqlite@v1.5.5/migrator.go:413 [507.9µs] [rows:0] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
|
||||||
|
[2024-03-07 16:48:01.660] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
|
||||||
|
[2024-03-07 16:48:01.662] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
|
||||||
|
[2024-03-07 16:48:01.663] INFO sqlite@v1.5.5/migrator.go:423 [1.0022ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
|
||||||
|
[2024-03-07 16:48:01.665] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
|
||||||
|
[2024-03-07 16:48:01.665] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
|
||||||
|
[2024-03-07 16:48:01.665] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
|
||||||
|
[2024-03-07 16:48:01.665] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:48:01.665] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 16:48:01.667] INFO sqlite@v1.5.5/migrator.go:413 [1.0008ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 16:48:01.667] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 16:48:01.667] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 16:48:01.669] INFO sqlite@v1.5.5/migrator.go:423 [2.0049ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 16:48:01.671] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
|
||||||
|
[2024-03-07 16:48:01.671] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
|
||||||
|
[2024-03-07 16:48:01.672] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
|
||||||
|
[2024-03-07 16:48:01.673] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
|
||||||
|
[2024-03-07 16:48:01.673] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
|
||||||
|
[2024-03-07 16:48:01.675] INFO sqlite@v1.5.5/migrator.go:423 [1.998ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
|
||||||
|
[2024-03-07 16:48:01.676] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
|
||||||
|
[2024-03-07 16:48:01.677] INFO script/db_migrate.go:56 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
|
||||||
|
[2024-03-07 16:48:02.614] INFO repository/user.go:89 [2.5668ms] [rows:1] INSERT INTO `t_user` (`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) VALUES ("0dbdde3660934396b79a6bad002d82a8","2024-03-07 16:48:02","2024-03-07 16:48:02","http://wireguard-dashboard.oss-cn-chengdu.aliyuncs.com/wg/1a0fb80c-fa8f-43c7-8357-2502f62dc48f.png","超牛管理员","Admin","","$2a$10$UsOdMPNyy3xp4o.hKs6ZjuEu57XSuN7xGcjd5k5I2iinK1/OzpGMS",1,1)
|
||||||
|
[2024-03-07 16:48:02.614] INFO script/db_migrate.go:93 [0s] [rows:1] SELECT count(*) FROM `t_wg_server`
|
||||||
|
[2024-03-07 16:48:03.623] ERROR repository/system.go:28 no such table: t_setting -> SELECT * FROM `t_setting` WHERE code = "SERVER_SETTING" ORDER BY `t_setting`.`id` LIMIT 1
|
||||||
|
[2024-03-07 16:48:03.624] ERROR repository/system.go:59 no such table: t_setting -> INSERT INTO `t_setting` (`id`,`created_at`,`updated_at`,`code`,`data`,`describe`) VALUES ("34ef92b3423a4ac1a20535bafe2f759f","2024-03-07 16:48:03","2024-03-07 16:48:03","SERVER_SETTING","{""MTU"":1450,""configFilePath"":""/etc/wireguard/wg0.conf"",""dnsServer"":""10.10.10.1/24"",""endpointAddress"":""222.183.239.10"",""firewallMark"":"""",""persistentKeepalive"":15,""table"":""""}","服务端全局配置")
|
||||||
|
[2024-03-07 16:48:03.624] ERROR script/db_migrate.go:30 no such table: t_setting
|
||||||
|
3
main.go
3
main.go
@ -19,8 +19,9 @@ func init() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
route.IncludeRouters(
|
route.IncludeRouters(
|
||||||
route.Captcha,
|
route.CaptchaApi,
|
||||||
route.UserApi,
|
route.UserApi,
|
||||||
|
route.ServerApi,
|
||||||
)
|
)
|
||||||
handler := route.InitRouter()
|
handler := route.InitRouter()
|
||||||
|
|
||||||
|
12
model/entity/system.go
Normal file
12
model/entity/system.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type Setting struct {
|
||||||
|
Base
|
||||||
|
Code string `json:"code" gorm:"type:char(20);not null;comment:'设定code'"`
|
||||||
|
Data string `json:"data" gorm:"type:text;not null;comment:'值'"`
|
||||||
|
Describe string `json:"describe" gorm:"type:text;default null;comment:'默认值'"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Setting) TableName() string {
|
||||||
|
return "t_setting"
|
||||||
|
}
|
11
model/vo/system.go
Normal file
11
model/vo/system.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package vo
|
||||||
|
|
||||||
|
type ServerSetting struct {
|
||||||
|
EndpointAddress string `json:"endpointAddress"`
|
||||||
|
DnsServers []string `json:"dnsServers"`
|
||||||
|
MTU int `json:"MTU"`
|
||||||
|
PersistentKeepalive int `json:"persistentKeepalive"`
|
||||||
|
FirewallMark string `json:"firewallMark"`
|
||||||
|
Table string `json:"table"`
|
||||||
|
ConfigFilePath string `json:"configFilePath"`
|
||||||
|
}
|
14
model/vo/wireguard.go
Normal file
14
model/vo/wireguard.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
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"`
|
||||||
|
}
|
41
repository/server.go
Normal file
41
repository/server.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"wireguard-dashboard/client"
|
||||||
|
"wireguard-dashboard/model/entity"
|
||||||
|
"wireguard-dashboard/model/vo"
|
||||||
|
)
|
||||||
|
|
||||||
|
type server struct {
|
||||||
|
*gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func Server() server {
|
||||||
|
return server{
|
||||||
|
client.DB,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServer
|
||||||
|
// @description: 获取服务端信息
|
||||||
|
// @receiver r
|
||||||
|
// @return data
|
||||||
|
// @return err
|
||||||
|
func (r server) GetServer() (data *vo.Server, err error) {
|
||||||
|
err = r.Model(&entity.Server{}).First(&data).Error
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save
|
||||||
|
// @description: 新增/更新服务端信息
|
||||||
|
// @receiver r
|
||||||
|
// @param ent
|
||||||
|
// @return err
|
||||||
|
func (r server) Save(ent *entity.Server) (err error) {
|
||||||
|
if ent.Id != "" {
|
||||||
|
return r.Model(&entity.Server{}).Updates(&ent).Error
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.Model(&entity.Server{}).Create(&ent).Error
|
||||||
|
}
|
64
repository/system.go
Normal file
64
repository/system.go
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"wireguard-dashboard/client"
|
||||||
|
"wireguard-dashboard/model/entity"
|
||||||
|
"wireguard-dashboard/model/vo"
|
||||||
|
)
|
||||||
|
|
||||||
|
type system struct {
|
||||||
|
*gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func System() system {
|
||||||
|
return system{
|
||||||
|
client.DB,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetConfigByCode
|
||||||
|
// @description:
|
||||||
|
// @receiver r
|
||||||
|
// @param code
|
||||||
|
// @return data
|
||||||
|
// @return err
|
||||||
|
func (r system) GetConfigByCode(code string) (data *entity.Setting, err error) {
|
||||||
|
err = r.Model(&entity.Setting{}).Where("code = ?", code).First(&data).Error
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServerSetting
|
||||||
|
// @description: 获取服务端全局配置
|
||||||
|
// @receiver r
|
||||||
|
// @return data
|
||||||
|
// @return err
|
||||||
|
func (r system) GetServerSetting() (data *vo.ServerSetting, err error) {
|
||||||
|
config, err := r.GetConfigByCode("SERVER_SETTING")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = json.Unmarshal([]byte(config.Data), &data); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save
|
||||||
|
// @description: 新增/编辑配置
|
||||||
|
// @receiver r
|
||||||
|
// @param ent
|
||||||
|
// @return err
|
||||||
|
func (r system) Save(ent *entity.Setting) (err error) {
|
||||||
|
conf, err := r.GetConfigByCode(ent.Code)
|
||||||
|
// 新增
|
||||||
|
if err != nil || conf == nil {
|
||||||
|
return r.Model(&entity.Setting{}).Create(ent).Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
return r.Model(&entity.Setting{}).Where("code = ?", ent.Code).Updates(&ent).Error
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package repository
|
package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
"wireguard-dashboard/client"
|
"wireguard-dashboard/client"
|
||||||
"wireguard-dashboard/http/param"
|
"wireguard-dashboard/http/param"
|
||||||
"wireguard-dashboard/model/entity"
|
"wireguard-dashboard/model/entity"
|
||||||
@ -8,10 +9,14 @@ import (
|
|||||||
"wireguard-dashboard/utils"
|
"wireguard-dashboard/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type user struct{}
|
type user struct {
|
||||||
|
*gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
func User() user {
|
func User() user {
|
||||||
return user{}
|
return user{
|
||||||
|
client.DB,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List
|
// List
|
||||||
@ -22,7 +27,7 @@ func User() user {
|
|||||||
// @return total
|
// @return total
|
||||||
// @return err
|
// @return err
|
||||||
func (r user) List(p param.UserList) (data []vo.User, total int64, err error) {
|
func (r user) List(p param.UserList) (data []vo.User, total int64, err error) {
|
||||||
err = client.DB.Model(&entity.User{}).Scopes(utils.Page(p.Current, p.Size)).
|
err = r.Model(&entity.User{}).Scopes(utils.Page(p.Current, p.Size)).
|
||||||
Select("id", "created_at", "updated_at", "avatar", "name", "account", "is_admin", "status").Order("created_at DESC").
|
Select("id", "created_at", "updated_at", "avatar", "name", "account", "is_admin", "status").Order("created_at DESC").
|
||||||
Find(&data).Offset(-1).Limit(-1).Count(&total).Error
|
Find(&data).Offset(-1).Limit(-1).Count(&total).Error
|
||||||
|
|
||||||
@ -36,7 +41,7 @@ func (r user) List(p param.UserList) (data []vo.User, total int64, err error) {
|
|||||||
// @return *entity.User
|
// @return *entity.User
|
||||||
// @return error
|
// @return error
|
||||||
func (r user) GetUserById(id string) (data *entity.User, err error) {
|
func (r user) GetUserById(id string) (data *entity.User, err error) {
|
||||||
err = client.DB.Where("id = ?", id).First(&data).Error
|
err = r.Where("id = ?", id).First(&data).Error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +52,7 @@ func (r user) GetUserById(id string) (data *entity.User, err error) {
|
|||||||
// @return data
|
// @return data
|
||||||
// @return err
|
// @return err
|
||||||
func (r user) GetUserByAccount(account string) (data *entity.User, err error) {
|
func (r user) GetUserByAccount(account string) (data *entity.User, err error) {
|
||||||
err = client.DB.Where("account = ?", account).First(&data).Error
|
err = r.Where("account = ?", account).First(&data).Error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +72,7 @@ func (r user) Save(ent *entity.User) (err error) {
|
|||||||
"status": ent.Status,
|
"status": ent.Status,
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.DB.Model(&entity.User{}).Where("id = ?", ent.Id).Updates(&updates).Error
|
return r.Model(&entity.User{}).Where("id = ?", ent.Id).Updates(&updates).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultPassword := utils.Password().GenerateHashPassword("admin123")
|
defaultPassword := utils.Password().GenerateHashPassword("admin123")
|
||||||
@ -81,7 +86,7 @@ func (r user) Save(ent *entity.User) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建
|
// 创建
|
||||||
return client.DB.Create(&ent).Error
|
return r.Create(&ent).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangePassword
|
// ChangePassword
|
||||||
@ -92,7 +97,7 @@ func (r user) Save(ent *entity.User) (err error) {
|
|||||||
// @return err
|
// @return err
|
||||||
func (r user) ChangePassword(p param.ChangePassword, userId string) (err error) {
|
func (r user) ChangePassword(p param.ChangePassword, userId string) (err error) {
|
||||||
password := utils.Password().GenerateHashPassword(p.NewPassword)
|
password := utils.Password().GenerateHashPassword(p.NewPassword)
|
||||||
return client.DB.Model(&entity.User{}).Where("id = ?", userId).Update("password", password).Error
|
return r.Model(&entity.User{}).Where("id = ?", userId).Update("password", password).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeUserState
|
// ChangeUserState
|
||||||
@ -101,5 +106,5 @@ func (r user) ChangePassword(p param.ChangePassword, userId string) (err error)
|
|||||||
// @param p
|
// @param p
|
||||||
// @return err
|
// @return err
|
||||||
func (r user) ChangeUserState(p param.ChangeUserState) (err error) {
|
func (r user) ChangeUserState(p param.ChangeUserState) (err error) {
|
||||||
return client.DB.Model(&entity.User{}).Where("id = ?", p.ID).Update("status", p.Status).Error
|
return r.Model(&entity.User{}).Where("id = ?", p.ID).Update("status", p.Status).Error
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"wireguard-dashboard/http/api"
|
"wireguard-dashboard/http/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Captcha
|
// CaptchaApi
|
||||||
// @description: 验证码
|
// @description: 验证码
|
||||||
// @param r
|
// @param r
|
||||||
func Captcha(r *gin.Engine) {
|
func CaptchaApi(r *gin.Engine) {
|
||||||
captcha := r.Group("captcha")
|
captcha := r.Group("captcha")
|
||||||
{
|
{
|
||||||
captcha.GET("", api.Captcha().GenerateCaptcha) // 生成验证码
|
captcha.GET("", api.Captcha().GenerateCaptcha) // 生成验证码
|
||||||
|
14
route/server.go
Normal file
14
route/server.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package route
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"wireguard-dashboard/http/api"
|
||||||
|
"wireguard-dashboard/middleware"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ServerApi(r *gin.Engine) {
|
||||||
|
apiGroup := r.Group("server", middleware.Authorization())
|
||||||
|
{
|
||||||
|
apiGroup.GET("", api.Server().GetServer) // 获取服务端信息
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,9 @@
|
|||||||
package script
|
package script
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"gitee.ltd/lxh/logger/log"
|
"gitee.ltd/lxh/logger/log"
|
||||||
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||||
"wireguard-dashboard/client"
|
"wireguard-dashboard/client"
|
||||||
"wireguard-dashboard/constant"
|
"wireguard-dashboard/constant"
|
||||||
"wireguard-dashboard/model/entity"
|
"wireguard-dashboard/model/entity"
|
||||||
@ -24,6 +26,10 @@ func (s Script) Do() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := s.InitServer(); err != nil {
|
||||||
|
log.Error(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +42,7 @@ func (s Script) DBMigrate() error {
|
|||||||
new(entity.User),
|
new(entity.User),
|
||||||
new(entity.Server),
|
new(entity.Server),
|
||||||
new(entity.Client),
|
new(entity.Client),
|
||||||
|
new(entity.Setting),
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.DB.AutoMigrate(ent...)
|
return client.DB.AutoMigrate(ent...)
|
||||||
@ -77,3 +84,64 @@ func (s Script) CreateSuperAdmin() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InitServer
|
||||||
|
// @description: 初始化服务端信息
|
||||||
|
// @receiver s
|
||||||
|
// @return error
|
||||||
|
func (s Script) InitServer() error {
|
||||||
|
var count int64
|
||||||
|
if err := client.DB.Model(&entity.Server{}).Count(&count).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if count > 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化服务端的全局配置
|
||||||
|
var data = map[string]any{
|
||||||
|
"endpointAddress": utils.Network().GetHostPublicIP(),
|
||||||
|
"dnsServer": "10.10.10.1/24",
|
||||||
|
"MTU": 1450,
|
||||||
|
"persistentKeepalive": 15,
|
||||||
|
"firewallMark": "",
|
||||||
|
"table": "",
|
||||||
|
"configFilePath": "/etc/wireguard/wg0.conf",
|
||||||
|
}
|
||||||
|
dataJ, _ := json.Marshal(data)
|
||||||
|
|
||||||
|
globalSet := &entity.Setting{
|
||||||
|
Code: "SERVER_SETTING",
|
||||||
|
Data: string(dataJ),
|
||||||
|
Describe: "服务端全局配置",
|
||||||
|
}
|
||||||
|
if err := repository.System().Save(globalSet); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成密钥
|
||||||
|
privateKey, err := wgtypes.GeneratePrivateKey()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("生成密钥失败: %v", err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据密钥生成公钥
|
||||||
|
publicKey := privateKey.PublicKey()
|
||||||
|
|
||||||
|
// 没有服务端,开始初始化
|
||||||
|
if err := repository.Server().Save(&entity.Server{
|
||||||
|
IpScope: "10.10.10.1/24",
|
||||||
|
ListenPort: 51820,
|
||||||
|
PrivateKey: privateKey.String(),
|
||||||
|
PublicKey: publicKey.String(),
|
||||||
|
PostUpScript: "",
|
||||||
|
PreDownScript: "",
|
||||||
|
PostDownScript: "",
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
9
template/wg.conf
Normal file
9
template/wg.conf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Interface]
|
||||||
|
Address = {{ .Address }}
|
||||||
|
ListenPort = {{ .ListenPort }}
|
||||||
|
PrivateKey = {{ .PrivateKey }}
|
||||||
|
MTU = {{ .MTU }}
|
||||||
|
PostUp = {{ .PostUp }}
|
||||||
|
PreDown = {{ .PreDown }}
|
||||||
|
PostDown = {{ .PostDown }}
|
||||||
|
Table = {{ .Table }}
|
27
utils/network.go
Normal file
27
utils/network.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gitee.ltd/lxh/logger/log"
|
||||||
|
"wireguard-dashboard/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type network struct{}
|
||||||
|
|
||||||
|
func Network() network {
|
||||||
|
return network{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHostPublicIP
|
||||||
|
// @description: 获取本机公网地址
|
||||||
|
// @receiver network
|
||||||
|
// @return string
|
||||||
|
func (network) GetHostPublicIP() string {
|
||||||
|
var response = map[string]string{}
|
||||||
|
_, err := client.HttpClient.R().SetResult(&response).Get("https://httpbin.org/ip")
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("获取本机公网IP失败: %v", err.Error())
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return response["origin"]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user