Documentation ¶
Index ¶
- func DefaultConfigEnv() map[string]string
- func DefaultConfigYAML() string
- func MinimumConfigYAML() string
- type HeadscaleInContainer
- func (t *HeadscaleInContainer) ConnectToNetwork(network *dockertest.Network) error
- func (t *HeadscaleInContainer) CreateACLPolicy(user string, policy string) error
- func (t *HeadscaleInContainer) CreateAuthKey(user string, reusable bool, ephemeral bool, tags []string) (*v1.PreAuthKey, error)
- func (t *HeadscaleInContainer) CreateUser(user string) error
- func (t *HeadscaleInContainer) Execute(command []string) (string, error)
- func (t *HeadscaleInContainer) GetCert() []byte
- func (t *HeadscaleInContainer) GetEndpoint() string
- func (t *HeadscaleInContainer) GetHealthEndpoint() string
- func (t *HeadscaleInContainer) GetHostname() string
- func (t *HeadscaleInContainer) GetIP() string
- func (t *HeadscaleInContainer) GetPort() string
- func (t *HeadscaleInContainer) ListMachinesInUser(user string) ([]*v1.Machine, error)
- func (t *HeadscaleInContainer) SaveLog(path string) error
- func (t *HeadscaleInContainer) Shutdown() error
- func (t *HeadscaleInContainer) WaitForReady() error
- func (t *HeadscaleInContainer) WriteFile(path string, data []byte) error
- type Option
- func WithConfigEnv(configEnv map[string]string) Option
- func WithExtraPorts(ports []string) Option
- func WithFileInContainer(path string, contents []byte) Option
- func WithHostPortBindings(bindings map[string][]string) Option
- func WithHostnameAsServerURL() Option
- func WithPort(port int) Option
- func WithTLS() Option
- func WithTestName(testName string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigEnv ¶
func DefaultConfigYAML ¶
func DefaultConfigYAML() string
TODO: Reuse the actual configuration object above. Deprecated: use env function instead as it is easier to override.
func MinimumConfigYAML ¶
func MinimumConfigYAML() string
Types ¶
type HeadscaleInContainer ¶
type HeadscaleInContainer struct {
// contains filtered or unexported fields
}
HeadscaleInContainer is an implementation of ControlServer which sets up a Headscale instance inside a container.
func New ¶
func New( pool *dockertest.Pool, network *dockertest.Network, opts ...Option, ) (*HeadscaleInContainer, error)
New returns a new HeadscaleInContainer instance.
func (*HeadscaleInContainer) ConnectToNetwork ¶ added in v0.0.9
func (t *HeadscaleInContainer) ConnectToNetwork(network *dockertest.Network) error
func (*HeadscaleInContainer) CreateACLPolicy ¶ added in v0.0.9
func (t *HeadscaleInContainer) CreateACLPolicy( user string, policy string, ) error
CreateACLPolicy creates a new acl policy for a user.
func (*HeadscaleInContainer) CreateAuthKey ¶
func (t *HeadscaleInContainer) CreateAuthKey( user string, reusable bool, ephemeral bool, tags []string, ) (*v1.PreAuthKey, error)
CreateAuthKey creates a new "authorisation key" for a User that can be used to authorise a TailscaleClient with the Headscale instance.
func (*HeadscaleInContainer) CreateUser ¶
func (t *HeadscaleInContainer) CreateUser( user string, ) error
CreateUser adds a new user to the Headscale instance.
func (*HeadscaleInContainer) Execute ¶
func (t *HeadscaleInContainer) Execute( command []string, ) (string, error)
Execute runs a command inside the Headscale container and returns the result of stdout as a string.
func (*HeadscaleInContainer) GetCert ¶
func (t *HeadscaleInContainer) GetCert() []byte
GetCert returns the public certificate of the HeadscaleInContainer.
func (*HeadscaleInContainer) GetEndpoint ¶
func (t *HeadscaleInContainer) GetEndpoint() string
GetEndpoint returns the Headscale endpoint for the HeadscaleInContainer.
func (*HeadscaleInContainer) GetHealthEndpoint ¶
func (t *HeadscaleInContainer) GetHealthEndpoint() string
GetHealthEndpoint returns a health endpoint for the HeadscaleInContainer instance.
func (*HeadscaleInContainer) GetHostname ¶
func (t *HeadscaleInContainer) GetHostname() string
GetHostname returns the hostname of the HeadscaleInContainer.
func (*HeadscaleInContainer) GetIP ¶
func (t *HeadscaleInContainer) GetIP() string
GetIP returns the docker container IP as a string.
func (*HeadscaleInContainer) GetPort ¶
func (t *HeadscaleInContainer) GetPort() string
GetPort returns the docker container port as a string.
func (*HeadscaleInContainer) ListMachinesInUser ¶
func (t *HeadscaleInContainer) ListMachinesInUser( user string, ) ([]*v1.Machine, error)
ListMachinesInUser list the TailscaleClients (Machine, Headscale internal representation) associated with a user.
func (*HeadscaleInContainer) SaveLog ¶
func (t *HeadscaleInContainer) SaveLog(path string) error
SaveLog saves the current stdout log of the container to a path on the host system.
func (*HeadscaleInContainer) Shutdown ¶
func (t *HeadscaleInContainer) Shutdown() error
Shutdown stops and cleans up the Headscale container.
func (*HeadscaleInContainer) WaitForReady ¶
func (t *HeadscaleInContainer) WaitForReady() error
WaitForReady blocks until the Headscale instance is ready to serve clients.
type Option ¶
type Option = func(c *HeadscaleInContainer)
Option represent optional settings that can be given to a Headscale instance.
func WithConfigEnv ¶
WithConfigEnv takes a map of environment variables that can be used to override Headscale configuration.
func WithExtraPorts ¶ added in v0.0.9
WithExtraPorts exposes additional ports on the container (e.g. 3478/udp for STUN).
func WithFileInContainer ¶
WithFileInContainer adds a file to the container at the given path.
func WithHostPortBindings ¶ added in v0.0.9
func WithHostnameAsServerURL ¶
func WithHostnameAsServerURL() Option
WithHostnameAsServerURL sets the Headscale ServerURL based on the Hostname.
func WithTestName ¶
WithTestName sets a name for the test, this will be reflected in the Docker container name.