remote

package
v0.0.0-...-b9b4e74 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Username  string     `json:"username"`
	CreatedAt time.Time  `json:"createdAt"`
	ExpiresAt *time.Time `json:"expiresAt,omitempty"`
}

Client is a single tunnel basic-auth credential used by a remote client.

type Remote

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

Remote manages the remote access tunnel lifecycle.

func New

func New(cloudHost string, httpHandler http.Handler, valueChan chan<- util.Param) *Remote

New creates a new Remote manager, loads persisted settings, and connects if enabled.

func (*Remote) Authenticate

func (r *Remote) Authenticate(username, password string) bool

Authenticate validates basic-auth credentials. Always runs bcrypt (against a dummy hash on miss) to prevent username enumeration via timing. Verified checks are cached, bcrypt costs seconds on small SBCs.

func (*Remote) Clients

func (r *Remote) Clients() []Client

Clients returns the list of configured clients (without password hashes).

func (*Remote) ConfigStatus

func (r *Remote) ConfigStatus() globalconfig.ConfigStatus

ConfigStatus returns the current remote access config and status.

func (*Remote) CreateClient

func (r *Remote) CreateClient(username string, expiresIn time.Duration) (Client, string, error)

CreateClient creates a new client with an auto-generated password. expiresIn <= 0 means the client never expires. Returns the cleartext password (shown to the user only once).

func (*Remote) DeleteClient

func (r *Remote) DeleteClient(username string) error

DeleteClient removes a client by username.

func (*Remote) Enable

func (r *Remote) Enable(enable bool) error

Enable enables or disables remote access. When enabling for the first time, it registers with the cloud to obtain a URL and token.

func (*Remote) Enabled

func (r *Remote) Enabled() bool

Enabled returns whether remote access is enabled.

func (*Remote) TrackActivity

func (r *Remote) TrackActivity(username string, active bool)

TrackActivity tracks remote client connections and disconnections.

type Settings

type Settings struct {
	Enabled   bool   `json:"enabled"`
	URL       string `json:"url,omitempty"`
	Token     string `json:"token,omitempty"`
	TunnelURL string `json:"tunnelUrl,omitempty"`
}

Settings is the persisted remote access configuration.

type Tunnel

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

Tunnel manages a WebSocket+yamux tunnel to the cloud proxy.

func NewTunnel

func NewTunnel(tunnelURL, token string, httpHandler http.Handler, authenticate func(user, pass string) bool, trackActivity func(string, bool), log *util.Logger, onStateChange func()) *Tunnel

NewTunnel creates a new tunnel client.

func (*Tunnel) Close

func (t *Tunnel) Close()

Close tears down the tunnel.

func (*Tunnel) Error

func (t *Tunnel) Error() error

Error returns the last connection error, if any.

func (*Tunnel) IsConnected

func (t *Tunnel) IsConnected() bool

IsConnected returns whether the tunnel is currently connected.

func (*Tunnel) LoginBlocked

func (t *Tunnel) LoginBlocked() bool

LoginBlocked returns whether login attempts are currently blocked by the rate limiter.

Jump to

Keyboard shortcuts

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