relay

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureFrpc

func EnsureFrpc() (string, error)

EnsureFrpc 确保 frpc 已安装,未安装则自动下载

func EnsureFrps

func EnsureFrps() (string, error)

EnsureFrps 确保 frps 已安装,未安装则自动下载

func FrpcConfigPath

func FrpcConfigPath() string

FrpcConfigPath 返回 frpc.toml 路径

func FrpcPath

func FrpcPath() string

FrpcPath 返回 frpc 二进制路径

func FrpsConfigPath

func FrpsConfigPath() string

FrpsConfigPath 返回 frps.toml 路径

func FrpsPath

func FrpsPath() string

FrpsPath 返回 frps 二进制路径

func GenerateFrpcConfig

func GenerateFrpcConfig(relay *config.RelayConfig) error

GenerateFrpcConfig 从 config.yml 的 relay 配置生成 frpc.toml

func GenerateFrpsConfig

func GenerateFrpsConfig(bindPort int, token string) error

GenerateFrpsConfig 生成服务端 frps.toml

func LogFilePath

func LogFilePath() string

LogFilePath 返回中继模式日志路径

func PID

func PID() int

PID 返回当前运行的 PID

func Running

func Running() bool

Running 检查 frpc 是否在运行

func Start

func Start() error

Start 启动 frpc(后台模式)

func StartQuick

func StartQuick(port, proto string) error

StartQuick 前台运行 frpc(quick --relay 模式,Ctrl+C 退出)

func Stop

func Stop() error

Stop 停止 frpc

Types

type CheckResult added in v0.7.1

type CheckResult struct {
	Server        string            `json:"server"`
	ServerOK      bool              `json:"server_ok"`
	ServerLatency int64             `json:"server_latency_ms"`
	FrpcRunning   bool              `json:"frpc_running"`
	FrpcPID       int               `json:"frpc_pid"`
	Rules         []RuleCheckResult `json:"rules"`
	Total         int               `json:"total"`
	Passed        int               `json:"passed"`
	Failed        int               `json:"failed"`
}

CheckResult 链路检测总结果

func Check added in v0.7.1

func Check(cfg *config.RelayConfig, ruleName string) CheckResult

Check 执行链路检测

type RuleCheckResult added in v0.7.1

type RuleCheckResult struct {
	Name       string `json:"name"`
	Proto      string `json:"proto"`
	LocalPort  int    `json:"local_port"`
	RemotePort int    `json:"remote_port"`
	LocalOK    bool   `json:"local_ok"`
	RemoteOK   bool   `json:"remote_ok"`
	LatencyMS  int64  `json:"latency_ms"`
	LocalErr   string `json:"local_err,omitempty"`
	RemoteErr  string `json:"remote_err,omitempty"`
}

RuleCheckResult 单条规则检测结果

Jump to

Keyboard shortcuts

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