terminal

package module
v0.0.0-...-90d794a Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: MIT Imports: 17 Imported by: 0

README

Gitlab Terminal

This Go library contains the code that powers the web terminal implementation of Gitlab for environments and CI jobs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BrowserPingInterval = 30 * time.Second
)

Functions

func CloseAfterMaxTime

func CloseAfterMaxTime(proxy Proxy, maxSessionTime int)

func NewIOWrapper

func NewIOWrapper(conn Connection) *ioWrapper

func ProxyFileDescriptor

func ProxyFileDescriptor(w http.ResponseWriter, r *http.Request, fd *os.File, proxy *FileDescriptorProxy)

func ProxyWebSocket

func ProxyWebSocket(w http.ResponseWriter, r *http.Request, terminal *TerminalSettings, proxy *WebSocketProxy)

Types

type Connection

type Connection interface {
	UnderlyingConn() net.Conn
	ReadMessage() (int, []byte, error)
	WriteMessage(int, []byte) error
	WriteControl(int, []byte, time.Time) error
}

An abstraction of gorilla's *websocket.Conn

func Wrap

func Wrap(conn Connection, subprotocol string) Connection

type FileDescriptorProxy

type FileDescriptorProxy struct {
	StopCh chan error
}

func NewFileDescriptorProxy

func NewFileDescriptorProxy(stoppers int) *FileDescriptorProxy

stoppers is the number of goroutines that may attempt to call Stop()

func (*FileDescriptorProxy) GetStopCh

func (p *FileDescriptorProxy) GetStopCh() chan error

func (*FileDescriptorProxy) Serve

func (p *FileDescriptorProxy) Serve(upstream, downstream io.ReadWriter, upstreamAddr, downstreamAddr string) error

type Proxy

type Proxy interface {
	GetStopCh() chan error
}

type TerminalSettings

type TerminalSettings struct {
	// The terminal provider may require use of a particular subprotocol. If so,
	// it must be specified here, and Workhorse must have a matching codec.
	Subprotocols []string

	// The websocket URL to connect to.
	Url string

	// Any headers (e.g., Authorization) to send with the websocket request
	Header http.Header

	// The CA roots to validate the remote endpoint with, for wss:// URLs. The
	// system-provided CA pool will be used if this is blank. PEM-encoded data.
	CAPem string

	// The value is specified in seconds. It is converted to time.Duration
	// later.
	MaxSessionTime int
}

func (*TerminalSettings) Clone

func (t *TerminalSettings) Clone() *TerminalSettings

func (*TerminalSettings) Dial

func (*TerminalSettings) Dialer

func (t *TerminalSettings) Dialer() *websocket.Dialer

func (*TerminalSettings) IsEqual

func (t *TerminalSettings) IsEqual(other *TerminalSettings) bool

func (*TerminalSettings) URL

func (t *TerminalSettings) URL() (*url.URL, error)

func (*TerminalSettings) Validate

func (t *TerminalSettings) Validate() error

type WebSocketProxy

type WebSocketProxy struct {
	StopCh chan error
}

func NewWebSocketProxy

func NewWebSocketProxy(stoppers int) *WebSocketProxy

stoppers is the number of goroutines that may attempt to call Stop()

func (*WebSocketProxy) GetStopCh

func (p *WebSocketProxy) GetStopCh() chan error

func (*WebSocketProxy) Serve

func (p *WebSocketProxy) Serve(upstream, downstream Connection, upstreamAddr, downstreamAddr string) error

Jump to

Keyboard shortcuts

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