util

package
v0.0.0-...-08cf857 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorContainerNameNotFound = errors.New("container name not found")
View Source
var Logger *logrus.Logger

Functions

func BuildFishler

func BuildFishler(client *client.Client, ctx context.Context, forceBuild bool) error

func ByteCountDecimal

func ByteCountDecimal(b int64) string

func CleanIfContainerExists

func CleanIfContainerExists(ctx context.Context, client *client.Client, containerID string) error

func CreateRunWaitSSHContainer

func CreateRunWaitSSHContainer(createCfg *container.Config, hostCfg *container.HostConfig, networkCfg *network.NetworkingConfig, sess ssh.Session) (exitCode int64, cleanup func(), err error)

func GetContainerName

func GetContainerName(remoteIP string) string

func GetDockerImage

func GetDockerImage(client *client.Client, ctx context.Context) ([]image.Summary, error)

func GetFishlerPrivateKey

func GetFishlerPrivateKey() (string, error)

func GetFishlerPrivateKeyPath

func GetFishlerPrivateKeyPath() string

func GetKeySigner

func GetKeySigner() (gossh.Signer, error)

func GetProfileBuffer

func GetProfileBuffer(username string) ([]byte, error)

func GetSessionFileName

func GetSessionFileName(basepath string, containerID string, sessionRemoteAddress net.Addr) string

func GetSessionVolumnDirectory

func GetSessionVolumnDirectory(basepath string, directory string, sessionRemoteAddress net.Addr) string

func SetLogger

func SetLogger(filepath string) *logrus.Logger

func Wrap

func Wrap(c net.Conn, onHASSH func(string)) net.Conn

Wrap wraps an existing net.Conn so that the first SSH_MSG_KEXINIT from the client is parsed and a HASSH fingerprint string is sent to the OnHASSH callback.

Types

type Conn

type Conn struct {
	net.Conn

	OnHASSH func(string)
	// contains filtered or unexported fields
}

Conn wraps a net.Conn and parses SSH packet framing to extract SSH_MSG_KEXINIT

func (*Conn) Read

func (c *Conn) Read(p []byte) (int, error)

type FormatterHook

type FormatterHook struct {
	Writer    io.Writer
	LogLevels []logrus.Level
	Formatter logrus.Formatter
}

FormatterHook is a hook that writes logs of specified LogLevels with a formatter to specified Writer

func (*FormatterHook) Fire

func (hook *FormatterHook) Fire(entry *logrus.Entry) error

Fire will be called when some logging function is called with current hook It will format log entry and write it to appropriate writer

func (*FormatterHook) Levels

func (hook *FormatterHook) Levels() []logrus.Level

Levels define on which log levels this hook would trigger

type HASSHListener

type HASSHListener struct {
	net.Listener
}

func (*HASSHListener) Accept

func (hl *HASSHListener) Accept() (net.Conn, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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