ssh

package
v0.0.0-...-f5bb919 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: AGPL-3.0 Imports: 10 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 handles SSH connections and file operations.

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient creates a new SSH client.

func (*Client) Close

func (c *Client) Close() error

Close closes the SSH connection.

func (*Client) Connect

func (c *Client) Connect() error

Connect establishes SSH connection.

func (*Client) EnsureDirectory

func (c *Client) EnsureDirectory(remotePath string) error

EnsureDirectory ensures a directory exists on the remote server.

func (*Client) FileExists

func (c *Client) FileExists(remotePath string) (bool, error)

FileExists checks if a file exists on the remote server.

func (*Client) ReadFile

func (c *Client) ReadFile(remotePath string) ([]byte, error)

ReadFile reads content from a remote file.

func (*Client) RunCommand

func (c *Client) RunCommand(command string) (string, error)

RunCommand executes a command on the remote server.

func (*Client) TestConnection

func (c *Client) TestConnection() error

TestConnection tests the SSH connection.

func (*Client) WriteFile

func (c *Client) WriteFile(remotePath string, content []byte) error

WriteFile writes content to a remote file.

type Config

type Config struct {
	Host     string
	Port     int
	User     string
	KeyFile  string
	UseAgent bool
	Timeout  time.Duration
}

Config holds SSH connection configuration.

Jump to

Keyboard shortcuts

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