Documentation
¶
Index ¶
- func CheckConnectivity(host, user, keyPath string) error
- func EnsureSSHKeyExists(keyPath string) (string, error)
- func ExpandKeyPath(keyPath string) (string, error)
- type Client
- func (c *Client) Close()
- func (c *Client) Connect() error
- func (c *Client) FileExists(path string) (bool, error)
- func (c *Client) GetHostname() (string, error)
- func (c *Client) GetRawClient() *gossh.Client
- func (c *Client) MkdirAll(path string) error
- func (c *Client) Run(command string) (string, error)
- func (c *Client) RunStream(command string, stdout, stderr io.Writer) error
- func (c *Client) RunSudo(command string) (string, error)
- func (c *Client) WriteFile(path, content string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckConnectivity ¶
CheckConnectivity kiểm tra SSH connection nhanh
func EnsureSSHKeyExists ¶ added in v1.0.1
EnsureSSHKeyExists kiểm tra xem file SSH key có tồn tại hay không. Nếu không, nó sẽ tự động sinh mã khóa Ed25519.
func ExpandKeyPath ¶ added in v1.0.1
ExpandKeyPath chuyển đổi đường dẫn chứa dâu ~ thành Absolute Path
Types ¶
type Client ¶
type Client struct {
Host string
User string
KeyPath string
Port int
// contains filtered or unexported fields
}
Client là SSH client wrapper
func (*Client) FileExists ¶
FileExists kiểm tra file/thư mục có tồn tại không
func (*Client) GetHostname ¶
GetHostname lấy hostname của remote host
func (*Client) GetRawClient ¶ added in v1.0.23
GetRawClient lấy con trỏ gossh client gốc
Click to show internal directories.
Click to hide internal directories.