Documentation
¶
Index ¶
- func SetBinaryManager(m interface{ ... })
- type BaseClient
- func (c *BaseClient) HTTPProxyAddr() string
- func (c *BaseClient) Logs() string
- func (c *BaseClient) Name() string
- func (c *BaseClient) ProxyAddr() string
- func (c *BaseClient) SetConfig(configPath string)
- func (c *BaseClient) SocksProxyAddr() string
- func (c *BaseClient) Status() ClientStatus
- func (c *BaseClient) Stop() error
- func (c *BaseClient) Type() ClientType
- type Client
- type ClientOption
- type ClientStatus
- type ClientType
- type Manager
- func (m *Manager) Add(name string, client Client) error
- func (m *Manager) Get(name string) (Client, error)
- func (m *Manager) HealthCheck(ctx context.Context) map[string]bool
- func (m *Manager) HealthyClients(ctx context.Context) []string
- func (m *Manager) List() []string
- func (m *Manager) Remove(name string) error
- func (m *Manager) RestartUnhealthy(ctx context.Context) error
- func (m *Manager) StartAll(ctx context.Context) error
- func (m *Manager) Status() map[string]ClientStatus
- func (m *Manager) StopAll() error
- func (m *Manager) UnhealthyClients(ctx context.Context) []string
- func (m *Manager) Watch(ctx context.Context, interval time.Duration, ...)
- type MihomoClient
- func (c *MihomoClient) DelayTest(ctx context.Context, proxyName string) (int, error)
- func (c *MihomoClient) GetProxies(ctx context.Context) (map[string]any, error)
- func (c *MihomoClient) IsHealthy(ctx context.Context) bool
- func (c *MihomoClient) Restart(ctx context.Context) error
- func (c *MihomoClient) SelectProxy(ctx context.Context, group, proxy string) error
- func (c *MihomoClient) Start(ctx context.Context) error
- type XrayClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetBinaryManager ¶
SetBinaryManager 设置二进制管理器
Types ¶
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
BaseClient 基础客户端实现
func NewBaseClient ¶
func NewBaseClient(clientType ClientType, opts ...ClientOption) *BaseClient
NewBaseClient 创建基础客户端
func (*BaseClient) HTTPProxyAddr ¶
func (c *BaseClient) HTTPProxyAddr() string
HTTPProxyAddr 返回 HTTP 代理地址
func (*BaseClient) ProxyAddr ¶
func (c *BaseClient) ProxyAddr() string
ProxyAddr 返回代理地址(优先使用 mixed port)
func (*BaseClient) SocksProxyAddr ¶
func (c *BaseClient) SocksProxyAddr() string
SocksProxyAddr 返回 SOCKS 代理地址
type Client ¶
type Client interface {
// Name 返回客户端名称
Name() string
// Type 返回客户端类型
Type() ClientType
// Start 启动客户端
Start(ctx context.Context) error
// Stop 停止客户端
Stop() error
// Restart 重启客户端
Restart(ctx context.Context) error
// Status 获取客户端状态
Status() ClientStatus
// IsHealthy 检查客户端是否健康
IsHealthy(ctx context.Context) bool
// ProxyAddr 返回代理地址
ProxyAddr() string
// HTTPProxyAddr 返回 HTTP 代理地址
HTTPProxyAddr() string
// SocksProxyAddr 返回 SOCKS 代理地址
SocksProxyAddr() string
// Logs 返回日志
Logs() string
// SetConfig 设置配置文件路径
SetConfig(configPath string)
}
Client 客户端接口
type ClientStatus ¶
type ClientStatus string
ClientStatus 客户端状态
const ( StatusStopped ClientStatus = "stopped" StatusStarting ClientStatus = "starting" StatusRunning ClientStatus = "running" StatusError ClientStatus = "error" )
type ClientType ¶
type ClientType string
ClientType 客户端类型
const ( ClientXray ClientType = "xray" ClientMihomo ClientType = "mihomo" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 客户端管理器
func (*Manager) HealthCheck ¶
HealthCheck 对所有客户端进行健康检查
func (*Manager) HealthyClients ¶
HealthyClients 返回健康的客户端列表
func (*Manager) RestartUnhealthy ¶
RestartUnhealthy 重启不健康的客户端
func (*Manager) UnhealthyClients ¶
UnhealthyClients 返回不健康的客户端列表
type MihomoClient ¶
type MihomoClient struct {
*BaseClient
// contains filtered or unexported fields
}
MihomoClient Mihomo (Clash.Meta) 客户端
func NewMihomoClient ¶
func NewMihomoClient(opts ...ClientOption) *MihomoClient
NewMihomoClient 创建 Mihomo 客户端
func (*MihomoClient) GetProxies ¶
GetProxies 获取代理列表 (Mihomo 特有)
func (*MihomoClient) IsHealthy ¶
func (c *MihomoClient) IsHealthy(ctx context.Context) bool
IsHealthy 检查客户端是否健康
func (*MihomoClient) Restart ¶
func (c *MihomoClient) Restart(ctx context.Context) error
Restart 重启客户端
func (*MihomoClient) SelectProxy ¶
func (c *MihomoClient) SelectProxy(ctx context.Context, group, proxy string) error
SelectProxy 选择代理 (Mihomo 特有)
type XrayClient ¶
type XrayClient struct {
*BaseClient
}
XrayClient Xray 客户端
Click to show internal directories.
Click to hide internal directories.