blob: 2820fa452e471df54e57c8f8c16b6499e8495404 [file] [log] [blame]
package main
import (
"context"
"time"
"code.hackerspace.pl/hscloud/bgpwtf/cccampix/verifier/model"
"github.com/sethvargo/go-password/password"
)
type secretGen struct {
}
func newSecretGen() (processor, error) {
return &secretGen{}, nil
}
func (p *secretGen) Name() string {
return "SecretGen"
}
func (p *secretGen) NextRun(now time.Time, lastFailed bool) time.Time {
return now.Add(1 * time.Minute)
}
func gen() model.SessionConfig {
secret := password.MustGenerate(16, 4, 0, false, true)
return model.SessionConfig{
BGPSecret: secret,
}
}
func (p *secretGen) RunAll(ctx context.Context, m model.Model) error {
return m.ConfigureMissingSessions(ctx, gen)
}