pool

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key(cfg sshclient.ConnConfig) string

Types

type ConnInfo

type ConnInfo struct {
	Key       string    `json:"key"`
	Alias     string    `json:"alias"`
	Host      string    `json:"host"`
	Port      string    `json:"port"`
	IdleSince time.Time `json:"idle_since"`
}

type DialFunc

DialFunc and HealthFunc are the pool's dependency-injection seams. They default to the real implementations in New and let tests drive Get's concurrency behaviour deterministically without a live SSH server — replacing the former package-level mutable globals, which leaked shared state across tests.

type HealthFunc

type HealthFunc func(*sshclient.Client) bool

type Pool

type Pool struct {
	DialFunc   DialFunc
	HealthFunc HealthFunc
	// contains filtered or unexported fields
}

func New

func New(ttl time.Duration) *Pool

func (*Pool) Close

func (p *Pool) Close(key string) error

func (*Pool) CloseAll

func (p *Pool) CloseAll() error

func (*Pool) Get

func (p *Pool) Get(ctx context.Context, alias string, cfg sshclient.ConnConfig) (*sshclient.Client, error)

func (*Pool) GetWithStatus

func (p *Pool) GetWithStatus(ctx context.Context, alias string, cfg sshclient.ConnConfig) (*sshclient.Client, bool, error)

func (*Pool) Len

func (p *Pool) Len() int

func (*Pool) Reap

func (p *Pool) Reap() int

func (*Pool) Stats

func (p *Pool) Stats() []ConnInfo

Jump to

Keyboard shortcuts

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