|
@@ -233,9 +233,9 @@ type AccountConfig struct {
|
233
|
233
|
// AccountRegistrationConfig controls account registration.
|
234
|
234
|
type AccountRegistrationConfig struct {
|
235
|
235
|
Enabled bool
|
236
|
|
- EnabledCallbacks []string `yaml:"enabled-callbacks"`
|
237
|
|
- EnabledCredentialTypes []string `yaml:"-"`
|
238
|
|
- VerifyTimeout time.Duration `yaml:"verify-timeout"`
|
|
236
|
+ EnabledCallbacks []string `yaml:"enabled-callbacks"`
|
|
237
|
+ EnabledCredentialTypes []string `yaml:"-"`
|
|
238
|
+ VerifyTimeout custime.Duration `yaml:"verify-timeout"`
|
239
|
239
|
Callbacks struct {
|
240
|
240
|
Mailto struct {
|
241
|
241
|
Server string
|
|
@@ -263,7 +263,7 @@ type VHostConfig struct {
|
263
|
263
|
UserRequests struct {
|
264
|
264
|
Enabled bool
|
265
|
265
|
Channel string
|
266
|
|
- Cooldown time.Duration
|
|
266
|
+ Cooldown custime.Duration
|
267
|
267
|
} `yaml:"user-requests"`
|
268
|
268
|
OfferList []string `yaml:"offer-list"`
|
269
|
269
|
}
|
|
@@ -406,18 +406,17 @@ type Limits struct {
|
406
|
406
|
|
407
|
407
|
// STSConfig controls the STS configuration/
|
408
|
408
|
type STSConfig struct {
|
409
|
|
- Enabled bool
|
410
|
|
- Duration time.Duration `yaml:"duration-real"`
|
411
|
|
- DurationString string `yaml:"duration"`
|
412
|
|
- Port int
|
413
|
|
- Preload bool
|
414
|
|
- STSOnlyBanner string `yaml:"sts-only-banner"`
|
415
|
|
- bannerLines []string
|
|
409
|
+ Enabled bool
|
|
410
|
+ Duration custime.Duration
|
|
411
|
+ Port int
|
|
412
|
+ Preload bool
|
|
413
|
+ STSOnlyBanner string `yaml:"sts-only-banner"`
|
|
414
|
+ bannerLines []string
|
416
|
415
|
}
|
417
|
416
|
|
418
|
417
|
// Value returns the STS value to advertise in CAP
|
419
|
418
|
func (sts *STSConfig) Value() string {
|
420
|
|
- val := fmt.Sprintf("duration=%d", int(sts.Duration.Seconds()))
|
|
419
|
+ val := fmt.Sprintf("duration=%d", int(time.Duration(sts.Duration).Seconds()))
|
421
|
420
|
if sts.Enabled && sts.Port > 0 {
|
422
|
421
|
val += fmt.Sprintf(",port=%d", sts.Port)
|
423
|
422
|
}
|
|
@@ -553,9 +552,9 @@ type Config struct {
|
553
|
552
|
ChathistoryMax int `yaml:"chathistory-maxmessages"`
|
554
|
553
|
ZNCMax int `yaml:"znc-maxmessages"`
|
555
|
554
|
Restrictions struct {
|
556
|
|
- ExpireTime time.Duration `yaml:"expire-time"`
|
557
|
|
- EnforceRegistrationDate bool `yaml:"enforce-registration-date"`
|
558
|
|
- GracePeriod time.Duration `yaml:"grace-period"`
|
|
555
|
+ ExpireTime custime.Duration `yaml:"expire-time"`
|
|
556
|
+ EnforceRegistrationDate bool `yaml:"enforce-registration-date"`
|
|
557
|
+ GracePeriod custime.Duration `yaml:"grace-period"`
|
559
|
558
|
}
|
560
|
559
|
Persistent struct {
|
561
|
560
|
Enabled bool
|
|
@@ -828,10 +827,6 @@ func LoadConfig(filename string) (config *Config, err error) {
|
828
|
827
|
}
|
829
|
828
|
|
830
|
829
|
if config.Server.STS.Enabled {
|
831
|
|
- config.Server.STS.Duration, err = custime.ParseDuration(config.Server.STS.DurationString)
|
832
|
|
- if err != nil {
|
833
|
|
- return nil, fmt.Errorf("Could not parse STS duration: %s", err.Error())
|
834
|
|
- }
|
835
|
830
|
if config.Server.STS.Port < 0 || config.Server.STS.Port > 65535 {
|
836
|
831
|
return nil, fmt.Errorf("STS port is incorrect, should be 0 if disabled: %d", config.Server.STS.Port)
|
837
|
832
|
}
|