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)
}
