1
0
Fork 0
forked from External/ergo

track channel registrations per account

* limit the total number of registrations per account
* when an account is unregistered, unregister all its channels
This commit is contained in:
Shivaram Lingamneni 2019-02-06 04:32:04 -05:00
parent 8eefe869d0
commit ff7bbc4a9c
7 changed files with 120 additions and 3 deletions

View file

@ -181,7 +181,8 @@ type NickReservationConfig struct {
// ChannelRegistrationConfig controls channel registration.
type ChannelRegistrationConfig struct {
Enabled bool
Enabled bool
MaxChannelsPerAccount int `yaml:"max-channels-per-account"`
}
// OperClassConfig defines a specific operator class.
@ -789,6 +790,10 @@ func LoadConfig(filename string) (config *Config, err error) {
config.Accounts.Registration.BcryptCost = passwd.DefaultCost
}
if config.Channels.Registration.MaxChannelsPerAccount == 0 {
config.Channels.Registration.MaxChannelsPerAccount = 10
}
// in the current implementation, we disable history by creating a history buffer
// with zero capacity. but the `enabled` config option MUST be respected regardless
// of this detail