cfapi

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(apiToken, accountID string) *Client

func (*Client) API

func (c *Client) API() *cf.Client

func (*Client) AccountID

func (c *Client) AccountID() string

func (*Client) CreateCNAME

func (c *Client) CreateCNAME(ctx context.Context, zoneID, name, target string) (string, error)

CreateCNAME 创建 CNAME 记录指向隧道

func (*Client) CreateTunnel

func (c *Client) CreateTunnel(ctx context.Context, name string) (*shared.CloudflareTunnel, error)

CreateTunnel 创建 Cloudflare Tunnel

func (*Client) DeleteDNSRecord

func (c *Client) DeleteDNSRecord(ctx context.Context, zoneID, recordID string) error

DeleteDNSRecord 删除 DNS 记录

func (*Client) DeleteTunnel

func (c *Client) DeleteTunnel(ctx context.Context, tunnelID string) error

DeleteTunnel 删除隧道

func (*Client) FindDNSRecord added in v0.8.1

func (c *Client) FindDNSRecord(ctx context.Context, zoneID, name string) (string, error)

FindDNSRecord 查找指定域名的 DNS 记录

func (*Client) FindZoneByDomain

func (c *Client) FindZoneByDomain(ctx context.Context, domain string) (*zones.Zone, error)

FindZoneByDomain 根据域名查找 Zone

func (*Client) GetTunnelToken

func (c *Client) GetTunnelToken(ctx context.Context, tunnelID string) (string, error)

GetTunnelToken 获取隧道运行 Token

func (*Client) ListTunnels

func (c *Client) ListTunnels(ctx context.Context) ([]shared.CloudflareTunnel, error)

ListTunnels 列出所有隧道

func (*Client) ListZones

func (c *Client) ListZones(ctx context.Context) ([]zones.Zone, error)

ListZones 列出账户下所有域名

func (*Client) PushIngressConfig added in v0.4.1

func (c *Client) PushIngressConfig(ctx context.Context, tunnelID string, routes []IngressRule) error

PushIngressConfig 推送 ingress 配置到 Cloudflare 远端

func (*Client) UpdateCNAME added in v0.8.1

func (c *Client) UpdateCNAME(ctx context.Context, zoneID, recordID, name, target string) error

UpdateCNAME 更新 CNAME 记录

type IngressRule added in v0.4.1

type IngressRule struct {
	Hostname string
	Service  string
}

IngressRule ingress 路由规则

type ZoneInfo added in v0.4.1

type ZoneInfo struct {
	ID   string
	Name string
}

ZoneInfo 简化的 Zone 信息

Jump to

Keyboard shortcuts

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