hsic

package
v0.22.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigEnv added in v0.18.0

func DefaultConfigEnv() map[string]string

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 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) ListMachinesInUser added in v0.19.0

func (t *HeadscaleInContainer) ListMachinesInUser(
	user string,
) ([]*v1.Machine, error)

ListMachinesInUser list the TailscaleClients (Machine, Headscale internal representation) associated with a user.

func (*HeadscaleInContainer) SaveLog added in v0.20.0

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) 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() 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.

func (*HeadscaleInContainer) WriteFile

func (t *HeadscaleInContainer) WriteFile(path string, data []byte) error

WriteFile save file inside the Headscale container.

type Option

type Option = func(c *HeadscaleInContainer)

Option represent optional settings that can be given to a Headscale instance.

func WithACLPolicy

func WithACLPolicy(acl *hscontrol.ACLPolicy) Option

WithACLPolicy adds a hscontrol.ACLPolicy policy to the HeadscaleInContainer instance.

func WithConfigEnv

func WithConfigEnv(configEnv map[string]string) Option

WithConfigEnv takes a map of environment variables that can be used to override Headscale configuration.

func WithExtraPorts added in v0.22.2

func WithExtraPorts(ports []string) Option

WithExtraPorts exposes additional ports on the container (e.g. 3478/udp for STUN).

func WithFileInContainer added in v0.18.0

func WithFileInContainer(path string, contents []byte) Option

WithFileInContainer adds a file to the container at the given path.

func WithHostPortBindings added in v0.22.2

func WithHostPortBindings(bindings map[string][]string) Option

func WithHostnameAsServerURL

func WithHostnameAsServerURL() Option

WithHostnameAsServerURL sets the Headscale ServerURL based on the Hostname.

func WithPort

func WithPort(port int) Option

WithPort sets the port on where to run Headscale.

func WithTLS

func WithTLS() Option

WithTLS creates certificates and enables HTTPS.

func WithTestName

func WithTestName(testName string) Option

WithTestName sets a name for the test, this will be reflected in the Docker container name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL