3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

unexport rawLimiterConfig

This commit is contained in:
Shivaram Lingamneni 2019-11-18 17:30:54 -05:00
parent 4050b6571a
commit 42db1778ac
3 changed files with 6 additions and 6 deletions

View File

@ -30,9 +30,9 @@ type customLimit struct {
} }
// LimiterConfig controls the automated connection limits. // LimiterConfig controls the automated connection limits.
// RawLimiterConfig contains all the YAML-visible fields; // rawLimiterConfig contains all the YAML-visible fields;
// LimiterConfig contains additional denormalized private fields // LimiterConfig contains additional denormalized private fields
type RawLimiterConfig struct { type rawLimiterConfig struct {
Limit bool Limit bool
MaxConcurrent int `yaml:"max-concurrent-connections"` MaxConcurrent int `yaml:"max-concurrent-connections"`
@ -50,7 +50,7 @@ type RawLimiterConfig struct {
} }
type LimiterConfig struct { type LimiterConfig struct {
RawLimiterConfig rawLimiterConfig
ipv4Mask net.IPMask ipv4Mask net.IPMask
ipv6Mask net.IPMask ipv6Mask net.IPMask
@ -59,7 +59,7 @@ type LimiterConfig struct {
} }
func (config *LimiterConfig) UnmarshalYAML(unmarshal func(interface{}) error) (err error) { func (config *LimiterConfig) UnmarshalYAML(unmarshal func(interface{}) error) (err error) {
if err = unmarshal(&config.RawLimiterConfig); err != nil { if err = unmarshal(&config.rawLimiterConfig); err != nil {
return err return err
} }
return config.postprocess() return config.postprocess()

View File

@ -18,7 +18,7 @@ func easyParseIP(ipstr string) (result net.IP) {
} }
var baseConfig = LimiterConfig{ var baseConfig = LimiterConfig{
RawLimiterConfig: RawLimiterConfig{ rawLimiterConfig: rawLimiterConfig{
Limit: true, Limit: true,
MaxConcurrent: 4, MaxConcurrent: 4,

View File

@ -66,7 +66,7 @@ func makeTestThrottler(v4len, v6len int) *Limiter {
minute, _ := time.ParseDuration("1m") minute, _ := time.ParseDuration("1m")
maxConnections := 3 maxConnections := 3
config := LimiterConfig{ config := LimiterConfig{
RawLimiterConfig: RawLimiterConfig{ rawLimiterConfig: rawLimiterConfig{
Limit: false, Limit: false,
Throttle: true, Throttle: true,
CidrLenIPv4: v4len, CidrLenIPv4: v4len,