client

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package client provides an SSH interface to communicate with TP-Link switches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Addr     string // Address of the switch (host:port)
	User     string // SSH username
	Password string // SSH password
	// contains filtered or unexported fields
}

Client provides an SSH session to interact with TP-Link switches.

func NewClient

func NewClient(addr, user, password string) *Client

NewClient returns a new initialized Client instance.

func (*Client) Close

func (c *Client) Close()

Close terminates the SSH session and connection.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

Connect establishes the SSH connection and interactive shell session.

func (*Client) RunCommand

func (c *Client) RunCommand(ctx context.Context, cmd string) (string, error)

RunCommand sends a command to the switch and returns its output.

Jump to

Keyboard shortcuts

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