Ejemplo n.º 1
0
func (c *VirConnection) IsEncrypted() (bool, error) {
	result := C.virConnectIsEncrypted(c.ptr)
	if result == -1 {
		return false, GetLastError()
	}
	if result == 1 {
		return true, nil
	}
	return false, nil
}
Ejemplo n.º 2
0
func (h *Hypervisor) IsConnectionEncrypted() (bool, error) {
	result := C.virConnectIsEncrypted(h.cptr)

	if result == -1 {
		return false, GetLastError()
	}

	if result == 1 {
		return true, nil
	}

	return false, nil
}
Ejemplo n.º 3
0
// IsEncrypted determines if the connection to the hypervisor is encrypted.
// If an error occurs, the function will also return "false" and the error
// message will be written to the log.
func (conn Connection) IsEncrypted() (bool, error) {
	conn.log.Println("checking whether connection is encrypted...")
	cRet := C.virConnectIsEncrypted(conn.virConnect)
	ret := int32(cRet)

	if ret == -1 {
		err := LastError()
		conn.log.Printf("an error occurred: %v\n", err)
		return false, err
	}

	encrypted := (ret == 1)

	if encrypted {
		conn.log.Println("connection is encrypted")
	} else {
		conn.log.Println("connection is not encrypted")
	}

	return encrypted, nil
}