Movatterモバイル変換


[0]ホーム

URL:


reconnectingpty

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:30Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

View Source
const (// StateStarting is the default/start state.  Attaching will block until the// reconnecting pty becomes ready.StateStarting =iota// StateReady means the reconnecting pty is ready to be attached.StateReady// StateClosing means the reconnecting pty has begun closing.  The underlying// process may still be exiting.  Attaching will result in an error.StateClosing// StateDone means the reconnecting pty has completely shut down and the// process has exited.  Attaching will result in an error.StateDone)

Variables

This section is empty.

Functions

This section is empty.

Types

typeOptions

type Options struct {// Timeout describes how long to keep the pty alive without any connections.// Once elapsed the pty will be killed.Timeouttime.Duration// Metrics tracks various error counters.Metrics *prometheus.CounterVec// BackendType specifies the ReconnectingPTY backend to use.BackendTypestring}

Options allows configuring the reconnecting pty.

typeReconnectingPTY

type ReconnectingPTY interface {// Attach pipes the connection and pty, spawning it if necessary, replays// history, then blocks until EOF, an error, or the context's end.  The// connection is expected to send JSON-encoded messages and accept raw output// from the ptty.  If the context ends or the process dies the connection will// be detached.Attach(ctxcontext.Context, connIDstring, connnet.Conn, height, widthuint16, loggerslog.Logger)error// Wait waits for the reconnecting pty to close.  The underlying process might// still be exiting.Wait()// Close kills the reconnecting pty process.Close(errerror)}

ReconnectingPTY is a pty that can be reconnected within a timeout and tosimultaneous connections. The reconnecting pty can be backed by screen ifinstalled or a (buggy) buffer replay fallback.

funcNew

func New(ctxcontext.Context, loggerslog.Logger, execeragentexec.Execer, cmd *pty.Cmd, options *Options)ReconnectingPTY

New sets up a new reconnecting pty that wraps the provided command. Anyerrors with starting are returned on Attach(). The reconnecting pty willclose itself (and all connections to it) if nothing is attached for theduration of the timeout, if the context ends, or the process exits (bufferedbackend only).

typeServeradded inv2.18.0

type Server struct {ExperimentalDevcontainersEnabledbool// contains filtered or unexported fields}

funcNewServeradded inv2.18.0

func NewServer(loggerslog.Logger, commandCreator *agentssh.Server, reportConnection reportConnectionFunc,connectionsTotalprometheus.Counter, errorsTotal *prometheus.CounterVec,timeouttime.Duration, opts ...func(*Server),) *Server

NewServer returns a new ReconnectingPTY server

func (*Server)ConnCountadded inv2.18.0

func (s *Server) ConnCount()int64

func (*Server)Serveadded inv2.18.0

func (s *Server) Serve(ctx, hardCtxcontext.Context, lnet.Listener) (retErrerror)

typeState

type Stateint

State represents the current state of the reconnecting pty. States aresequential and will only move forward.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp