compute/pkg/libvirt/libvirt.go
2025-03-01 18:41:36 +01:00

19 lines
355 B
Go

package libvirt
import (
"fmt"
go_libvirt "libvirt.org/go/libvirt"
)
func New(address string, tls bool) (*go_libvirt.Connect, error) {
var libvirt_uri string
if tls {
libvirt_uri = fmt.Sprintf("qemu+tls://%s/system", address)
} else {
libvirt_uri = fmt.Sprintf("qemu+tcp://%s/system", address)
}
return go_libvirt.NewConnect(libvirt_uri)
}