Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type AliyunProvider ¶
type AliyunProvider struct {
// contains filtered or unexported fields
}
AliyunProvider 阿里云短信提供商
func NewAliyunProvider ¶
func NewAliyunProvider(config Config) *AliyunProvider
NewAliyunProvider 创建阿里云提供商
func (*AliyunProvider) SendBatch ¶
func (p *AliyunProvider) SendBatch(messages []*Message) error
SendBatch 批量发送
type Config ¶
type Config struct {
Provider string // 提供商: aliyun, tencent, twilio
AccessKey string
SecretKey string
SignName string // 签名
Region string // 区域
}
Config 短信配置
type Message ¶
type Message struct {
Phone string
TemplateID string
Params map[string]string
Content string // 纯文本内容(某些提供商支持)
}
Message 短信消息
type SMS ¶
type SMS struct {
// contains filtered or unexported fields
}
SMS 短信发送器
func (*SMS) SendVerificationCode ¶
SendVerificationCode 发送验证码
type TencentProvider ¶
type TencentProvider struct {
// contains filtered or unexported fields
}
TencentProvider 腾讯云短信提供商
func NewTencentProvider ¶
func NewTencentProvider(config Config) *TencentProvider
NewTencentProvider 创建腾讯云提供商
func (*TencentProvider) SendBatch ¶
func (p *TencentProvider) SendBatch(messages []*Message) error
SendBatch 批量发送
type TwilioProvider ¶
type TwilioProvider struct {
// contains filtered or unexported fields
}
TwilioProvider Twilio 短信提供商
func NewTwilioProvider ¶
func NewTwilioProvider(config Config) *TwilioProvider
NewTwilioProvider 创建 Twilio 提供商
func (*TwilioProvider) SendBatch ¶
func (p *TwilioProvider) SendBatch(messages []*Message) error
SendBatch 批量发送
type VerificationCodeCache ¶
type VerificationCodeCache struct {
// contains filtered or unexported fields
}
VerificationCodeCache 验证码缓存
func NewVerificationCodeCache ¶
func NewVerificationCodeCache() *VerificationCodeCache
NewVerificationCodeCache 创建验证码缓存
func (*VerificationCodeCache) Set ¶
func (c *VerificationCodeCache) Set(phone, code string, ttl time.Duration)
Set 设置验证码
func (*VerificationCodeCache) Verify ¶
func (c *VerificationCodeCache) Verify(phone, code string) error
Verify 验证验证码
Click to show internal directories.
Click to hide internal directories.