コード例 #1
0
ファイル: libvirt.go プロジェクト: ericcapricorn/flynn
func (c *VirConnection) IsSecure() (bool, error) {
	result := C.virConnectIsSecure(c.ptr)
	if result == -1 {
		return false, GetLastError()
	}
	if result == 1 {
		return true, nil
	}
	return false, nil
}
コード例 #2
0
ファイル: hypervisor.go プロジェクト: hooklift/golibvirt
func (h *Hypervisor) IsConnectionSecure() (bool, error) {
	result := C.virConnectIsSecure(h.cptr)

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

	if result == 1 {
		return true, nil
	}

	return false, nil
}
コード例 #3
0
// IsSecure determines if the connection to the hypervisor is secure.
// If an error occurs, the function will also return "false" and the error
// message will be written to the log.
func (conn Connection) IsSecure() (bool, error) {
	conn.log.Println("checking whether connection is secure...")
	cRet := C.virConnectIsSecure(conn.virConnect)
	ret := int32(cRet)

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

	secure := (ret == 1)

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

	return secure, nil
}