Skip to content

go-the-way/cpt

Repository files navigation

cpt

A simple slider captcha implementation in Go

Features

  • Gzip compression embedded

Functions

  • SetTokenExpiration Set token expiration
  • SetTokenClearJobExecTick Set token clear job ticker durtion
  • SetTokenDeviation Set token deviation in px
  • SetTokenLength Set token generate length
  • SetResLoaderDefaultOpts Set default res loader opts
  • Generate Generate the image token in base64
  • Verify Verify the image token & xs
  • Delete Delete the image token
  • WrappedGenerateHandlerFunc Get the wrapped generate handler func
  • WrappedVerifyHandlerFunc Get the wrapped verify handler func
  • Serve Serve embedded http server
  • ServeRoute Serve embedded http server with custom routers

Embedded Routers

  • GET: /cpt/generate The Generate function called

response

{
    "bg_image_base_64": "data:image/png;base64,i",
    "bc_image_base_64": "data:image/png;base64,i",
    "token": "E4kAu5A2gjoXY7CfCw"
}
  • GET: /cpt/generate?html The Generate function called, rendering html

  • GET: /cpt/verify The Verify function called

query parameters

?token=
?x=

response error

{"err":"captcha_err"}

response verified

{"verified":"ok"}

TODO

  • resloader_file Load resources from local file system
  • resloader_uri Load resources from url address

About

A simple slider captcha implemention in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages