app

package
v5.2.0-beta1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: LGPL-3.0 Imports: 40 Imported by: 0

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'
)

Variables

View Source
var DefaultOptions = Options{
	Address:         "",
	Port:            "8080",
	PermitWrite:     true,
	IndexFile:       "",
	TitleFormat:     "GRTTY Command",
	EnableReconnect: true,
	ReconnectTime:   10,
	CloseSignal:     1,
	Preferences:     HtermPrefernces{},
	SessionKey:      "_auth_user_id",
}

DefaultOptions -

View Source
var ExecuteCommandFailed float64 = 0

ExecuteCommandFailed metric

View Source
var ExecuteCommandTotal float64 = 0

ExecuteCommandTotal metric

View Source
var Version = "0.0.2"

Version -

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func SetConfigDefaults

func SetConfigDefaults(config *rest.Config) error

SetConfigDefaults -

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App -

func New

func New(options *Options) (*App, error)

New -

func (*App) Exit

func (app *App) Exit() (firstCall bool)

Exit -

func (*App) GetDefaultContainerName

func (app *App) GetDefaultContainerName(namespace, podname string) (string, []string, error)

GetDefaultContainerName get default container name

func (*App) NewRequest

func (app *App) NewRequest(podName, namespace, containerName string, command []string) *restclient.Request

NewRequest new exec request

func (*App) Run

func (app *App) Run() error

Run Run

type ClientContext

type ClientContext struct {
	// contains filtered or unexported fields
}

ClientContext websocket context

func (*ClientContext) Next

func (context *ClientContext) Next() *remotecommand.TerminalSize

Next next

type ContextVars

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

type Exec

type Exec interface {
	Run() error
	WaitingStop() bool
}

Exec exec interface

func NewExecContext

func NewExecContext(clientContext *ClientContext, tty *os.File, kubeRequest *restclient.Request, config *restclient.Config) Exec

NewExecContext new exec Context

func NewExecContextByStd

func NewExecContextByStd(clientContext *ClientContext, Stdin io.Reader, Stdout, Stderr io.Writer, kubeRequest *restclient.Request, config *restclient.Config) Exec

NewExecContextByStd -

type Exporter

type Exporter struct {
	ExecuteCommandTotal  prometheus.Counter
	ExecuteCommandFailed prometheus.Counter
}

Exporter collects webcli metrics. It implements prometheus.Collector.

func NewExporter

func NewExporter() *Exporter

NewExporter new a exporter

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

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 InitMessage

type InitMessage struct {
	TenantID  string `json:"T_id"`
	ServiceID string `json:"S_id"`
	PodName   string `json:"C_id"`
	Md5       string `json:"Md5"`
}

InitMessage -

type Options

type Options struct {
	Address     string `hcl:"address"`
	Port        string `hcl:"port"`
	PermitWrite bool   `hcl:"permit_write"`
	IndexFile   string `hcl:"index_file"`
	//titile format by golang templete
	TitleFormat     string                 `hcl:"title_format"`
	EnableReconnect bool                   `hcl:"enable_reconnect"`
	ReconnectTime   int                    `hcl:"reconnect_time"`
	PermitArguments bool                   `hcl:"permit_arguments"`
	CloseSignal     int                    `hcl:"close_signal"`
	Preferences     HtermPrefernces        `hcl:"preferences"`
	RawPreferences  map[string]interface{} `hcl:"preferences"`
	SessionKey      string                 `hcl:"session_key"`
	K8SConfPath     string
}

Options options

type Out

type Out struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

Out out

func CreateOut

func CreateOut(tty *os.File) *Out

CreateOut create out

func (*Out) SetTTY

func (o *Out) SetTTY() term.TTY

SetTTY set tty

Jump to

Keyboard shortcuts

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