Skip to content

9ssi7/turnstile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Cloudflare Turnstile Go Server Side Client

Turnstile is a service that allows you to protect your web applications from abuse. It is a Cloudflare service that is currently in private beta. You can read more about it here.

Installation

go get github.com/9ssi7/turnstile

Documentation

Go Reference

Usage

package main

import (
    "context"
    "github.com/9ssi7/turnstile"
)

func main() {
    ctx := context.Background()
    srv := turnstile.New(turnstile.Config{
        Secret: "your-secret",
    })
    ok, err := srv.Verify(ctx, "your-token", "your-ip")
    if err != nil {
        panic(err)
    }
    if !ok {
        panic("token is not valid")
    }
    println("token is valid")
}

Contributing

Contributions are always welcome!

License

MIT

Packages

No packages published

Languages