tsn

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingTailnetAuthKey       = errors.New("missing tailnet preauth key")
	ErrMissingHostname             = errors.New("missing hostname")
	ErrInvalidServerConfigurations = errors.New("invalid server configurations")
	ErrUnknownServerMode           = errors.New("unknown server mode")
)
View Source
var (
	ErrInvalidAddress = errors.New("invalid address")
	ValidFunnelAddr   = []string{":443", ":8443", ":1000"}
)

Functions

func ListenerFromConfig

func ListenerFromConfig(cfg Config, addr string, opts ...ServerOption) (net.Listener, error)

func NewServer

func NewServer(options ...ServerOption) *tsnet.Server

Types

type Config

type Config struct {
	// Required, the authkey to join the tailnet
	AuthKey string `yaml:"authkey"`
	// The hostname to use on the tailnet
	Hostname string `yaml:"hostname"`
	// The directory to store the state of the tailnet. If not specified, the default will be used.
	StateDir string `yaml:"state"`
	// The mode to start the server, can be standard, tls or funnel. Defaults to standard.
	ModeStr string `yaml:"mode"`

	// ControlUrl is the URL of the control server to use. Specify this if you are using Headscale. If not specified, the default tailscale address will be used.
	ControlUrl string `yaml:"controlUrl"`
	// contains filtered or unexported fields
}

func (*Config) Mode

func (c *Config) Mode() ServerMode

func (*Config) Validate

func (c *Config) Validate() error

type ServerMode

type ServerMode int8
const (
	ServerModeFunnel ServerMode = iota
	ServerModeTls
	SeverModeStandard
	ServerModeUnknown
)

func ServerModeFromString

func ServerModeFromString(s string) (ServerMode, error)

func (ServerMode) String

func (s ServerMode) String() string

type ServerOption

type ServerOption func(*tsnet.Server)

func WithAuthKey

func WithAuthKey(authKey string) ServerOption

func WithControlURL

func WithControlURL(controlURL string) ServerOption

func WithHostname

func WithHostname(hostname string) ServerOption

func WithLogFunc

func WithLogFunc(logFunc func(format string, args ...interface{})) ServerOption

func WithRunWebClient

func WithRunWebClient(runWebClient bool) ServerOption

func WithStandardLoggingFunc

func WithStandardLoggingFunc(lvl zerolog.Level) ServerOption

func WithStateDir

func WithStateDir(stateDir string) ServerOption

Jump to

Keyboard shortcuts

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