host

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultOSDetector

type DefaultOSDetector struct{}

DefaultOSDetector is a default implementation of the OSDetector interface.

type Host

type Host struct {
	common.Credentials

	OSType    OSType
	SSHClient SSHClient
	Hostname  string

	PackageManager packagemanager.PackageManager
	NetworkManager networkmanager.NetworkManager
	FileManager    filemanager.FileManager
	HostManager    hostmanager.HostManager
	ServiceManager servicemanager.ServiceManager
	CommandManager commandmanager.CommandManager
}

func NewHost

func NewHost(hostname string, options ...HostOption) (*Host, error)

func (*Host) DetermineOS

func (h *Host) DetermineOS(ctx context.Context) (OSType, error)

DetermineOS method for the ConcreteHost

type HostOption

type HostOption func(*Host)

func WithKeyPassphrase

func WithKeyPassphrase(keyPassphrase string) HostOption

WithKeyPassphrase returns a HostOption that sets the key passphrase for a Host.

func WithOS

func WithOS(os OSType) HostOption

WithOS returns a HostOption that sets the OS for a Host.

func WithPassword

func WithPassword(password string) HostOption

WithPassword returns a HostOption that sets the password for a Host.

func WithSSHClient

func WithSSHClient(client SSHClient) HostOption

WithSSHClient returns a HostOption that sets the SSHClient for a UnixHost.

func WithSudoPassword

func WithSudoPassword(password string) HostOption

WithSudoPassword returns a HostOption that sets the sudo password for a Host.

func WithUser

func WithUser(user string) HostOption

WithUser returns a HostOption that sets the user for a Host.

type OSType

type OSType int

OSType represents various types of Operating Systems that are supported.

const (
	Unknown OSType = iota
	LinuxUbuntu
	LinuxDebian
	LinuxFedora
	LinuxRedHat
	Darwin
	LinuxCentOS
	LinuxArch
	LinuxOpenSUSE
)

func (OSType) String

func (o OSType) String() string

String method provides the string representation of the OSType.

type RealSSHClient

type RealSSHClient struct{}

RealSSHClient provides a real implementation of the SSHClient interface.

func (RealSSHClient) Dial

func (c RealSSHClient) Dial(network, addr string, config *ssh.ClientConfig, timeout time.Duration) (*ssh.Client, error)

Dial dials an SSH connection with the given network, address, client config, and timeout.

type SSHClient

type SSHClient interface {
	Dial(network, addr string, config *ssh.ClientConfig, timeout time.Duration) (*ssh.Client, error)
}

SSHClient defines an interface for dialing and establishing an SSH connection.

Jump to

Keyboard shortcuts

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