service

package
v0.0.0-...-59e65ba Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchUnitPatterns

func MatchUnitPatterns(patterns []string, units []dbus.UnitStatus) ([]dbus.UnitStatus, error)

MatchUnitPatterns returns a list of units that match the pattern list. This algo, including filepath.Match, is designed to (somewhat) emulate the behavior of ListUnitsByPatterns, which uses `fnmatch`.

Types

type DBusTunnel

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

DBusTunnel makes a tunnel socket->local-tcp

func NewDBusTunnel

func NewDBusTunnel(ctx context.Context, tunnelConfig DBusTunnelConfig) (*DBusTunnel, error)

NewDBusTunnel creates dbus socket tunnel

func (*DBusTunnel) Close

func (t *DBusTunnel) Close() error

Close terminates ssh tunnel

func (*DBusTunnel) New

func (t *DBusTunnel) New() (*systemdDBus.Conn, error)

New makes d-bus connection to remote systemd

func (*DBusTunnel) NewDBusConn

func (t *DBusTunnel) NewDBusConn(opts ...dbus.ConnOption) (*dbus.Conn, error)

NewDBusConn makes raw d-bus connection to the remote systemd

type DBusTunnelConfig

type DBusTunnelConfig struct {
	User         string
	SSHHost      string
	SSHPort      int
	RemoteSocket string
	SSHVerbose   bool
}

DBusTunnelConfig stores config

type UnitFetcher

type UnitFetcher func(ctx context.Context, conn *dbus.Conn, states, patterns []string) ([]dbus.UnitStatus, error)

UnitFetcher a unit retrieval method

func InstrospectForUnitMethods

func InstrospectForUnitMethods(conn *dbusRaw.Conn) (UnitFetcher, error)

InstrospectForUnitMethods determines what methods are available via dbus for listing systemd units. We have a number of functions, some better than others, for getting and filtering unit lists. This will attempt to find the most optimal method, and move down to methods that require more work.

Jump to

Keyboard shortcuts

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