internal

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

https://github.com/alanshaw/multiwriter

Index

Constants

View Source
const (
	BMCDataKey contextKey = "bmc"
)

Variables

This section is empty.

Functions

func Handler

func Handler(log logr.Logger, globalState *KeyValueStore, ipmitoolPath string) func(s ssh.Session)

Handler returns a function that can be used as the ssh.Handler for the gliderlabs/ssh server.

func PubkeyAuth

func PubkeyAuth(r Reader, log logr.Logger) func(ssh.Context, ssh.PublicKey) bool

PubkeyAuth is a function that returns a function that can be used as a ssh.PublicKeyHandler We always return true so that the session handler can print a helpful error message to the user. The session handler must check the context for the error value and close the session if it is set.

Types

type KeyValueStore

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

KeyValueStore represents an in-memory key-value store.

func NewKeyValueStore

func NewKeyValueStore() *KeyValueStore

NewKeyValueStore creates a new instance of KeyValueStore.

func (*KeyValueStore) Delete

func (s *KeyValueStore) Delete(key string)

Delete removes a key-value pair from the store.

func (*KeyValueStore) Get

func (s *KeyValueStore) Get(key string) (*State, bool)

Get retrieves a value from the store by key.

func (*KeyValueStore) List

func (s *KeyValueStore) List() map[string]*State

List retrieves all key-value pairs from the store.

func (*KeyValueStore) Set

func (s *KeyValueStore) Set(key string, value *State)

Set adds or updates a key-value pair in the store.

type MultiWriter

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

MultiWriter is a writer that writes to multiple other writers.

func NewMultiWriter

func NewMultiWriter(writers ...io.Writer) *MultiWriter

NewMultiWriter creates a writer that duplicates its writes to all the provided writers, similar to the Unix tee(1) command. Writers can be added and removed dynamically after creation.

Each write is written to each listed writer, one at a time. If a listed writer returns an error, that overall write operation stops and returns the error; it does not continue down the list.

func (*MultiWriter) Add

func (mw *MultiWriter) Add(w io.Writer)

Add appends a writer to the list of writers this multiwriter writes to.

func (*MultiWriter) Remove

func (mw *MultiWriter) Remove(w io.Writer)

Remove will remove a previously added writer from the list of writers.

func (*MultiWriter) Write

func (mw *MultiWriter) Write(p []byte) (int, error)

Write writes some bytes to all the writers.

type Reader

type Reader interface {
	ReadBMCMachine(ctx context.Context, name string) (*data.BMCMachine, error)
}

type State

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

State is the internal State needed to track multiple sessions and provide a way to share stdin between sessions.

Jump to

Keyboard shortcuts

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