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 is a wrapper of an edgeVPN client with additional metadata and syntax sugar
func NewClient ¶
func NewClient(serviceID string, c *edgeVPNClient.Client) *Client
NewClient returns a new client with an associated service ID
func (Client) ActiveNodes ¶
ActiveNodes returns a list of active nodes
func (Client) AdvertizingNodes ¶ added in v0.9.3
AdvertizingNodes returns a list of advertizing nodes
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the service Node. It have a set of defined available roles which nodes in a network can take. It takes a network token or either generates one
func NewNode ¶
NewNode returns a new service Node The service Node can have role applied which are polled by the API. This allows to bootstrap services using the API to coordinate nodes and apply roles afterwards (e.g. start vpn with a dynamically received IP, etc. )
type Option ¶
Option is a Node option
func WithAPIAddress ¶
WithAPIAddress sets the EdgeVPN API address
func WithAssets ¶
WithAssets is a list of assets to copy to a temporary state dir from the embedded FS It is used in conjunction with WithFS to ease out binary embedding
func WithDefaultRoles ¶
WithDefaultRoles allows to set a list of comma separated roles prefixed for the node. Note, by setting this the node will refuse any assigned role
func WithLogger ¶
func WithLogger(l log.StandardLogger) Option
WithLogger defines a logger to be used across the whole execution
func WithMinNodes ¶ added in v0.19.2
func WithNetworkToken ¶
WithNetworkToken allows to set a network token. If not set, it is automatically generated
func WithPersistentRoles ¶
WithPersistentRoles allows to set a list of comma separated roles that can is applied persistently
func WithStateDir ¶
WithStateDir sets the node state directory. It will contain the unpacked assets (if any) and the process states generated by the roles.
func WithStopRoles ¶
WithStopRoles allows to set a list of comma separated roles that can be applied during cleanup
func WithTokenfile ¶
WithTokenfile sets a token file. If a token file and a network token is not found it is written to such file
type ProcessController ¶
type ProcessController struct {
// contains filtered or unexported fields
}
ProcessController syntax sugar around go-processmanager
func NewProcessController ¶
func NewProcessController(statedir string) *ProcessController
NewProcessController returns a new process controller associated with the state directory
func (*ProcessController) BinaryPath ¶
func (a *ProcessController) BinaryPath(b string) string
BinaryPath returns the binary path of the program requested as argument. The binary path is relative to the process state directory
type Role ¶
type Role string
Role is a service role. It is identified by a unique string which is sent over the wire and streamed to/from the clients. Roles can be applied either directly, or assigned within roles in the API
func (Role) Apply ¶
func (rr Role) Apply(opts ...RoleOption)
Apply applies a role and takes a list of options
type RoleConfig ¶
type RoleConfig struct { Client *Client UUID, ServiceID, StateDir, APIAddress, NetworkToken string Logger log.StandardLogger // contains filtered or unexported fields }
RoleConfig is the role config structure, which holds all the objects that can be used by a Role
type RoleKey ¶
type RoleKey struct { RoleHandler func(c *RoleConfig) error Role Role }
RoleKey is an association between a Role(string) and a Handler which actually fullfills the role
type RoleOption ¶
type RoleOption func(c *RoleConfig)
RoleOption is a role option
func WithRole ¶
func WithRole(f map[Role]func(c *RoleConfig) error) RoleOption
WithRole sets the available roles
func WithRoleAPIAddress ¶
func WithRoleAPIAddress(s string) RoleOption
WithRoleAPIAddress sets the API Address used during the execution
func WithRoleClient ¶
func WithRoleClient(e *Client) RoleOption
WithRoleClient sets a client for a role
func WithRoleLogger ¶
func WithRoleLogger(l log.StandardLogger) RoleOption
WithRoleLogger sets a logger for the role action
func WithRoleServiceID ¶
func WithRoleServiceID(s string) RoleOption
WithRoleServiceID sets a role service ID
func WithRoleStateDir ¶
func WithRoleStateDir(s string) RoleOption
WithRoleStateDir sets the statedir for the role
func WithRoleToken ¶
func WithRoleToken(s string) RoleOption
WithRoleToken sets the network token which can be used by the role
func WithRoleUUID ¶
func WithRoleUUID(u string) RoleOption
WithRoleUUID sets the UUID which performs the role