mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
4.2.0-rc.0
This commit is contained in:
parent
95dd34a456
commit
d2d9ad1db7
12 changed files with 139 additions and 15 deletions
|
|
@ -7,18 +7,19 @@ import (
|
|||
)
|
||||
|
||||
type Config struct {
|
||||
Server ServerConfig
|
||||
Httpc HttpcConfig
|
||||
GitClone GitCloneConfig
|
||||
Shell ShellConfig
|
||||
Pages PagesConfig
|
||||
Log LogConfig
|
||||
Auth AuthConfig
|
||||
Blacklist BlacklistConfig
|
||||
Whitelist WhitelistConfig
|
||||
RateLimit RateLimitConfig
|
||||
Outbound OutboundConfig
|
||||
Docker DockerConfig
|
||||
Server ServerConfig `toml:"server"`
|
||||
Httpc HttpcConfig `toml:"httpc"`
|
||||
GitClone GitCloneConfig `toml:"gitclone"`
|
||||
Shell ShellConfig `toml:"shell"`
|
||||
Pages PagesConfig `toml:"pages"`
|
||||
Log LogConfig `toml:"log"`
|
||||
Auth AuthConfig `toml:"auth"`
|
||||
Blacklist BlacklistConfig `toml:"blacklist"`
|
||||
Whitelist WhitelistConfig `toml:"whitelist"`
|
||||
IPFilter IPFilterConfig `toml:"ipFilter"`
|
||||
RateLimit RateLimitConfig `toml:"rateLimit"`
|
||||
Outbound OutboundConfig `toml:"outbound"`
|
||||
Docker DockerConfig `toml:"docker"`
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -128,6 +129,13 @@ type WhitelistConfig struct {
|
|||
WhitelistFile string `toml:"whitelistFile"`
|
||||
}
|
||||
|
||||
type IPFilterConfig struct {
|
||||
Enabled bool `toml:"enabled"`
|
||||
EnableAllowList bool `toml:"enableAllowList"`
|
||||
EnableBlockList bool `toml:"enableBlockList"`
|
||||
IPFilterFile string
|
||||
}
|
||||
|
||||
/*
|
||||
[rateLimit]
|
||||
enabled = false
|
||||
|
|
@ -273,6 +281,12 @@ func DefaultConfig() *Config {
|
|||
Enabled: false,
|
||||
WhitelistFile: "/data/ghproxy/config/whitelist.json",
|
||||
},
|
||||
IPFilter: IPFilterConfig{
|
||||
Enabled: false,
|
||||
IPFilterFile: "/data/ghproxy/config/ipfilter.json",
|
||||
EnableAllowList: false,
|
||||
EnableBlockList: false,
|
||||
},
|
||||
RateLimit: RateLimitConfig{
|
||||
Enabled: false,
|
||||
RatePerMinute: 100,
|
||||
|
|
|
|||
|
|
@ -49,6 +49,12 @@ enabled = false
|
|||
enabled = false
|
||||
whitelistFile = "/data/ghproxy/config/whitelist.json"
|
||||
|
||||
[ipFilter]
|
||||
enabled = false
|
||||
enableAllowList = false
|
||||
enableBlockList = false
|
||||
ipFilterFile = "/data/ghproxy/config/ipfilter.json"
|
||||
|
||||
[rateLimit]
|
||||
enabled = false
|
||||
ratePerMinute = 180
|
||||
|
|
|
|||
11
config/ipfilter.json
Normal file
11
config/ipfilter.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"allow": [
|
||||
"127.0.0.1",
|
||||
"192.168.1.0/24",
|
||||
"::1"
|
||||
],
|
||||
"block": [
|
||||
"10.0.0.0/8",
|
||||
"192.168.1.0/24"
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue