mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-18 21:47:27 +00:00
feat: 添加域名和ip过滤模式设置
This commit is contained in:
@@ -5,16 +5,20 @@ import "one-api/setting/config"
|
||||
type FetchSetting struct {
|
||||
EnableSSRFProtection bool `json:"enable_ssrf_protection"` // 是否启用SSRF防护
|
||||
AllowPrivateIp bool `json:"allow_private_ip"`
|
||||
WhitelistDomains []string `json:"whitelist_domains"` // domain format, e.g. example.com, *.example.com
|
||||
WhitelistIps []string `json:"whitelist_ips"` // CIDR format
|
||||
AllowedPorts []string `json:"allowed_ports"` // port range format, e.g. 80, 443, 8000-9000
|
||||
DomainFilterMode bool `json:"domain_filter_mode"` // 域名过滤模式,true: 白名单模式,false: 黑名单模式
|
||||
IpFilterMode bool `json:"ip_filter_mode"` // IP过滤模式,true: 白名单模式,false: 黑名单模式
|
||||
DomainList []string `json:"domain_list"` // domain format, e.g. example.com, *.example.com
|
||||
IpList []string `json:"ip_list"` // CIDR format
|
||||
AllowedPorts []string `json:"allowed_ports"` // port range format, e.g. 80, 443, 8000-9000
|
||||
}
|
||||
|
||||
var defaultFetchSetting = FetchSetting{
|
||||
EnableSSRFProtection: true, // 默认开启SSRF防护
|
||||
AllowPrivateIp: false,
|
||||
WhitelistDomains: []string{},
|
||||
WhitelistIps: []string{},
|
||||
DomainFilterMode: true,
|
||||
IpFilterMode: true,
|
||||
DomainList: []string{},
|
||||
IpList: []string{},
|
||||
AllowedPorts: []string{"80", "443", "8080", "8443"},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user