mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
Document exported funcs,types,interfaces and enable check. (#475)
* Include EXC0014 and fix issues. * Include EXC0012 and fix issues. Signed-off-by: Fabian Kammel <fk@edgeless.systems> Co-authored-by: Otto Bittner <cobittner@posteo.net>
This commit is contained in:
parent
c9873f2bfb
commit
0d12e37c96
74 changed files with 337 additions and 78 deletions
|
@ -21,12 +21,14 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Server that provides QEMU metadata.
|
||||
type Server struct {
|
||||
log *logger.Logger
|
||||
virt virConnect
|
||||
network string
|
||||
}
|
||||
|
||||
// New creates a new Server.
|
||||
func New(log *logger.Logger, network string, conn virConnect) *Server {
|
||||
return &Server{
|
||||
log: log,
|
||||
|
@ -35,6 +37,7 @@ func New(log *logger.Logger, network string, conn virConnect) *Server {
|
|||
}
|
||||
}
|
||||
|
||||
// ListenAndServe on a given port.
|
||||
func (s *Server) ListenAndServe(port string) error {
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/self", http.HandlerFunc(s.listSelf))
|
||||
|
|
|
@ -8,10 +8,12 @@ package virtwrapper
|
|||
|
||||
import "libvirt.org/go/libvirt"
|
||||
|
||||
// Connect wraps a libvirt connection.
|
||||
type Connect struct {
|
||||
Conn *libvirt.Connect
|
||||
}
|
||||
|
||||
// LookupNetworkByName looks up a network by name.
|
||||
func (c *Connect) LookupNetworkByName(name string) (*Network, error) {
|
||||
net, err := c.Conn.LookupNetworkByName(name)
|
||||
if err != nil {
|
||||
|
@ -20,14 +22,17 @@ func (c *Connect) LookupNetworkByName(name string) (*Network, error) {
|
|||
return &Network{Net: net}, nil
|
||||
}
|
||||
|
||||
// Network wraps a libvirt network.
|
||||
type Network struct {
|
||||
Net virNetwork
|
||||
}
|
||||
|
||||
// GetDHCPLeases returns the underlying DHCP leases.
|
||||
func (n *Network) GetDHCPLeases() ([]libvirt.NetworkDHCPLease, error) {
|
||||
return n.Net.GetDHCPLeases()
|
||||
}
|
||||
|
||||
// Free the network resource.
|
||||
func (n *Network) Free() {
|
||||
_ = n.Net.Free()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue