daemon

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloudflaredPath

func CloudflaredPath() string

CloudflaredPath 返回 cloudflared 二进制路径

func EnsureCloudflared

func EnsureCloudflared() (string, error)

EnsureCloudflared 确保 cloudflared 已安装,未安装则自动下载

func PID

func PID() int

PID 返回当前运行的 PID

func Running

func Running() bool

Running 检查 cloudflared 是否在运行

func Start

func Start(token string) error

Start 启动 cloudflared(token 模式)

func StartQuick

func StartQuick(port string) error

StartQuick 启动免域名模式(前台运行,Ctrl+C 退出)

func StartQuickWithAuth added in v0.6.0

func StartQuickWithAuth(port, username, password string) error

StartQuickWithAuth 启动带鉴权代理的免域名模式

func Stop

func Stop() error

Stop 停止 cloudflared

Types

type APICheck added in v0.8.0

type APICheck struct {
	Reachable bool   `json:"reachable"`
	LatencyMS int64  `json:"latency_ms,omitempty"`
	Err       string `json:"err,omitempty"`
}

APICheck Cloudflare API 连通性

type CloudflaredCheck added in v0.8.0

type CloudflaredCheck struct {
	Installed bool   `json:"installed"`
	Path      string `json:"path,omitempty"`
	Version   string `json:"version,omitempty"`
	Running   bool   `json:"running"`
	PID       int    `json:"pid,omitempty"`
}

CloudflaredCheck cloudflared 二进制和进程检测

type DiagnoseResult added in v0.8.0

type DiagnoseResult struct {
	Cloudflared CloudflaredCheck `json:"cloudflared"`
	API         APICheck         `json:"api"`
	Routes      []RouteDiagnose  `json:"routes"`
	Total       int              `json:"total"`
	Passed      int              `json:"passed"`
	Failed      int              `json:"failed"`
}

DiagnoseResult 诊断总结果

func Diagnose added in v0.8.0

func Diagnose(routes []RouteInput) DiagnoseResult

Diagnose 执行 Cloud 模式链路诊断

type RouteDiagnose added in v0.8.0

type RouteDiagnose struct {
	Name     string `json:"name"`
	Hostname string `json:"hostname"`
	Service  string `json:"service"`
	LocalOK  bool   `json:"local_ok"`
	LocalErr string `json:"local_err,omitempty"`
	DNSOK    bool   `json:"dns_ok"`
	DNSErr   string `json:"dns_err,omitempty"`
	HTTPOK   bool   `json:"http_ok"`
	HTTPErr  string `json:"http_err,omitempty"`
}

RouteDiagnose 单条路由诊断

type RouteInput added in v0.8.0

type RouteInput struct {
	Name     string
	Hostname string
	Service  string
}

RouteInput 诊断输入

Jump to

Keyboard shortcuts

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