cloudflare

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cloudflare is the small part of Cloudflare's API xtune uses: DNS records, the zone's SSL mode and Worker uploads, with an API token.

Index

Constants

This section is empty.

Variables

View Source
var API = "https://api.cloudflare.com/client/v4"

API is a variable so tests can point it at a local server.

Functions

func Call

func Call(token, method, path string, body, out any) error

Call sends body as JSON and decodes the result into out.

func Do

func Do(token, method, path, contentType string, rd io.Reader, out any) error

Do sends a request with a body of any type (the Worker upload is multipart).

func NS

func NS(token, zone, ns string) (string, error)

NS delegates zone to the name server ns with an NS record.

func Point

func Point(token, name, ip string, proxied bool) (string, error)

Point makes name's address record point at ip with the given proxying, replacing an A record with an AAAA one (or back) when the server's address family changes.

func SSL

func SSL(token, domain string, fix bool) (string, error)

SSL reads the SSL/TLS mode of domain's zone, and sets it to Full when fix is set and it is not.

func Verify

func Verify(token string) error

func Zone

func Zone(token, domain string) (string, error)

Zone finds the zone a domain belongs to.

Types

type J

type J = map[string]any

type Record

type Record struct {
	ID      string `json:"id,omitempty"`
	Type    string `json:"type"`
	Name    string `json:"name"`
	Content string `json:"content"`
	Proxied bool   `json:"proxied"`
	TTL     int    `json:"ttl,omitempty"`
}

Jump to

Keyboard shortcuts

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