This commit is contained in:
wjqserver 2025-03-10 18:53:12 +08:00
parent d26f6d1e1b
commit a18660121a
18 changed files with 638 additions and 118 deletions

View file

@ -7,9 +7,9 @@ import (
type Config struct {
Server ServerConfig
Httpc HttpcConfig
GitClone GitCloneConfig
Pages PagesConfig
Log LogConfig
CORS CORSConfig
Auth AuthConfig
Blacklist BlacklistConfig
Whitelist WhitelistConfig
@ -31,6 +31,7 @@ type ServerConfig struct {
Host string `toml:"host"`
SizeLimit int `toml:"sizeLimit"`
H2C bool `toml:"H2C"`
Cors string `toml:"cors"`
EnableH2C string `toml:"enableH2C"`
Debug bool `toml:"debug"`
}
@ -49,6 +50,16 @@ type HttpcConfig struct {
MaxConnsPerHost int `toml:"maxConnsPerHost"`
}
/*
[gitclone]
mode = "bypass" # bypass / cache
dir = "./repos"
*/
type GitCloneConfig struct {
Mode string `toml:"mode"`
Dir string `toml:"dir"`
}
/*
[pages]
mode = "internal" # "internal" or "external"
@ -69,10 +80,6 @@ type LogConfig struct {
Level string `toml:"level"`
}
type CORSConfig struct {
Enabled bool `toml:"enabled"`
}
type AuthConfig struct {
Enabled bool `toml:"enabled"`
AuthMethod string `toml:"authMethod"`

View file

@ -3,7 +3,7 @@ host = "0.0.0.0"
port = 8080
sizeLimit = 125 # MB
H2C = true
enableH2C = "on" # "on" or "off"
cors = "*" # "*"/"" -> "*" ; "nil" -> "" ;
debug = false
[httpc]
@ -12,9 +12,12 @@ maxIdleConns = 100 # only for advanced mode
maxIdleConnsPerHost = 60 # only for advanced mode
maxConnsPerHost = 0 # only for advanced mode
[gitclone]
mode = "bypass" # bypass / cache
dir = "./repos"
[pages]
mode = "internal" # "internal" or "external"
enabled = false
theme = "bootstrap" # "bootstrap" or "nebula"
staticDir = "/data/www"
@ -23,9 +26,6 @@ logFilePath = "/data/ghproxy/log/ghproxy.log"
maxLogSize = 5 # MB
level = "info" # dump, debug, info, warn, error, none
[cors]
enabled = true
[auth]
authMethod = "parameters" # "header" or "parameters"
authToken = "token"