Documentation
¶
Index ¶
- type Client
- func (c Client) ActiveNodes() (active []string, err error)
- func (c Client) Advertize(uuid string) error
- func (c Client) AdvertizingNodes() (active []string, err error)
- func (c Client) Clean() error
- func (c Client) Get(args ...string) (string, error)
- func (c Client) ListItems(serviceID, suffix string) (strs []string, err error)
- func (c Client) Set(thing, uuid, value string) error
- type Node
- type Option
- func WithAPIAddress(s string) Option
- func WithAssets(assets ...string) Option
- func WithClient(e *Client) Option
- func WithDefaultRoles(roles string) Option
- func WithFS(fs embed.FS) Option
- func WithLogger(l log.StandardLogger) Option
- func WithMinNodes(i int) Option
- func WithNetworkToken(token string) Option
- func WithPersistentRoles(roles string) Option
- func WithRoles(k ...RoleKey) Option
- func WithStateDir(s string) Option
- func WithStopRoles(roles string) Option
- func WithTokenfile(s string) Option
- func WithUUID(s string) Option
- type ProcessController
- type Role
- type RoleConfig
- type RoleKey
- type RoleOption
- func WithRole(f map[Role]func(c *RoleConfig) error) RoleOption
- func WithRoleAPIAddress(s string) RoleOption
- func WithRoleClient(e *Client) RoleOption
- func WithRoleLogger(l log.StandardLogger) RoleOption
- func WithRoleServiceID(s string) RoleOption
- func WithRoleStateDir(s string) RoleOption
- func WithRoleToken(s string) RoleOption
- func WithRoleUUID(u string) RoleOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*edgeVPNClient.Client
// contains filtered or unexported fields
}
Client 是 edgeVPN 客户端的封装 包含额外的元数据和语法糖
func NewClient ¶
func NewClient(serviceID string, c *edgeVPNClient.Client) *Client
NewClient 返回一个与指定服务 ID 关联的新客户端
func (Client) ActiveNodes ¶
ActiveNodes 返回活跃节点列表
func (Client) AdvertizingNodes ¶
AdvertizingNodes 返回正在广播的节点列表
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node 是服务节点。 它有一组定义的可用角色,网络中的节点可以承担这些角色。 它接受网络令牌或生成一个
type Option ¶
Option 是节点选项
func WithAssets ¶
WithAssets 是要复制到临时状态目录的资产列表 它与 WithFS 一起使用以简化二进制嵌入
func WithDefaultRoles ¶
WithDefaultRoles 允许为节点设置逗号分隔的默认角色列表。 注意,设置此选项后,节点将拒绝任何分配的角色
func WithNetworkToken ¶
WithNetworkToken 允许设置网络令牌。 如果未设置,则会自动生成
func WithPersistentRoles ¶
WithPersistentRoles 允许设置持久应用的逗号分隔角色列表
func WithStateDir ¶
WithStateDir 设置节点状态目录。 它将包含解压的资产(如果有)和 角色生成的进程状态。
func WithTokenfile ¶
WithTokenfile 设置令牌文件。 如果找不到令牌文件和网络令牌,则会写入该文件
type ProcessController ¶
type ProcessController struct {
// contains filtered or unexported fields
}
ProcessController go-processmanager 的语法糖封装
func NewProcessController ¶
func NewProcessController(statedir string) *ProcessController
NewProcessController 返回一个与状态目录关联的新进程控制器
func (*ProcessController) BinaryPath ¶
func (a *ProcessController) BinaryPath(b string) string
BinaryPath 返回请求的程序二进制路径。 二进制路径相对于进程状态目录
type RoleConfig ¶
type RoleConfig struct {
Client *Client
UUID, ServiceID, StateDir, APIAddress, NetworkToken string
Logger log.StandardLogger
// contains filtered or unexported fields
}
RoleConfig 是角色配置结构,包含角色可以使用的所有对象
type RoleKey ¶
type RoleKey struct {
RoleHandler func(c *RoleConfig) error
Role Role
}
RoleKey 是角色(字符串)和处理程序之间的关联 处理程序实际完成角色功能
type RoleOption ¶
type RoleOption func(c *RoleConfig)
RoleOption 是角色选项
func WithRoleAPIAddress ¶
func WithRoleAPIAddress(s string) RoleOption
WithRoleAPIAddress 设置执行期间使用的 API 地址
func WithRoleLogger ¶
func WithRoleLogger(l log.StandardLogger) RoleOption
WithRoleLogger 为角色操作设置日志记录器