network

package
v0.0.0-...-299106d Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToHost

func ConnectToHost(ctx context.Context, host string, timeout time.Duration, tailscale *Tailscale, tsConfig types.TailscaleConfig) (net.Conn, error)

func GetDialer

func GetDialer(host string, tailscale *Tailscale, tsConfig types.TailscaleConfig) func(ctx context.Context, network, address string) (net.Conn, error)

func ResolveTailscaleService

func ResolveTailscaleService(serviceName string, timeout time.Duration) (string, error)

Types

type Tailscale

type Tailscale struct {
	// contains filtered or unexported fields
}

func GetOrCreateTailscale

func GetOrCreateTailscale(cfg TailscaleConfig, tailscaleRepo repository.TailscaleRepository) *Tailscale

GetOrCreateTailscale checks the registry for an existing server by name. If it exists, it returns that; otherwise, it creates and registers a new one.

func (*Tailscale) Close

func (t *Tailscale) Close() error

Stops the Tailscale server

func (*Tailscale) Dial

func (t *Tailscale) Dial(ctx context.Context, network, addr string) (net.Conn, error)

Dial attempts to establish a TCP connection to a tailscale service

func (*Tailscale) DialTimeout

func (t *Tailscale) DialTimeout(network, addr string, timeout time.Duration) (net.Conn, error)

DialTimeout attempts to establish a TCP connection to a tailscale service with the specified timeout duration

func (*Tailscale) GetHostnameForService

func (t *Tailscale) GetHostnameForService(serviceName string) (string, error)

GetHostnameForService retrieves a random, available hostname for a particular service These are served from the "proxy" service, which binds tsnet services to local ports

func (*Tailscale) GetServer

func (t *Tailscale) GetServer() *tsnet.Server

func (*Tailscale) ResolveService

func (t *Tailscale) ResolveService(serviceName string, timeout time.Duration) (string, error)

func (*Tailscale) Serve

func (t *Tailscale) Serve(ctx context.Context, service types.InternalService) (net.Listener, error)

Serve connects to a tailnet and serves a local service

type TailscaleConfig

type TailscaleConfig struct {
	Dir        string // Directory for state storage
	Hostname   string // Hostname for the Tailscale node
	AuthKey    string // Auth key for Tailscale
	ControlURL string // Control server URL
	Ephemeral  bool   // Whether the node is ephemeral
	Debug      bool
}

Jump to

Keyboard shortcuts

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