tty

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Input          = '0'
	Ping           = '1'
	ResizeTerminal = '2'
)
View Source
const (
	Output         = '0'
	Pong           = '1'
	SetWindowTitle = '2'
	SetPreferences = '3'
	SetReconnect   = '4'
)
View Source
const (
	SubProtocol = "shurenyun"
)

Variables

View Source
var (
	Upgrader = &websocket.Upgrader{
		ReadBufferSize:  1024,
		WriteBufferSize: 1024,
		Subprotocols:    []string{SubProtocol},
		CheckOrigin:     func(r *http.Request) bool { return true },
	}

	DefaultOptions = &Options{
		PermitWrite:       true,
		EnableRandomUrl:   false,
		RandomUrlLength:   8,
		TitleFormat:       SubProtocol + "TTY - {{ .Command }} ({{ .Hostname }})",
		EnableCustomTitle: false,
		EnableReconnect:   false,
		ReconnectTime:     10,
		Once:              false,
		CloseSignal:       1,
		Preferences:       HtermPrefernces{},
	}
)

Functions

This section is empty.

Types

type ArgResizeTerminal

type ArgResizeTerminal struct {
	Columns float64
	Rows    float64
}

type ClientContext

type ClientContext struct {
	Request       *http.Request
	Conn          *websocket.Conn
	Command       *exec.Cmd
	Pty           *os.File
	WriteMutex    *sync.Mutex
	TitleTemplate *template.Template
	Options       *Options
}

func New

func New(cmd *exec.Cmd, conn *websocket.Conn, request *http.Request, opts *Options) (*ClientContext, error)

func (*ClientContext) HandleClient

func (ctx *ClientContext) HandleClient()

type ContextVars

type ContextVars struct {
	Command    string
	Pid        int
	Hostname   string
	RemoteAddr string
}

type HtermPrefernces

type HtermPrefernces struct {
	AltGrMode                     *string                      `hcl:"alt_gr_mode"`
	AltBackspaceIsMetaBackspace   bool                         `hcl:"alt_backspace_is_meta_backspace"`
	AltIsMeta                     bool                         `hcl:"alt_is_meta"`
	AltSendsWhat                  string                       `hcl:"alt_sends_what"`
	AudibleBellSound              string                       `hcl:"audible_bell_sound"`
	DesktopNotificationBell       bool                         `hcl:"desktop_notification_bell"`
	BackgroundColor               string                       `hcl:"background_color"`
	BackgroundImage               string                       `hcl:"background_image"`
	BackgroundSize                string                       `hcl:"background_size"`
	BackgroundPosition            string                       `hcl:"background_position"`
	BackspaceSendsBackspace       bool                         `hcl:"backspace_sends_backspace"`
	CharacterMapOverrides         map[string]map[string]string `hcl:"character_map_overrides"`
	CloseOnExit                   bool                         `hcl:"close_on_exit"`
	CursorBlink                   bool                         `hcl:"cursor_blink"`
	CursorBlinkCycle              [2]int                       `hcl:"cursor_blink_cycle"`
	CursorColor                   string                       `hcl:"cursor_color"`
	ColorPaletteOverrides         []*string                    `hcl:"color_palette_overrides"`
	CopyOnSelect                  bool                         `hcl:"copy_on_select"`
	UseDefaultWindowCopy          bool                         `hcl:"use_default_window_copy"`
	ClearSelectionAfterCopy       bool                         `hcl:"clear_selection_after_copy"`
	CtrlPlusMinusZeroZoom         bool                         `hcl:"ctrl_plus_minus_zero_zoom"`
	CtrlCCopy                     bool                         `hcl:"ctrl_c_copy"`
	CtrlVPaste                    bool                         `hcl:"ctrl_v_paste"`
	EastAsianAmbiguousAsTwoColumn bool                         `hcl:"east_asian_ambiguous_as_two_column"`
	Enable8BitControl             *bool                        `hcl:"enable_8_bit_control"`
	EnableBold                    *bool                        `hcl:"enable_bold"`
	EnableBoldAsBright            bool                         `hcl:"enable_bold_as_bright"`
	EnableClipboardNotice         bool                         `hcl:"enable_clipboard_notice"`
	EnableClipboardWrite          bool                         `hcl:"enable_clipboard_write"`
	EnableDec12                   bool                         `hcl:"enable_dec12"`
	Environment                   map[string]string            `hcl:"environment"`
	FontFamily                    string                       `hcl:"font_family"`
	FontSize                      int                          `hcl:"font_size"`
	FontSmoothing                 string                       `hcl:"font_smoothing"`
	ForegroundColor               string                       `hcl:"foreground_color"`
	HomeKeysScroll                bool                         `hcl:"home_keys_scroll"`
	Keybindings                   map[string]string            `hcl:"keybindings"`
	MaxStringSequence             int                          `hcl:"max_string_sequence"`
	MediaKeysAreFkeys             bool                         `hcl:"media_keys_are_fkeys"`
	MetaSendsEscape               bool                         `hcl:"meta_sends_escape"`
	MousePasteButton              *int                         `hcl:"mouse_paste_button"`
	PageKeysScroll                bool                         `hcl:"page_keys_scroll"`
	PassAltNumber                 *bool                        `hcl:"pass_alt_number"`
	PassCtrlNumber                *bool                        `hcl:"pass_ctrl_number"`
	PassMetaNumber                *bool                        `hcl:"pass_meta_number"`
	PassMetaV                     bool                         `hcl:"pass_meta_v"`
	ReceiveEncoding               string                       `hcl:"receive_encoding"`
	ScrollOnKeystroke             bool                         `hcl:"scroll_on_keystroke"`
	ScrollOnOutput                bool                         `hcl:"scroll_on_output"`
	ScrollbarVisible              bool                         `hcl:"scrollbar_visible"`
	ScrollWheelMoveMultiplier     int                          `hcl:"scroll_wheel_move_multiplier"`
	SendEncoding                  string                       `hcl:"send_encoding"`
	ShiftInsertPaste              bool                         `hcl:"shift_insert_paste"`
	UserCss                       string                       `hcl:"user_css"`
}

type Options

type Options struct {
	CloseSignal       int                    `hcl:"close_signal"`
	Preferences       HtermPrefernces        `hcl:"preferences"`
	RawPreferences    map[string]interface{} `hcl:"preferences"`
	EnableReconnect   bool                   `hcl:"enable_reconnect"`
	ReconnectTime     int                    `hcl:"reconnect_time"`
	Once              bool                   `hcl:"once"`
	PermitWrite       bool                   `hcl:"permit_write"`
	TitleFormat       string                 `hcl:"title_format"`
	EnableCustomTitle bool                   `hcl:"custom_title"`
	EnableRandomUrl   bool                   `hcl:"enable_random_url"`
	RandomUrlLength   int                    `hcl:"random_url_length"`
}

Jump to

Keyboard shortcuts

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