Documentation
¶
Index ¶
- type Client
- type Remote
- func (r *Remote) Authenticate(username, password string) bool
- func (r *Remote) Clients() []Client
- func (r *Remote) ConfigStatus() globalconfig.ConfigStatus
- func (r *Remote) CreateClient(username string, expiresIn time.Duration) (Client, string, error)
- func (r *Remote) DeleteClient(username string) error
- func (r *Remote) Enable(enable bool) error
- func (r *Remote) Enabled() bool
- func (r *Remote) TrackActivity(username string, active bool)
- type Settings
- type Tunnel
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 (*Remote) Authenticate ¶
Authenticate validates basic-auth credentials. Always runs bcrypt (against a dummy hash on miss) to prevent username enumeration via timing.
func (*Remote) ConfigStatus ¶
func (r *Remote) ConfigStatus() globalconfig.ConfigStatus
ConfigStatus returns the current remote access config and status.
func (*Remote) CreateClient ¶
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 ¶
DeleteClient removes a client by username.
func (*Remote) Enable ¶
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) TrackActivity ¶
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) IsConnected ¶
IsConnected returns whether the tunnel is currently connected.
func (*Tunnel) LoginBlocked ¶
LoginBlocked returns whether login attempts are currently blocked by the rate limiter.