mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-18 20:34:35 -05:00
bd63aa3c6b
sed -i '1i/*\nCopyright (c) Edgeless Systems GmbH\n\nSPDX-License-Identifier: AGPL-3.0-only\n*/\n' `grep -rL --include='*.go' 'DO NOT EDIT'` gofumpt -w .
39 lines
666 B
Go
39 lines
666 B
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package virtwrapper
|
|
|
|
import "libvirt.org/go/libvirt"
|
|
|
|
type Connect struct {
|
|
Conn *libvirt.Connect
|
|
}
|
|
|
|
func (c *Connect) LookupNetworkByName(name string) (*Network, error) {
|
|
net, err := c.Conn.LookupNetworkByName(name)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &Network{Net: net}, nil
|
|
}
|
|
|
|
type Network struct {
|
|
Net virNetwork
|
|
}
|
|
|
|
func (n *Network) GetDHCPLeases() ([]libvirt.NetworkDHCPLease, error) {
|
|
return n.Net.GetDHCPLeases()
|
|
}
|
|
|
|
func (n *Network) Free() {
|
|
_ = n.Net.Free()
|
|
}
|
|
|
|
type virNetwork interface {
|
|
GetDHCPLeases() ([]libvirt.NetworkDHCPLease, error)
|
|
Free() error
|
|
}
|