Skip to content

cloudflare

import "github.com/iolave/go-proxmox/pkg/cloudflare"

The cloudflare package contains utilities that can be used to connect to services secured by cloudflare through pkg/http package.

type ServiceToken

type ServiceToken struct {
    ClientId     string // Client id created when creating a new cloudflare service.
    ClientSecret string // Client secret created when creating a new cloudflare service.
}

func NewServiceToken

func NewServiceToken(clientId, secret string) *ServiceToken

NewServiceToken generates a pointer to a ServiceToken struct with it's properties initialized.

func (*ServiceToken) Set

func (t *ServiceToken) Set(req *http.Request) error

Set adds the corresponding Cloudflare access client headers to the given request.

It returns an error only when nil is passed to the request parameter.