gotty: github.com/yubo/gotty/tty Index | Files

package tty

import "github.com/yubo/gotty/tty"

Index

Package Files

client_context.go command.go demo.go hterm_preferences.go http_logger.go pty.go resource.go rpc.go slist.go specs.go tty.go utils.go

Constants

const (
    Version = "0.0.12"
    //UNIX_SOCKET = "/var/run/gotty.sock"
    UNIX_SOCKET      = "/tmp/gotty.sock"
    CONN_S_WAITING   = "waiting"
    CONN_S_CONNECTED = "connected"
    CONN_S_CLOSED    = "closed"
    CONN_M_EXEC      = "exec"
    CONN_M_SHARE     = "share"
    CONN_M_ATTACH    = "attach"
    CONN_M_PLAY      = "play"
    NULL_FILE        = "/dev/null"
)

Variables

var (
    DefaultOptions = Options{
        Address:         "",
        Port:            "8080",
        EnableBasicAuth: false,
        Credential:      "",

        DemoDir:             "/var/lib/gotty/static",
        DemoEnable:          true,
        DemoAddr:            "127.0.0.0/8",
        EnableTLS:           false,
        TLSCrtFile:          "/etc/gotty/gotty.crt",
        TLSKeyFile:          "/etc/gotty/gotty.key",
        EnableTLSClientAuth: false,
        TLSCACrtFile:        "/etc/gotty/gotty.ca.crt",
        TitleFormat:         "GoTTY - {{ .Command }} ({{ .Hostname }})",
        EnableReconnect:     false,
        ReconnectTime:       10,
        Once:                false,
        CloseSignal:         1,
        Preferences:         HtermPrefernces{},
        WaitingConnTime:     10,
        RecFileDir:          "/var/lib/gotty",
        SkipTlsVerify:       false,
        UnixSocket:          "/tmp/gotty.sock",
        Debug:               false,
        Resourses:           "./resources",
        Chuser:              "",
        Env:                 map[string]string{},
    }
    DefaultCmdOptions = CmdOptions{
        All:              false,
        PermitWrite:      false,
        PermitShare:      false,
        PermitShareWrite: false,
        Rec:              false,
        Repeat:           true,
        Speed:            1.0,
        Addr:             "127.0.0.0/8",
        MaxWait:          0,
    }
)
var (

    //session   *Session
    CmdOpt CmdOptions

    GlobalOpt Options = DefaultOptions
)

func Asset Uses

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 Uses

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 Uses

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 Uses

func AssetNames() []string

AssetNames returns the names of the assets.

func Call Uses

func Call(serviceMethod string, args interface{}, reply interface{}) error

func GottyClient Uses

func GottyClient(skipTlsVerify bool, url string) error

func Key2Str Uses

func Key2Str(args ...interface{}) string

func MustAsset Uses

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 Parse Uses

func Parse()

func RenderJson Uses

func RenderJson(w http.ResponseWriter, v interface{})

func RestoreAsset Uses

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets Uses

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func StringJoinSpace Uses

func StringJoinSpace(args ...interface{}) string

func SubSec Uses

func SubSec(a, b int64) string

type CallOptions Uses

type CallOptions struct {
    Opt  CmdOptions
    Args []string
}

type Cmd Uses

type Cmd int

func (*Cmd) Attach Uses

func (c *Cmd) Attach(arg CallOptions, key *ConnKey) error

func (*Cmd) Close Uses

func (c *Cmd) Close(arg *CallOptions, keys *[]ConnKey) error

func (*Cmd) Exec Uses

func (c *Cmd) Exec(arg *CallOptions, info *Session_info) error

func (*Cmd) Play Uses

func (c *Cmd) Play(arg *CallOptions, info *Session_info) error

func (*Cmd) Ps Uses

func (c *Cmd) Ps(arg *CallOptions, reply *[]Session_info) error

type CmdOptions Uses

