cloudflare

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLogin

func CheckLogin() error

CheckLogin verifies that cloudflared has a valid certificate on disk.

func CleanupExposedTunnels

func CleanupExposedTunnels(devName string) (int, error)

CleanupExposedTunnels forcefully deletes any tunnels tracking to this user's exposed dev environment. Returns the number of tunnels cleaned up and any error.

func CreateCNAME added in v0.17.0

func CreateCNAME(zoneID, recordName, target string, proxied bool) error

CreateCNAME creates or updates a CNAME record in the given zone.

func CreateTXT added in v0.17.1

func CreateTXT(zoneID, recordName, value string) error

CreateTXT creates or updates a TXT record in the given zone. Used for domain verification (e.g., GitHub Pages challenge records).

func GetToken

func GetToken(tunnelName string) (string, error)

GetToken returns the named-tunnel token for use with --token auth.

func LookupZoneID added in v0.17.0

func LookupZoneID(zoneName string) (string, error)

LookupZoneID finds the zone ID for a given domain. For "devx.vitruviansoftware.dev", this looks up "vitruviansoftware.dev".

func RouteDNS

func RouteDNS(tunnelName, domain string) error

RouteDNS idempotently creates a CNAME routing domain → tunnel. Failures are treated as non-fatal (DNS may already be routed).

func TunnelStatus

func TunnelStatus(name string) (string, error)

TunnelStatus returns a human-readable status string.

func WriteIngressConfig added in v0.2.2

func WriteIngressConfig(tunnelID, fullDomain, targetPort string) (string, error)

WriteIngressConfig generates a temporary cloudflare tunnel ingress configuration file on disk. This is required for named tunnels since --url is ignored by cloudflared run unless an ingress config explicitly permits the hostname.

func WriteMultiIngressConfig added in v0.2.4

func WriteMultiIngressConfig(tunnelID string, entries []IngressEntry) (string, error)

WriteMultiIngressConfig writes a configuration file with multiple routing destinations.

Types

type IngressEntry added in v0.2.4

type IngressEntry struct {
	Hostname   string
	TargetPort string
}

IngressEntry maps a domain to a port.

type Tunnel

type Tunnel struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	CreatedAt string `json:"created_at"`
}

Tunnel represents a Cloudflare tunnel entry from the API.

func EnsureTunnel

func EnsureTunnel(name string) (*Tunnel, error)

EnsureTunnel returns the existing tunnel by name or creates a new one.

func ListExposedTunnels

func ListExposedTunnels(devName string) ([]Tunnel, error)

ListExposedTunnels returns all active exposed tunnels for this environment.

Jump to

Keyboard shortcuts

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