mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 10:42:52 +01:00
unexport rawLimiterConfig
This commit is contained in:
parent
4050b6571a
commit
42db1778ac
@ -30,9 +30,9 @@ type customLimit struct {
|
||||
}
|
||||
|
||||
// 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
|
||||
type RawLimiterConfig struct {
|
||||
type rawLimiterConfig struct {
|
||||
Limit bool
|
||||
MaxConcurrent int `yaml:"max-concurrent-connections"`
|
||||
|
||||
@ -50,7 +50,7 @@ type RawLimiterConfig struct {
|
||||
}
|
||||
|
||||
type LimiterConfig struct {
|
||||
RawLimiterConfig
|
||||
rawLimiterConfig
|
||||
|
||||
ipv4Mask net.IPMask
|
||||
ipv6Mask net.IPMask
|
||||
@ -59,7 +59,7 @@ type LimiterConfig struct {
|
||||
}
|
||||
|
||||
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 config.postprocess()
|
||||
|
@ -18,7 +18,7 @@ func easyParseIP(ipstr string) (result net.IP) {
|
||||
}
|
||||
|
||||
var baseConfig = LimiterConfig{
|
||||
RawLimiterConfig: RawLimiterConfig{
|
||||
rawLimiterConfig: rawLimiterConfig{
|
||||
Limit: true,
|
||||
MaxConcurrent: 4,
|
||||
|
||||
|
@ -66,7 +66,7 @@ func makeTestThrottler(v4len, v6len int) *Limiter {
|
||||
minute, _ := time.ParseDuration("1m")
|
||||
maxConnections := 3
|
||||
config := LimiterConfig{
|
||||
RawLimiterConfig: RawLimiterConfig{
|
||||
rawLimiterConfig: rawLimiterConfig{
|
||||
Limit: false,
|
||||
Throttle: true,
|
||||
CidrLenIPv4: v4len,
|
||||
|
Loading…
Reference in New Issue
Block a user