Documentation ¶
Index ¶
- func LoadLocalImg(imgPath string) img.Img
- func NewDriverString(imgOptions ...img.Img) *img.Img
- func NewLocalStore() *store.LocalStore
- func NewRediStore(option RedisOptions) *store.RediStore
- type GGCaptcha
- func (g *GGCaptcha) GenerateDriverMath() (id, content string, err error)
- func (g *GGCaptcha) GenerateDriverMathString() (id, content string, err error)
- func (g *GGCaptcha) GenerateDriverPuzzle() (id, bgImage, puzzleImage string, err error)
- func (g *GGCaptcha) GenerateGGCaptcha() (id, content string, err error)
- func (g *GGCaptcha) RefreshCaptcha(ctype inter.CaptchaType) (id, content string, err error)
- func (g *GGCaptcha) VerifyGGCaptcha(id, answer string, clear bool) bool
- type ImgOptions
- type OAuthClient
- type OAuthProvider
- type RedisOptions
- type SMSClient
- type SMSProvider
- type SMTPClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadLocalImg ¶
func NewLocalStore ¶
func NewLocalStore() *store.LocalStore
func NewRediStore ¶
func NewRediStore(option RedisOptions) *store.RediStore
Types ¶
type GGCaptcha ¶
type GGCaptcha struct {
// contains filtered or unexported fields
}
func NewGGCaptcha ¶
func (*GGCaptcha) GenerateDriverMath ¶
func (*GGCaptcha) GenerateDriverMathString ¶
func (*GGCaptcha) GenerateDriverPuzzle ¶
func (*GGCaptcha) GenerateGGCaptcha ¶
func (*GGCaptcha) RefreshCaptcha ¶
func (g *GGCaptcha) RefreshCaptcha(ctype inter.CaptchaType) (id, content string, err error)
type ImgOptions ¶
type ImgOptions struct { Height int //图片高度 Width int //图片宽度 NoiseCount int //干扰线 Count int //验证码数量 Source string //数据源 SourceLength int //数据源长度 SizePoint float64 //字体大小 Bgcolor color.NRGBA //背景颜色 FontStyle font.Face //字体 UploadImg image.Image MathNum int //算术验证码数量 PuzzleX int // 滑动拼图的X位置 PuzzleY int // 滑动拼图的Y位置 PuzzleWidth int // 拼图块的宽度 PuzzleHeight int // 拼图块的高度 }
type OAuthClient ¶
type OAuthClient struct { Provider OAuthProvider ClientID string ClientSecret string RedirectURI string }
func NewOAuthClient ¶
func NewOAuthClient(provider OAuthProvider, clientID, clientSecret, redirectURI string) *OAuthClient
NewOAuthClient 初始化 OAuth 客户端
func (*OAuthClient) ExchangeCode ¶
func (client *OAuthClient) ExchangeCode(code string) (string, error)
ExchangeCode 交换授权码获取访问令牌
func (*OAuthClient) GetAuthURL ¶
func (client *OAuthClient) GetAuthURL(state string) string
GetAuthURL 获取 OAuth 授权 URL
type OAuthProvider ¶
type OAuthProvider string
const ( Google OAuthProvider = "google" GitHub OAuthProvider = "github" )
type RedisOptions ¶
type SMSClient ¶
type SMSClient struct { Provider SMSProvider APIKey string APISecret string SMSUrl string }
SMSClient 短信客户端结构体
func NewSMSClient ¶
func NewSMSClient(provider SMSProvider, apiKey, apiSecret, smsUrl string) *SMSClient
NewSMSClient 初始化 SMS 客户端
type SMSProvider ¶
type SMSProvider string
const ( ALI SMSProvider = "Ali" TENCENT SMSProvider = "Tencent" BAIDU SMSProvider = "Baidu" HUAXIN SMSProvider = "HuaXin" GETUI SMSProvider = "GeTui" )
type SMTPClient ¶
type SMTPClient struct { Dialer *gomail.Dialer From string }
func NewSMTPClient ¶
func NewSMTPClient(smtpHost string, smtpPort int, username, password string, from string) *SMTPClient
NewSMTPClient 初始化 SMTP 客户端
func (*SMTPClient) SendVerificationEmail ¶
func (client *SMTPClient) SendVerificationEmail(to, token, subject, content string) error
SendVerificationEmail 发送验证邮件
Click to show internal directories.
Click to hide internal directories.