session

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(first, second *Session) bool

func CompareWithKeys

func CompareWithKeys(first, second *SessionWithPrivateKeys) bool

Types

type AgentPrivateKey

type AgentPrivateKey struct {
	Key        string
	Passphrase string
}

type AgentSettings

type AgentSettings struct {
	PrivateKeys []AgentPrivateKey

	// runtime
	AuthSock string
}

func (*AgentSettings) AuthSockEnv

func (s *AgentSettings) AuthSockEnv() string

func (*AgentSettings) Clone

func (s *AgentSettings) Clone() *AgentSettings

type Host

type Host struct {
	Host string
	Name string
}

func (*Host) String

func (h *Host) String() string

type Input

type Input struct {
	User            string
	Port            string
	BastionHost     string
	BastionPort     string
	BastionUser     string
	BastionPassword string
	ExtraArgs       string
	AvailableHosts  []Host
	BecomePass      string
}

type Session

type Session struct {
	// input
	User            string
	Port            string
	BastionHost     string
	BastionPort     string
	BastionUser     string
	BastionPassword string
	ExtraArgs       string
	BecomePass      string

	AgentSettings *AgentSettings
	// contains filtered or unexported fields
}

TODO rename to Settings Session is used to store ssh settings

func NewSession

func NewSession(input Input) *Session

func (*Session) AddAvailableHosts

func (s *Session) AddAvailableHosts(hosts ...Host)

func (*Session) AvailableHosts

func (s *Session) AvailableHosts() []Host

func (*Session) ChoiceNewHost

func (s *Session) ChoiceNewHost()

ChoiceNewHost choice new host for connection

func (*Session) Copy

func (s *Session) Copy() *Session

func (*Session) CountHosts

func (s *Session) CountHosts() int

func (*Session) Host

func (s *Session) Host() string

func (*Session) RemoteAddress

func (s *Session) RemoteAddress() string

RemoteAddress returns host or username@host

func (*Session) RemoveAvailableHosts

func (s *Session) RemoveAvailableHosts(hosts ...Host)

func (*Session) SetAvailableHosts

func (s *Session) SetAvailableHosts(hosts []Host)

SetAvailableHosts Set Available hosts. Current host can choice

func (*Session) String

func (s *Session) String() string

type SessionWithPrivateKeys

type SessionWithPrivateKeys struct {
	Session *Session
	Keys    []AgentPrivateKey
}

type SortByName

type SortByName []Host

func (SortByName) Len

func (h SortByName) Len() int

func (SortByName) Less

func (h SortByName) Less(i, j int) bool

func (SortByName) Swap

func (h SortByName) Swap(i, j int)

Jump to

Keyboard shortcuts

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