Documentation
¶
Overview ¶
Package headscale wraps the Headscale v0.29 gRPC API with the narrow set of calls Headmesh needs.
Production cell agents dial Headscale's local unix socket, which Headscale trusts without an API key, so no all-powerful Headscale API key ever leaves the cell host. DialRemote exists only for the approval-gated fallback described in the plan (§9.4).
Index ¶
- type API
- type Client
- func (c *Client) CheckPolicy(ctx context.Context, hujson string) error
- func (c *Client) Close() error
- func (c *Client) CreatePreAuthKey(ctx context.Context, req PreAuthKeyRequest) (*headscalev1.PreAuthKey, error)
- func (c *Client) DeleteNode(ctx context.Context, nodeID uint64) error
- func (c *Client) ExpireNode(ctx context.Context, nodeID uint64, disableExpiry bool) (*headscalev1.Node, error)
- func (c *Client) GetPolicy(ctx context.Context) (string, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) ListNodes(ctx context.Context) ([]*headscalev1.Node, error)
- func (c *Client) RenameNode(ctx context.Context, nodeID uint64, name string) (*headscalev1.Node, error)
- func (c *Client) SetApprovedRoutes(ctx context.Context, nodeID uint64, routes []string) (*headscalev1.Node, error)
- func (c *Client) SetPolicy(ctx context.Context, hujson string) error
- func (c *Client) SetTags(ctx context.Context, nodeID uint64, tags []string) (*headscalev1.Node, error)
- type PreAuthKeyRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
ListNodes(ctx context.Context) ([]*headscalev1.Node, error)
CreatePreAuthKey(ctx context.Context, req PreAuthKeyRequest) (*headscalev1.PreAuthKey, error)
SetTags(ctx context.Context, nodeID uint64, tags []string) (*headscalev1.Node, error)
RenameNode(ctx context.Context, nodeID uint64, name string) (*headscalev1.Node, error)
DeleteNode(ctx context.Context, nodeID uint64) error
ExpireNode(ctx context.Context, nodeID uint64, disableExpiry bool) (*headscalev1.Node, error)
SetApprovedRoutes(ctx context.Context, nodeID uint64, routes []string) (*headscalev1.Node, error)
GetPolicy(ctx context.Context) (string, error)
SetPolicy(ctx context.Context, hujson string) error
CheckPolicy(ctx context.Context, hujson string) error
Health(ctx context.Context) error
}
API is the subset of Headscale used by Headmesh. Client implements it; tests use fakes.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Headscale gRPC client.
func DialRemote ¶
DialRemote connects to a remote Headscale gRPC endpoint over TLS with an API key. Headscale API keys have full admin rights; use only with Aaryn's approval, behind a firewall rule that admits only the Headmesh server.
func DialUnix ¶
DialUnix connects to Headscale's local unix socket (default /var/run/headscale/headscale.sock).
func (*Client) CreatePreAuthKey ¶
func (c *Client) CreatePreAuthKey(ctx context.Context, req PreAuthKeyRequest) (*headscalev1.PreAuthKey, error)