Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/9ssi7/turnstile

The Cloudflare Turnstile Server Side Client for Golang
https://github.com/9ssi7/turnstile

cloudflare turnstile turnstile-authentication

Last synced: 3 months ago
JSON representation

The Cloudflare Turnstile Server Side Client for Golang

Awesome Lists containing this project

README

        

# 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](https://developers.cloudflare.com/turnstile/).

## Installation

```bash
go get github.com/9ssi7/turnstile
```

## Documentation

[![Go Reference](https://pkg.go.dev/badge/github.com/9ssi7/turnstile.svg)](https://pkg.go.dev/github.com/9ssi7/turnstile)

## Usage

```go
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](https://choosealicense.com/licenses/mit/)