sshx

package module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client ...

func New

func New(host, pass, keyPath string, ops ...Option) (*Client, error)

New a client pass or key choose one

func (*Client) Close

func (c *Client) Close() error

Close ...

func (*Client) Copy

func (c *Client) Copy(src, dst string, force bool) error

Copy ... /tmp/1.txt -> /root/ = /root/1.txt /tmp/dir/ -> /root/ = /tmp/1.txt /tmp/dir/ -> /root/dir/ = /tmp/dir/1.txx

func (*Client) CopyID added in v0.2.4

func (c *Client) CopyID(pubKey ...string) error

CopyID copy public key to remote instance authorized_keys file

func (*Client) CopyKey added in v0.2.4

func (c *Client) CopyKey(keyPath []string) error

CopyKey to copy private or public key to remote instance keyPath is like ~/.ssh/id_rsa.pub

func (*Client) GetClient

func (c *Client) GetClient() *ssh.Client

GetClient get original ssh client

func (*Client) Interact added in v0.2.0

func (c *Client) Interact() error

Interact ...

func (*Client) RawInteract added in v0.2.1

func (c *Client) RawInteract() error

RawInteract interact with ssh command

func (*Client) RawRsync added in v0.2.2

func (c *Client) RawRsync(src, dst string) error

RawRsync ... rsync -azv -e 'ssh -o "ProxyCommand ssh -A PROXYHOST -W %h:%p"' foo/ dest:./foo/

func (*Client) RawSCP added in v0.2.1

func (c *Client) RawSCP(src, dst string) error

func (*Client) RunDirect

func (c *Client) RunDirect(script string, stdout, stderr io.Writer) error

RunDirect ...

func (*Client) RunResult added in v0.1.1

func (c *Client) RunResult(script string) (string, error)

RunResult ...

type Option

type Option = func(*Client) error

func WithClientConfig

func WithClientConfig(conf *ssh.ClientConfig) Option

WithClientConfig ...

func WithJumpProxy

func WithJumpProxy(host, pass, keyPath string, ops ...Option) Option

WithJumpProxy ...

func WithKeyPass

func WithKeyPass(keyPass string) Option

WithKeyPass ...

func WithPort

func WithPort(port int) Option

WithPort ...

func WithUser

func WithUser(user string) Option

WithUser ...

Jump to

Keyboard shortcuts

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