Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSendTooFreq = status.Error(codes.ResourceExhausted, "send.code.freq.limit") ErrVerifyCodeRetryLimit = status.Error(codes.ResourceExhausted, "verify.code.retry.limit") ErrSendCountLimit = status.Error(codes.ResourceExhausted, "send.code.count.limit") ErrVerifyCodeNotExist = status.Error(codes.NotFound, "verify.code.not.exist") ErrVerifyCodeTimeout = status.Error(codes.DeadlineExceeded, "verify.code.timeout") ErrVerifyCodeNotMatch = status.Error(codes.Unauthenticated, "verify.code.not.match") ErrVerifyCodeHashNotMatch = status.Error(codes.FailedPrecondition, "verify.hash.code.not.match") )
Functions ¶
This section is empty.
Types ¶
type CacheModule ¶ added in v0.6.4
type CacheModule interface {
Get(key interface{}) (v interface{}, ok bool)
Peek(key interface{}) (v interface{}, ok bool)
Set(key interface{}, value interface{})
}
func NewSimpleCache ¶
func NewSimpleCache(c int64) CacheModule
type Config ¶
type Config struct {
// LRU cache size.
CacheSize int64 `json:"cache_size" toml:"cache_size"`
// Mock mode, the verification code is the last `CodeLen` digits of the mobile phone.
Mock bool `json:"mock" toml:"mock"`
// Random code length.
CodeLen int `json:"code_len" toml:"code_len"`
// Code TTL.
TTL tex.JsDuration `json:"ttl" toml:"ttl"`
// Minimum interval for sending captcha.
MinInterval tex.JsDuration `json:"min_interval" toml:"min_interval"`
// Captcha count cycle.
CounterDuration tex.JsDuration `json:"counter_duration" toml:"counter_duration"`
// Verification code count upper limit.
MaxCount int `json:"max_count" toml:"max_count"`
// Upper limit of verification times of captcha.
MaxVerifyCount int `json:"max_verify_count" toml:"max_verify_count"`
}
Click to show internal directories.
Click to hide internal directories.