Documentation ¶
Index ¶
- type AuthConfig
- type Client
- type ClientType
- func (c *ClientType) Close() error
- func (c *ClientType) Get(src, dst string) error
- func (c *ClientType) GetDir(src string, dst string) error
- func (c *ClientType) GetFile(src string, dst string) error
- func (c *ClientType) Login() error
- func (c *ClientType) Proxy(auth *AuthConfig) (Client, error)
- func (c *ClientType) Push(src, dst string) error
- func (c *ClientType) PushDir(src string, dst string) error
- func (c *ClientType) PushFile(src string, dst string) error
- func (c *ClientType) Run(cmd string, stdout, stderr io.Writer) error
- func (c *ClientType) TunnelStart(Local, Remote NetworkConfig) error
- type NetworkConfig
- type Option
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct { Username string Password string PrivateKey string NetworkConfig }
type Client ¶
type ClientType ¶
type ClientType struct {
// contains filtered or unexported fields
}
func (*ClientType) Close ¶
func (c *ClientType) Close() error
func (*ClientType) Get ¶
func (c *ClientType) Get(src, dst string) error
Example ¶
cli, _ := NewClient(auth) defer cli.Close() if err := cli.Get("/tmp/test02", "."); err != nil { log.Fatal(err) }
Output:
func (*ClientType) Login ¶
func (c *ClientType) Login() error
Example ¶
cli, _ := NewClient(auth) if err := cli.Login(); err != nil { log.Fatal(err) }
Output:
func (*ClientType) Proxy ¶
func (c *ClientType) Proxy(auth *AuthConfig) (Client, error)
func (*ClientType) Push ¶
func (c *ClientType) Push(src, dst string) error
Example ¶
cli, _ := NewClient(auth) defer cli.Close() if err := cli.Push("./test", "/tmp"); err != nil { log.Fatal(err) }
Output:
func (*ClientType) Run ¶
func (c *ClientType) Run(cmd string, stdout, stderr io.Writer) error
Example ¶
cli, _ := NewClient(auth) if err := cli.Run("w", stdout, stderr); err != nil { log.Fatal(err) }
Output:
func (*ClientType) TunnelStart ¶
func (c *ClientType) TunnelStart(Local, Remote NetworkConfig) error
Example ¶
cli, _ := NewClient(auth) local := NetworkConfig{ Network: "tcp", Address: "127.0.0.1:9000", } remote := NetworkConfig{ Network: "unix", Address: "/var/run/docker.sock", } if err := cli.TunnelStart(local, remote); err != nil { log.Fatal(err) }
Output:
type NetworkConfig ¶
type NetworkConfig struct { Network string // 如果Network 为unix,则Address为对应的文件路径 // 如果Network 为tcp,则Address为 ip:port Address string ConnectTimeout int }
same as net.Dial
Click to show internal directories.
Click to hide internal directories.