goclient

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetToken

func GetToken(remoteUrl, account string, password string) (string, error)

GetToken 获取与服务器端连接的认证密钥.

Types

type ClientInterface

type ClientInterface interface {
	Command(host url.URL, account, password, shell string, channel chan<- []byte)
}

type JsonResult

type JsonResult struct {
	ErrorCode int         `json:"error_code"`
	Message   string      `json:"message"`
	Command   string      `json:"command,omitempty"`
	MsgId     string      `json:"msg_id,omitempty"`
	Data      interface{} `json:"data,omitempty"`
}

type SSHClient

type SSHClient struct {
	ssh.ClientConfig
}

func (*SSHClient) Command

func (p *SSHClient) Command(host url.URL, account, password, shell string, channel chan<- []byte)

func (*SSHClient) Connection

func (p *SSHClient) Connection(user, host, pass string) (*ssh.Client, *ssh.Session, error)

type WebHookClient

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

func (*WebHookClient) Close

func (c *WebHookClient) Close()

func (*WebHookClient) Command

func (p *WebHookClient) Command(host url.URL, account, password, shell string, channel chan<- []byte)

Command 执行命令.

func (*WebHookClient) Connection

func (p *WebHookClient) Connection(remoteUrl string, token string) (*WebHookClient, error)

func (*WebHookClient) Read

func (c *WebHookClient) Read() ([]byte, error)

func (*WebHookClient) ReadJSON

func (c *WebHookClient) ReadJSON(v interface{}) error

func (*WebHookClient) Send

func (c *WebHookClient) Send(msg []byte) error

func (*WebHookClient) SendJSON

func (c *WebHookClient) SendJSON(v interface{}) error

func (*WebHookClient) SetCloseHandler

func (c *WebHookClient) SetCloseHandler(h func(code int, text string) error)

Jump to

Keyboard shortcuts

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