sdk

package
v1.0.68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IS_DEBUG             bool   = true // 调试开关,是否输出调试日志
	API_URL              string = "http://api.geetest.com"
	REGISTER_URL         string = "/register.php"
	VALIDATE_URL         string = "/validate.php"
	JSON_FORMAT          string = "1"
	NEW_CAPTCHA          bool   = true
	HTTP_TIMEOUT_DEFAULT int    = 5 // 单位:秒
	VERSION              string = "golang-gin:3.1.1"
	GEETEST_CHALLENGE    string = "geetest_challenge" // 极验二次验证表单传参字段 chllenge
	GEETEST_VALIDATE     string = "geetest_validate"  // 极验二次验证表单传参字段 validate
	GEETEST_SECCODE      string = "geetest_seccode"   // 极验二次验证表单传参字段 seccode
)

*

  • sdk lib包,核心逻辑。 *
  • @author liuquan@geetest.com

Variables

This section is empty.

Functions

This section is empty.

Types

type GeetestLib

type GeetestLib struct {
	// contains filtered or unexported fields
}

func NewGeetestLib

func NewGeetestLib(geetest_id, geetest_key string, debug bool) *GeetestLib

func (*GeetestLib) FailValidate

func (g *GeetestLib) FailValidate(challenge string, validate string, seccode string) *GeetestLibResult

*

  • 异常流程下(即验证初始化失败,宕机模式),二次验证
  • 注意:由于是宕机模式,初衷是保证验证业务不会中断正常业务,所以此处只作简单的参数校验,可自行设计逻辑。

func (*GeetestLib) LocalRegister

func (g *GeetestLib) LocalRegister() *GeetestLibResult

func (*GeetestLib) Register

func (g *GeetestLib) Register(digestmod string, params map[string]string) *GeetestLibResult

*

  • 验证初始化

func (*GeetestLib) SuccessValidate

func (g *GeetestLib) SuccessValidate(challenge string, validate string, seccode string) *GeetestLibResult

*

  • 正常流程下(即验证初始化成功),二次验证

type GeetestLibResult

type GeetestLibResult struct {
	Status int
	Data   string
	Msg    string
}

*

  • sdk lib包的返回结果信息。 *
  • @author liuquan@geetest.com

func NewGeetestLibResult

func NewGeetestLibResult() *GeetestLibResult

func (*GeetestLibResult) String

func (g *GeetestLibResult) String() string

type GeetestLibResultData

type GeetestLibResultData struct {
	Challenge  string `json:"challenge"`
	Gt         string `json:"gt"`
	NewCaptcha bool   `json:"new_captcha"`
	Success    int    `json:"success"`
	Status     int    `json:"status"` // 0.需要认证 1.跳过认证
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL