ssh

package
v0.0.0-...-1fe5492 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotConnected = errors.New("not connected")

ErrNotConnected returned when the client is not connected.

Functions

This section is empty.

Types

type Client

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

Client is an SSH client.

func NewClient

func NewClient(info *ClientInfo) *Client

NewClient creates the client with the hostPort and configuration.

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the SSH server.

func (*Client) Connect

func (c *Client) Connect() error

Connect connects to the SSH server.

func (*Client) Exec

func (c *Client) Exec(cmd string) ([]byte, error)

Exec runs a command on the remote SSH server.

func (*Client) NewSession

func (c *Client) NewSession() (*ssh.Session, error)

NewSession creates a new SSH session

type ClientInfo

type ClientInfo struct {
	Name  string `yaml:"name" json:"name" jsonschema_description:"The name of the client"`
	Group string `yaml:"group" json:"group" jsonschema_description:"The group the client belongs to"`
	Host  string `yaml:"host" json:"host" jsonschema_description:"The host of the client"`
	Port  string `yaml:"port" json:"port" jsonschema_description:"The port of the client"`
	User  string `yaml:"user" json:"user" jsonschema_description:"The user of the client (optional, defaults to current user)"`
	Pass  string `` /* 142-byte string literal not displayed */

	OS OSInfo `yaml:"os" json:"os" jsonschema_description:"The operating system information"`
}

ClientInfo stores the generate client information.

func NewClientInfo

func NewClientInfo(name string, connStr string) (*ClientInfo, error)

NewClientInfo returns client information from the connection string.

type OSInfo

type OSInfo struct {
	OSRelease string `yaml:"os_release" json:"os_release" jsonschema_description:"The output of /etc/os-release"`
	Uname     string `yaml:"uname" json:"uname" jsonschema_description:"The output of the uname command"`
}

OSInfo provides the OS information.

Jump to

Keyboard shortcuts

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