sshConn

package
v0.0.0-...-e3315c2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Agent

func Agent() ssh.AuthMethod

func Broker

func Broker(hostList *HostList, input <-chan CommandRequest, events chan<- OutputEvent)

func Connection

func Connection(host *Host) (connection *ssh.Client, err error)

func LoadIdentityFiles

func LoadIdentityFiles(paths []string) ([]ssh.AuthMethod, error)

func ParseProxyJump

func ParseProxyJump(value string) []string

func PublicKeyFile

func PublicKeyFile(privateKey string) ssh.AuthMethod

func RunCommand

func RunCommand(host *Host, command string, jobID int, events chan<- OutputEvent) (int, error)

func Session

func Session(connection *ssh.Client, host *Host, stdout, stderr io.Writer) (stdin io.WriteCloser, session *ssh.Session, err error)

Types

type CommandKind

type CommandKind int
const (
	CommandKindRun CommandKind = iota
	CommandKindControl
)

type CommandRequest

type CommandRequest struct {
	JobID       int
	Command     string
	Kind        CommandKind
	ControlByte byte
}

type Host

type Host struct {
	Color         *color.Color
	Hostname      string
	Alias         string
	Host          string
	Port          int
	User          string
	IdentityFiles []string
	ProxyJump     []ResolvedHost
	IsConnected   int32
	Channel       chan CommandRequest
	ControlC      chan os.Signal
	IsWaiting     int32
}

type HostList

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

func NewHostList

func NewHostList() *HostList

func (*HostList) AddHost

func (h *HostList) AddHost(host *Host)

func (*HostList) Hosts

func (h *HostList) Hosts() []*Host

func (*HostList) Len

func (h *HostList) Len() int

func (*HostList) State

func (h *HostList) State() (connected int, waiting int)

type HostSpec

type HostSpec struct {
	Alias   string
	Host    string
	Port    int
	User    string
	PortSet bool
	UserSet bool
}

type OutputEvent

type OutputEvent struct {
	JobID    int
	Hostname string
	Line     string
	System   bool
}

type ProxyWriter

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

func NewProxyWriter

func NewProxyWriter(events chan<- OutputEvent, host *Host, jobID int) *ProxyWriter

func (*ProxyWriter) Write

func (w *ProxyWriter) Write(output []byte) (int, error)

type ResolvedHost

type ResolvedHost struct {
	Alias         string
	Host          string
	Port          int
	User          string
	IdentityFiles []string
	ProxyJump     []string
}

type SSHConfigPaths

type SSHConfigPaths struct {
	User   string
	System string
}

type SSHConfigResolver

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

func LoadSSHConfig

func LoadSSHConfig(paths SSHConfigPaths) (*SSHConfigResolver, error)

func (*SSHConfigResolver) ResolveHost

func (r *SSHConfigResolver) ResolveHost(spec HostSpec, fallbackUser string) (ResolvedHost, error)

Jump to

Keyboard shortcuts

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