connections

package
v0.0.0-...-6f38258 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthType

type AuthType int

Enum type for Auth Type

const (
	OAUTH AuthType = iota
	AUTHKEY
	NONE
)

Enum definition for Auth Type

type Option

type Option func(tn *Tailnet) error

Option function to set different options on the tailnet config

type TLSConfig

type TLSConfig struct {
	TLSKey  string `yaml:"key"`
	TLSCert string `yaml:"cert"`
}

type Tailnet

type Tailnet struct {
	ConfigDir      string
	ClientID       string
	ClientSecret   string
	AuthKey        string
	Hostname       string
	Addr           string
	Port           string
	TLSConfig      TLSConfig
	Scopes         []string
	Tags           []string
	Client         *tailscale.Client
	TSServer       *tsnet.Server
	GRPCServer     *grpc.Server
	Listener       net.Listener
	TailnetLogging bool
	// contains filtered or unexported fields
}

Tailnet main struct to hold connection to the tailnet information

func (*Tailnet) Connect

func (tn *Tailnet) Connect(ctx context.Context, opts ...Option) error

connect to the tailnet using oauth credentials

func (*Tailnet) DialContext

func (tn *Tailnet) DialContext(ctx context.Context, addr string, certs *TLSConfig) (*grpc.ClientConn, error)

func (*Tailnet) GetDevices

func (tn *Tailnet) GetDevices(ctx context.Context) ([]tailscale.Device, error)

GetDevices returns a list of devices that are connected to the configured tailnet

func (*Tailnet) WithAuthKey

func (tn *Tailnet) WithAuthKey(key string) Option

WithAPIKey sets the Option to connect to the tailnet with a preconfigured Auth key

func (*Tailnet) WithConfigDir

func (tn *Tailnet) WithConfigDir(dir string) Option

func (*Tailnet) WithHostname

func (tn *Tailnet) WithHostname(hostname string) Option

WithHostname Override the hostname on the tailnet

func (*Tailnet) WithOauth

func (tn *Tailnet) WithOauth(clientId, clientSecret string) Option

WithOauth sets up the tailnet connection using an oauth credential

func (*Tailnet) WithPort

func (tn *Tailnet) WithPort(port string) Option

WithPort Port to bind the grpc server to

func (*Tailnet) WithScopes

func (tn *Tailnet) WithScopes(scopes ...string) Option

WithScopes sets the Oauth scopes to configure for the connection

func (*Tailnet) WithTags

func (tn *Tailnet) WithTags(tags ...string) Option

WithTags sets the tags that were configured with the oauth connection

func (*Tailnet) WithTailnetLogging

func (tn *Tailnet) WithTailnetLogging(enabled bool) Option

WithTailnetLogging Enable/Disable logging on the tailnet

Jump to

Keyboard shortcuts

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