remoteclient

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(protocolName string, factory NewRemoteClientFunc)

Register registers a remote client new func for the given protocol name.

Types

type NewRemoteClientFunc

type NewRemoteClientFunc func(config NodeConfig) (RemoteClient, error)

NewRemoteClientFunc defines the signature for creating a new RemoteClient.

type NodeAuth

type NodeAuth struct {
	Method string
	Key    string
}

NodeAuth contains authentication information for a node

type NodeConfig

type NodeConfig struct {
	Hostname string
	Port     int
	Username string
	Auth     NodeAuth
}

NodeConfig contains the configuration needed to connect to a remote node

type RemoteClient

type RemoteClient interface {
	// RunCommand executes a command on the remote machine
	RunCommand(ctx context.Context, command string, stdout io.Writer, stderr io.Writer) error
	// Download copies a file from the remote path to a local path
	Download(ctx context.Context, remotePath, localPath string) error
	// Upload copies a file from the local path to a remote path
	Upload(ctx context.Context, localPath, remotePath string) error
	// Dial opens a connection to the given network and address on the remote machine.
	Dial(network, address string) (net.Conn, error)
	// Close terminates the connection to the remote machine.
	Close() error
}

RemoteClient defines an interface for interacting with a remote machine. This abstraction allows for swapping the underlying client implementation

func GetClient

func GetClient(protocolName string, config NodeConfig) (RemoteClient, error)

GetClient is called by executors to get a client for a specific protocol.

Jump to

Keyboard shortcuts

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