修改为sql数据库

This commit is contained in:
bjdgyc
2021-07-15 18:17:37 +08:00
parent 6daf9cbfa3
commit 884f41d2f8
19 changed files with 351 additions and 175 deletions

View File

@@ -2,6 +2,6 @@ package base
const (
APP_NAME = "AnyLink"
// 修复严重bug
APP_VER = "0.4.2"
// 修改为sql数据库
APP_VER = "0.5.1"
)

View File

@@ -36,17 +36,19 @@ type ServerConfig struct {
ServerDTLS bool `json:"server_dtls"`
AdminAddr string `json:"admin_addr"`
ProxyProtocol bool `json:"proxy_protocol"`
DbFile string `json:"db_file"`
CertFile string `json:"cert_file"`
CertKey string `json:"cert_key"`
FilesPath string `json:"files_path"`
LogPath string `json:"log_path"`
LogLevel string `json:"log_level"`
Pprof bool `json:"pprof"`
Issuer string `json:"issuer"`
AdminUser string `json:"admin_user"`
AdminPass string `json:"admin_pass"`
JwtSecret string `json:"jwt_secret"`
// DbFile string `json:"db_file"`
DbType string `json:"db_type"`
DbDsn string `json:"db_dsn"`
CertFile string `json:"cert_file"`
CertKey string `json:"cert_key"`
FilesPath string `json:"files_path"`
LogPath string `json:"log_path"`
LogLevel string `json:"log_level"`
Pprof bool `json:"pprof"`
Issuer string `json:"issuer"`
AdminUser string `json:"admin_user"`
AdminPass string `json:"admin_pass"`
JwtSecret string `json:"jwt_secret"`
LinkMode string `json:"link_mode"` // tun tap
Ipv4CIDR string `json:"ipv4_cidr"` // 192.168.1.0/24

View File

@@ -23,7 +23,8 @@ var configs = []config{
{Typ: cfgStr, Name: "server_dtls_addr", Usage: "DTLS监听地址", ValStr: ":4433"},
{Typ: cfgStr, Name: "admin_addr", Usage: "后台服务监听地址", ValStr: ":8800"},
{Typ: cfgBool, Name: "proxy_protocol", Usage: "TCP代理协议", ValBool: false},
{Typ: cfgStr, Name: "db_file", Usage: "数据库地址", ValStr: "./conf/data.db"},
{Typ: cfgStr, Name: "db_type", Usage: "数据库类型[sqlite3、mysql、postgres]", ValStr: "sqlite3"},
{Typ: cfgStr, Name: "db_dsn", Usage: "数据库dsn", ValStr: "./conf/sqlite3.db"},
{Typ: cfgStr, Name: "cert_file", Usage: "证书文件", ValStr: "./conf/vpn_cert.pem"},
{Typ: cfgStr, Name: "cert_key", Usage: "证书密钥", ValStr: "./conf/vpn_cert.key"},
{Typ: cfgStr, Name: "files_path", Usage: "外部下载文件路径", ValStr: "./conf/files"},