diff --git a/CHANGELOG.md b/CHANGELOG.md index e6236a7..d6e496e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 更新日志 +24w18c +--- +- PRE-RELEASE: 此版本是预发布版本,请勿在生产环境中使用 +- CHANGE: 修正配置命名,改为驼峰式命名 +- CHANGE: 修正函数命名 + 24w18b --- - PRE-RELEASE: 此版本是预发布版本,请勿在生产环境中使用 diff --git a/DEV-VERSION b/DEV-VERSION index 4730c0a..8074ad4 100644 --- a/DEV-VERSION +++ b/DEV-VERSION @@ -1 +1 @@ -24w18b \ No newline at end of file +24w18c \ No newline at end of file diff --git a/config/config.go b/config/config.go index e6d46a8..85fcc22 100644 --- a/config/config.go +++ b/config/config.go @@ -16,12 +16,12 @@ type Config struct { type ServerConfig struct { Port int `toml:"port"` Host string `toml:"host"` - SizeLimit int `toml:"sizelimit"` + SizeLimit int `toml:"sizeLimit"` } type LogConfig struct { - LogFilePath string `toml:"logfilepath"` - MaxLogSize int `toml:"maxlogsize"` + LogFilePath string `toml:"logFilePath"` + MaxLogSize int `toml:"maxLogSize"` } type CORSConfig struct { @@ -30,17 +30,17 @@ type CORSConfig struct { type AuthConfig struct { Enabled bool `toml:"enabled"` - AuthToken string `toml:"authtoken"` + AuthToken string `toml:"authToken"` } type BlacklistConfig struct { Enabled bool `toml:"enabled"` - BlacklistFile string `toml:"blacklistfile"` + BlacklistFile string `toml:"blacklistFile"` } type WhitelistConfig struct { Enabled bool `toml:"enabled"` - WhitelistFile string `toml:"whitelistfile"` + WhitelistFile string `toml:"whitelistFile"` } // LoadConfig 从 TOML 配置文件加载配置 diff --git a/config/config.toml b/config/config.toml index 9ad12bf..f71d806 100644 --- a/config/config.toml +++ b/config/config.toml @@ -1,23 +1,26 @@ [server] host = "127.0.0.1" port = 8080 -sizelimit = 131072000 # 125MB +sizeLimit = 131072000 # 125MB [log] -logfilepath = "/data/ghproxy/log/ghproxy.log" -maxlogsize = 5 # MB +logFilePath = "/data/ghproxy/log/ghproxy.log" +maxLogSize = 5 # MB [cors] enabled = true [auth] -authtoken = "test" +authToken = "test" enabled = false [blacklist] -blacklistfile = "/data/ghproxy/config/blacklist.json" +blacklistFile = "/data/ghproxy/config/blacklist.json" enabled = false [whitelist] enabled = false -whitelistfile = "/data/ghproxy/config/whitelist.json" +whitelistFile = "/data/ghproxy/config/whitelist.json" + +[downloadFolder] +enabled = false diff --git a/main.go b/main.go index 90144dc..2ba1fc3 100644 --- a/main.go +++ b/main.go @@ -30,7 +30,7 @@ var ( logError = logger.LogError ) -func ReadFlag() { +func readFlag() { flag.StringVar(&cfgfile, "cfg", configfile, "config file path") } @@ -57,7 +57,7 @@ func setupLogger(cfg *config.Config) { logInfo("Init Completed") } -func Loadlist(cfg *config.Config) { +func loadlist(cfg *config.Config) { auth.Init(cfg) } @@ -67,11 +67,11 @@ func setupApi(cfg *config.Config, router *gin.Engine) { } func init() { - ReadFlag() + readFlag() flag.Parse() loadConfig() setupLogger(cfg) - Loadlist(cfg) + loadlist(cfg) // 设置 Gin 模式 gin.SetMode(gin.ReleaseMode)