Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultMinuteLimit = 1 DefaultDailyLimit = 100 DefaultStoreSize = 100 )
Variables ¶
This section is empty.
Functions ¶
func RandomCode ¶
Types ¶
type Config ¶
type Config struct {
CodeLength int `json:"code_length"`
CodeExpiresIn int `json:"code_expires_in"`
RateLimit *VerificationConfig `json:"rate_limit"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) Identifier ¶
type VerificationCode ¶
type VerificationConfig ¶
type VerificationStorage ¶
type VerificationStorage struct {
Store map[string][]VerificationCode `json:"store"`
MinuteCounts map[string]int `json:"minute_counts"`
DailyCounts map[string]int `json:"daily_counts"`
MinuteTimestamps map[string]time.Time `json:"minute_timestamps"`
DailyTimestamps map[string]time.Time `json:"daily_timestamps"`
}
type VerificationSystem ¶
type VerificationSystem struct {
// contains filtered or unexported fields
}
func NewVerificationSystem ¶
func NewVerificationSystem(config *VerificationConfig) *VerificationSystem
func (*VerificationSystem) CleanExpired ¶
func (s *VerificationSystem) CleanExpired()
func (*VerificationSystem) GetCaptchaCount ¶
func (s *VerificationSystem) GetCaptchaCount(number string) int
func (*VerificationSystem) Verify ¶
func (s *VerificationSystem) Verify(number, code string) bool
Click to show internal directories.
Click to hide internal directories.