type CmdOptions struct {
    All              bool    `json:"all"`
    PermitWrite      bool    `json:"write"`
    PermitShare      bool    `json:"share"`
    PermitShareWrite bool    `json:"sharew"`
    Rec              bool    `json:"rec"`
    Repeat           bool    `json:"repeat"`
    MaxWait          int64   `json:"maxwait"`
    Speed            float64 `json:"speed"`
    Name             string  `json:"name"`
    Addr             string  `json:"addr"`
    Cmd              string  `json:"cmd"`
    SName            string  `json:"sname"`
    SAddr            string  `json:"saddr"`
    RecId            string  `json:"recid"`
    Action           string  `json:"action"`
}

type ConnKey Uses

type ConnKey struct {
    Name string
    Addr string
}

func (ConnKey) String Uses

func (k ConnKey) String() string

type ContextVars Uses

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

type Daemon Uses

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

type HtermPrefernces Uses

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 Uses

type InitMessage struct {
    Arguments string `json:"Arguments,omitempty"`
    AuthToken string `json:"AuthToken,omitempty"`
}

type Options Uses

type Options struct {
    Address             string                 `hcl:"address"`
    Port                string                 `hcl:"port"`
    EnableBasicAuth     bool                   `hcl:"enable_basic_auth"`
    Credential          string                 `hcl:"credential"`
    DemoDir             string                 `hcl:"demo_dir"`
    DemoEnable          bool                   `hcl:"demo_enable"`
    DemoAddr            string                 `hcl:"demo_addr"`
    EnableTLS           bool                   `hcl:"enable_tls"`
    TLSCrtFile          string                 `hcl:"tls_crt_file"`
    TLSKeyFile          string                 `hcl:"tls_key_file"`
    EnableTLSClientAuth bool                   `hcl:"enable_tls_client_auth"`
    TLSCACrtFile        string                 `hcl:"tls_ca_crt_file"`
    TitleFormat         string                 `hcl:"title_format"`
    EnableReconnect     bool                   `hcl:"enable_reconnect"`
    ReconnectTime       int                    `hcl:"reconnect_time"`
    Once                bool                   `hcl:"once"`
    PermitArguments     bool                   `hcl:"permit_arguments"`
    CloseSignal         int                    `hcl:"close_signal"`
    Preferences         HtermPrefernces        `hcl:"preferences"`
    RawPreferences      map[string]interface{} `hcl:"preferences"`
    WaitingConnTime     int                    `hcl:"waiting_conn_time"`
    RecFileDir          string                 `hcl:"rec_file_dir"`
    SkipTlsVerify       bool                   `hcl:"skip_tls_verify"`
    UnixSocket          string                 `hcl:"unix_socket"`
    Debug               bool                   `hcl:"debug"`
    Resourses           string                 `hcl:"resources"`
    Chuser              string                 `hcl:"chuser"`
    Env                 map[string]string      `hcl:"env"`
}

type Session_info Uses

type Session_info struct {
    Key        ConnKey
    PKey       ConnKey
    Method     string
    Status     string
    Command    []string
    RemoteAddr string
    ConnTime   int64
    LinkNb     int32
    RecId      string
    Cmd        string
    Share      bool
    Time       string
}

type Session_infos Uses

type Session_infos []Session_info

func (Session_infos) Len Uses

func (slice Session_infos) Len() int

func (Session_infos) Less Uses

func (slice Session_infos) Less(i, j int) bool

func (Session_infos) Swap Uses

func (slice Session_infos) Swap(i, j int)

type Slist Uses

type Slist struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func (*Slist) Front Uses

func (l *Slist) Front() *list.Element

func (*Slist) Len Uses

func (l *Slist) Len() int

func (*Slist) Pop Uses

func (l *Slist) Pop() interface{}

func (*Slist) Push Uses

func (l *Slist) Push(v interface{}) *list.Element

func (*Slist) Remove Uses

func (l *Slist) Remove(e *list.Element) interface{}

Package tty imports 47 packages (graph). Updated 2017-01-26. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).