Documentation
¶
Index ¶
- Variables
- func CloseSession(ac *client.AlpaconClient, sessionID string) error
- func ForceCloseSession(ac *client.AlpaconClient, sessionID string) error
- func GetSessionDetail(ac *client.AlpaconClient, sessionID string) ([]byte, error)
- func InviteToSession(ac *client.AlpaconClient, sessionID string, emails []string, readOnly bool) error
- func OpenNewTerminal(ac *client.AlpaconClient, sessionResponse SessionResponse) error
- func OpenReadOnlyTerminal(ac *client.AlpaconClient, sessionResponse SessionResponse) error
- func OpenSharedTerminal(ac *client.AlpaconClient, sessionResponse SessionResponse) error
- func SendTerminalSize(ac *client.AlpaconClient, sessionID string) error
- type ConnectRequest
- type InviteRequest
- type JoinRequest
- type SessionDetailResponse
- type SessionListItem
- type SessionRecord
- type SessionRequest
- type SessionResponse
- func ConnectToSession(ac *client.AlpaconClient, sessionID string) (SessionResponse, error)
- func CreateWebshSession(ac *client.AlpaconClient, serverName, username, groupname string, ...) (SessionResponse, error)
- func JoinWebshSession(ac *client.AlpaconClient, sharedURL, password string) (SessionResponse, error)
- func ReconnectToSession(ac *client.AlpaconClient, sessionID string) (SessionResponse, error)
- type SessionSizeRequest
- type ShareRequest
- type ShareResponse
- type WebsocketClient
Constants ¶
This section is empty.
Variables ¶
var ( // TerminalSize reports the local terminal's size, in rows and columns. A var so // a test can pin a size where there is no terminal to read one from. TerminalSize = func() (rows, cols int, err error) { cols, rows, err = term.GetSize(int(os.Stdin.Fd())) return rows, cols, err } // ErrReconnectFailed ends a session whose connection dropped and could not be // re-established within the attempt budget. ErrReconnectFailed = errors.New("could not reconnect to the session") // ErrSessionGone ends a session the server refused a new channel on: it was // closed while the connection was down, so retrying only asks again. ErrSessionGone = errors.New("the session is no longer open") )
Functions ¶
func CloseSession ¶ added in v1.3.4
func CloseSession(ac *client.AlpaconClient, sessionID string) error
func ForceCloseSession ¶ added in v1.3.4
func ForceCloseSession(ac *client.AlpaconClient, sessionID string) error
func GetSessionDetail ¶ added in v1.3.4
func GetSessionDetail(ac *client.AlpaconClient, sessionID string) ([]byte, error)
func InviteToSession ¶ added in v1.3.4
func OpenNewTerminal ¶
func OpenNewTerminal(ac *client.AlpaconClient, sessionResponse SessionResponse) error
OpenNewTerminal opens an interactive terminal on the session. Input is forwarded to the server. Terminal echo is suppressed via raw mode. Ends cleanly on the remote close, on Ctrl+D, or on a signal. A connection that drops for any other reason is re-dialed onto a new channel of the same session.
func OpenReadOnlyTerminal ¶ added in v1.3.4
func OpenReadOnlyTerminal(ac *client.AlpaconClient, sessionResponse SessionResponse) error
OpenReadOnlyTerminal opens a read-only terminal view for watching another user's session. Input is not forwarded to the server. Terminal echo is suppressed via raw mode. Ends cleanly on the remote close, on Ctrl+C, or on a signal.
func OpenSharedTerminal ¶ added in v1.13.0
func OpenSharedTerminal(ac *client.AlpaconClient, sessionResponse SessionResponse) error
OpenSharedTerminal opens the interactive terminal of a session joined through a shared link. It does not reconnect: only the session's owner may open a new channel on it, the invite channel is single-use, and the join response names no session to ask about. A drop ends the terminal, and the link can be joined again.
func SendTerminalSize ¶ added in v1.13.0
func SendTerminalSize(ac *client.AlpaconClient, sessionID string) error
SendTerminalSize tells the server the terminal's current size. The server resizes the remote PTY on every update, so this also redraws a shell that spent a reconnect talking to nobody, even when the size itself has not changed.
Types ¶
type ConnectRequest ¶ added in v1.3.4
type InviteRequest ¶ added in v1.3.4
type JoinRequest ¶
type JoinRequest struct {
Password string `json:"password"`
}
type SessionDetailResponse ¶ added in v1.3.4
type SessionDetailResponse struct {
ID string `json:"id"`
Rows int `json:"rows"`
Cols int `json:"cols"`
Server types.ServerSummary `json:"server"`
User types.UserSummary `json:"user"`
Username string `json:"username"`
Groupname string `json:"groupname"`
UserAgent string `json:"user_agent"`
RemoteIP string `json:"remote_ip"`
IsTunnel bool `json:"is_tunnel"`
ClientType string `json:"client_type"`
AddedAt string `json:"added_at"`
UpdatedAt string `json:"updated_at"`
ClosedAt *string `json:"closed_at"`
Success bool `json:"success"`
}
type SessionListItem ¶ added in v1.3.4
type SessionListItem struct {
ID string `json:"id" table:"ID"`
Server string `json:"server" table:"Server"`
User string `json:"user" table:"User"`
Username string `json:"username" table:"Username"`
RemoteIP string `json:"remote_ip" table:"Remote IP"`
AddedAt utils.Timestamp `json:"added_at" table:"Added At"`
ClosedAt utils.Timestamp `json:"closed_at" table:"Closed At"`
}
func GetSessionList ¶ added in v1.3.4
func GetSessionList(ac *client.AlpaconClient, tail int) ([]SessionListItem, error)
GetSessionList returns the newest tail connectable sessions. The endpoint sorts -added_at, so the newest ones arrive first and the walk stops as soon as tail is reached.
type SessionRecord ¶ added in v1.9.0
type SessionRecord struct {
AddedAt string `json:"added_at" table:"Added At"`
Record string `json:"record" table:"Record"`
}
func GetSessionRecords ¶ added in v1.9.0
func GetSessionRecords(ac *client.AlpaconClient, sessionID, query string, limit int) ([]SessionRecord, error)
type SessionRequest ¶
type SessionRequest struct {
Rows int `json:"rows"`
Cols int `json:"cols"`
Server string `json:"server"` // server id
Username string `json:"username"`
Groupname string `json:"groupname"`
WorkSession string `json:"work_session,omitempty"`
}
func BuildSessionRequest ¶ added in v1.4.6
func BuildSessionRequest(serverID, username, groupname string, rows, cols int, workSessionID string) *SessionRequest
BuildSessionRequest assembles the JSON body for a Websh session create call.
type SessionResponse ¶
type SessionResponse struct {
ID string `json:"id"`
Rows int `json:"rows"`
Cols int `json:"cols"`
Server types.ServerSummary `json:"server"`
User types.UserSummary `json:"user"`
Username string `json:"username"`
Groupname string `json:"groupname"`
UserAgent string `json:"user_agent"`
RemoteIP string `json:"remote_ip"`
WebsocketURL string `json:"websocket_url"`
}
func ConnectToSession ¶ added in v1.3.4
func ConnectToSession(ac *client.AlpaconClient, sessionID string) (SessionResponse, error)
ConnectToSession opens a read-only channel on someone else's session, which is what watching one is.
func CreateWebshSession ¶
func CreateWebshSession(ac *client.AlpaconClient, serverName, username, groupname string, share, readOnly bool, workSessionID string) (SessionResponse, error)
CreateWebshSession creates a Websh session on the server and, with share, asks for its share link.
func JoinWebshSession ¶
func JoinWebshSession(ac *client.AlpaconClient, sharedURL, password string) (SessionResponse, error)
func ReconnectToSession ¶ added in v1.13.0
func ReconnectToSession(ac *client.AlpaconClient, sessionID string) (SessionResponse, error)
ReconnectToSession opens a new interactive channel on a session the caller is already running, so a client whose connection dropped can reattach. The session's PTY channel is untouched by a user channel closing, so the shell and everything running in it survive the gap.
type SessionSizeRequest ¶ added in v1.13.0
SessionSizeRequest updates a session's terminal size. The server resizes the remote PTY on every update, so re-sending an unchanged size is what makes the shell redraw after a reconnect.
type ShareRequest ¶
type ShareRequest struct {
}
type ShareResponse ¶
type ShareResponse struct {
}
type WebsocketClient ¶
type WebsocketClient struct {
// contains filtered or unexported fields
}