libvirtutils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MPL-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectByUri

func ConnectByUri(uri LibvirtUri) (*libvirt.Libvirt, error)

func ConnectByUriString

func ConnectByUriString(libvirtUri string) (*libvirt.Libvirt, error)

func DomainStateMeansStopped added in v0.2.0

func DomainStateMeansStopped(state libvirt.DomainState) (res bool)

func NewDialerFromLibvirtUri

func NewDialerFromLibvirtUri(uri LibvirtUri) (dialer socket.Dialer, err error)

func NewTcpDialer

func NewTcpDialer(uri LibvirtUri) (*dialers.Remote, error)

func NewUnixDialer

func NewUnixDialer(uri LibvirtUri) *dialers.Local

func PollDomainState added in v0.2.0

func PollDomainState(
	ctx context.Context,
	period time.Duration,
	driver libvirt.Libvirt,
	domain libvirt.Domain,
	result chan<- libvirt.DomainState,
	errs chan<- error,
)

Types

type LibvirtUri

type LibvirtUri struct {
	Driver    string
	Transport string
	Username  string
	Hostname  string
	Port      string
	Path      string
	// https://libvirt.org/uri.html#Remote_URI_parameters
	ExtraParams map[string]string
}

https://libvirt.org/uri.html driver[+transport]://[username@][hostname][:port]/path[?extraparameters]

func (*LibvirtUri) GetExtra

func (uri *LibvirtUri) GetExtra(p LibvirtUriExtraParam) (string, bool)

func (*LibvirtUri) Marshal

func (uri *LibvirtUri) Marshal() (result string)

func (*LibvirtUri) Name

func (uri *LibvirtUri) Name() (result string)

func (*LibvirtUri) Unmarshal

func (uri *LibvirtUri) Unmarshal(s string) error

type LibvirtUriExtraParam

type LibvirtUriExtraParam string
const (
	// (Any transport) The name passed to the remote virConnectOpen function.
	// The name is normally formed by removing transport, hostname, port number, username and extra parameters from the remote URI,
	// but in certain very complex cases it may be better to supply the name explicitly.
	LibvirtUriParam_Name LibvirtUriExtraParam = "name"
	// (TLS transport only) A valid GNUTLS priority string
	LibvirtUriParam_TlsPriority LibvirtUriExtraParam = "tls_priority"

	LibvirtUriParam_Mode   LibvirtUriExtraParam = "mode"
	LibvirtUriParam_Socket LibvirtUriExtraParam = "socket"
	// (SSH transport only)  The name of the private key file to use to authentication to the remote machine.
	LibvirtUriParam_Keyfile LibvirtUriExtraParam = "keyfile"
	// SSH: If set to a non-zero value, this disables client's strict host key checking making it auto-accept new host keys. Existing host keys will still be validated.
	// TLS: If set to a non-zero value, this disables client checks of the server's certificate. Note that to disable server checks of the client's certificate or IP address you must change the libvirtd configuration.
	LibvirtUriParam_NoVerify LibvirtUriExtraParam = "no_verify"
	// Path to the known_hosts file to verify the host key against.
	LibvirtUriParam_KnownHost LibvirtUriExtraParam = "known_hosts"
	// Specifies x509 certificates path for the client. If any of the CA certificate, client certificate, or client key is missing, the connection will fail with a fatal error.
	LibvirtUriParam_PkiPath LibvirtUriExtraParam = "pkipath"
)

A copy of https://libvirt.org/uri.html#Remote_URI_parameters. Only a handful of these implemented yet, and not all key or option might make sense in this setup

type SshDialer

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

func NewSshDialer

func NewSshDialer(uri LibvirtUri) (dialer *SshDialer, err error)

func (*SshDialer) Dial

func (dialer *SshDialer) Dial() (net.Conn, error)

type TlsDialer

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

func NewTlsDialer added in v0.3.2

func NewTlsDialer(uri LibvirtUri) (dialer *TlsDialer, err error)

func (*TlsDialer) Dial

func (dialer *TlsDialer) Dial() (net.Conn, error)

Jump to

Keyboard shortcuts

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