Documentation
¶
Index ¶
- Constants
- func DefaultConfigEnv() map[string]string
- func MinimumConfigYAML() string
- type HeadscaleInContainer
- func (t *HeadscaleInContainer) ConnectToNetwork(network *dockertest.Network) error
- func (t *HeadscaleInContainer) CreateAuthKey(user string, reusable bool, ephemeral bool) (*v1.PreAuthKey, error)
- func (t *HeadscaleInContainer) CreateUser(user string) error
- func (t *HeadscaleInContainer) Execute(command []string) (string, error)
- func (t *HeadscaleInContainer) FetchPath(path string) ([]byte, 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) ListNodes(users ...string) ([]*v1.Node, error)
- func (t *HeadscaleInContainer) ListUsers() ([]*v1.User, error)
- func (t *HeadscaleInContainer) SaveDatabase(savePath string) error
- func (t *HeadscaleInContainer) SaveLog(path string) (string, string, error)
- func (t *HeadscaleInContainer) SaveMapResponses(savePath string) error
- func (t *HeadscaleInContainer) SaveMetrics(savePath string) error
- func (t *HeadscaleInContainer) SaveProfile(savePath string) error
- func (t *HeadscaleInContainer) SendInterrupt() error
- func (t *HeadscaleInContainer) Shutdown() (string, string, error)
- func (t *HeadscaleInContainer) WaitForRunning() error
- func (t *HeadscaleInContainer) WriteFile(path string, data []byte) error
- func (t *HeadscaleInContainer) WriteLogs(stdout, stderr io.Writer) error
- type Option
- func WithACLPolicy(acl *policy.ACLPolicy) Option
- func WithCACert(cert []byte) Option
- func WithConfigEnv(configEnv map[string]string) Option
- func WithCustomTLS(cert, key []byte) Option
- func WithDERPConfig(derpMap tailcfg.DERPMap) Option
- func WithEmbeddedDERPServerOnly() Option
- func WithExtraPorts(ports []string) Option
- func WithFileInContainer(path string, contents []byte) Option
- func WithHostPortBindings(bindings map[string][]string) Option
- func WithHostname(hostname string) Option
- func WithIPAllocationStrategy(strategy types.IPAllocationStrategy) Option
- func WithPort(port int) Option
- func WithPostgres() Option
- func WithTLS() Option
- func WithTestName(testName string) Option
- func WithTimezone(timezone string) Option
- func WithTuning(batchTimeout time.Duration, mapSessionChanSize int) Option
Constants ¶
const (
IntegrationTestDockerFileName = "Dockerfile.integration"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigEnv ¶ added in v0.18.0
func MinimumConfigYAML ¶ added in v0.18.0
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.22.2
func (t *HeadscaleInContainer) ConnectToNetwork(network *dockertest.Network) error
func (*HeadscaleInContainer) CreateAuthKey ¶
func (t *HeadscaleInContainer) CreateAuthKey( user string, reusable bool, ephemeral bool, ) (*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 ¶ added in v0.19.0
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) FetchPath ¶ added in v0.22.2
func (t *HeadscaleInContainer) FetchPath(path string) ([]byte, error)
FetchPath gets a path from inside the Headscale container and returns a tar file as byte array.
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) ListNodes ¶
func (t *HeadscaleInContainer) ListNodes( users ...string, ) ([]*v1.Node, error)
ListNodes lists the currently registered Nodes in headscale. Optionally a list of usernames can be passed to get users for specific users.
func (*HeadscaleInContainer) ListUsers ¶
func (t *HeadscaleInContainer) ListUsers() ([]*v1.User, error)
ListUsers returns a list of users from Headscale.
func (*HeadscaleInContainer) SaveDatabase ¶ added in v0.23.0
func (t *HeadscaleInContainer) SaveDatabase(savePath string) error
func (*HeadscaleInContainer) SaveLog ¶ added in v0.20.0
func (t *HeadscaleInContainer) SaveLog(path string) (string, string, error)
SaveLog saves the current stdout log of the container to a path on the host system.
func (*HeadscaleInContainer) SaveMapResponses ¶ added in v0.23.0
func (t *HeadscaleInContainer) SaveMapResponses(savePath string) error
func (*HeadscaleInContainer) SaveMetrics ¶ added in v0.23.0
func (t *HeadscaleInContainer) SaveMetrics(savePath string) error
func (*HeadscaleInContainer) SaveProfile ¶ added in v0.22.2
func (t *HeadscaleInContainer) SaveProfile(savePath string) error
func (*HeadscaleInContainer) SendInterrupt ¶ added in v0.22.2
func (t *HeadscaleInContainer) SendInterrupt() error
func (*HeadscaleInContainer) Shutdown ¶
func (t *HeadscaleInContainer) Shutdown() (string, string, error)
Shutdown stops and cleans up the Headscale container.
func (*HeadscaleInContainer) WaitForRunning ¶ added in v0.23.0
func (t *HeadscaleInContainer) WaitForRunning() error
WaitForRunning 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 WithACLPolicy ¶
WithACLPolicy adds a hscontrol.ACLPolicy policy to the HeadscaleInContainer instance.
func WithCACert ¶ added in v0.24.0
WithCACert adds it to the trusted surtificate of the container.
func WithConfigEnv ¶
WithConfigEnv takes a map of environment variables that can be used to override Headscale configuration.
func WithCustomTLS ¶ added in v0.24.0
WithCustomTLS uses the given certificates for the Headscale instance.
func WithDERPConfig ¶ added in v0.24.0
WithDERPConfig configures Headscale use a custom DERP server only.
func WithEmbeddedDERPServerOnly ¶ added in v0.23.0
func WithEmbeddedDERPServerOnly() Option
WithEmbeddedDERPServerOnly configures Headscale to start and only use the embedded DERP server. It requires WithTLS and WithHostnameAsServerURL to be set.
func WithExtraPorts ¶ added in v0.22.2
WithExtraPorts exposes additional ports on the container (e.g. 3478/udp for STUN).
func WithFileInContainer ¶ added in v0.18.0
WithFileInContainer adds a file to the container at the given path.
func WithHostPortBindings ¶ added in v0.22.2
func WithHostname ¶ added in v0.24.0
WithHostname sets the hostname of the Headscale instance.
func WithIPAllocationStrategy ¶ added in v0.23.0
func WithIPAllocationStrategy(strategy types.IPAllocationStrategy) Option
WithIPAllocationStrategy sets the tests IP Allocation strategy.
func WithPostgres ¶ added in v0.23.0
func WithPostgres() Option
WithPostgres spins up a Postgres container and sets it as the main database.
func WithTestName ¶
WithTestName sets a name for the test, this will be reflected in the Docker container name.