ts

package
v0.7.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const LoftTSNetDomain = "ts.loft"
View Source
const (
	// TSPortForwardPort is the fixed port on which the workspace WebSocket reverse proxy listens.
	TSPortForwardPort string = "12051"
)

Variables

This section is empty.

Functions

func CheckDerpConnection

func CheckDerpConnection(ctx context.Context, baseUrl *url.URL) error

CheckDerpConnection validates the DERP connection

func GetClientHostname

func GetClientHostname(userName string) (string, error)

func GetEnvOrDefault

func GetEnvOrDefault(envVar, defaultVal string) string

Utility function to get environment variable or default

func GetURL

func GetURL(host string, port int) string

func GetWorkspaceHostname

func GetWorkspaceHostname(name, namespace string) string

func ParseWorkspaceHostname

func ParseWorkspaceHostname(hostname string) (name string, project string, err error)

func RemoveProtocol

func RemoveProtocol(hostPath string) string

RemoveProtocol removes protocol from URL

func WaitForSSHClient

func WaitForSSHClient(ctx context.Context, lc *tsClient.LocalClient, host string, port int, user string, log log.Logger) (*ssh.Client, error)

func WaitHostReachable

func WaitHostReachable(ctx context.Context, lc *tailscale.LocalClient, addr Addr, log log.Logger) error

WaitHostReachable polls until the given host is reachable via ts.

func WatchNetmap

func WatchNetmap(ctx context.Context, lc *tailscale.LocalClient, netmapChangedFn func(nm *netmap.NetworkMap)) error

Types

type Addr

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

func NewAddr

func NewAddr(rawHost string, port int) Addr

func (Addr) Host

func (a Addr) Host() string

func (Addr) Network

func (a Addr) Network() string

func (Addr) Port

func (a Addr) Port() int

func (Addr) String

func (a Addr) String() string

type ConnTrackingFunc

type ConnTrackingFunc func(address string)

type WorkspaceServer

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

WorkspaceServer holds the TSNet server and its listeners.

func NewWorkspaceServer

func NewWorkspaceServer(config *WorkspaceServerConfig, logger log.Logger) *WorkspaceServer

NewWorkspaceServer creates a new TSNet server instance.

func (*WorkspaceServer) Dial

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

Dial dials the given address using the TSNet server.

func (*WorkspaceServer) Start

func (s *WorkspaceServer) Start(ctx context.Context) error

Start initializes the TSNet server, sets up listeners for SSH and HTTP reverse proxy traffic, and waits until the given context is canceled.

func (*WorkspaceServer) Stop

func (s *WorkspaceServer) Stop()

Stop shuts down all listeners and the TSNet server.

type WorkspaceServerConfig

type WorkspaceServerConfig struct {
	AccessKey     string
	PlatformHost  string
	WorkspaceHost string
	LogF          func(format string, args ...interface{})
	Client        client.Client
	RootDir       string
}

WorkspaceServerConfig defines configuration for the TSNet instance.

Jump to

Keyboard shortcuts

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