Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 722 Bytes

README.md

File metadata and controls

35 lines (24 loc) · 722 Bytes

virt

Go Reference

Package virt is a library that helps detect if application is running in a virtual machine, container or bare-metal.

It depends on klauspost/cpuid library for getting low-level CPU flags.

Detection mechanism is based on the checks in chuckleb/virt-what.

Install

go get -u github.com/sewiti/virt

Usage Example

package main

import (
	"fmt"

	"github.com/sewiti/virt"
)

func main() {
	fmt.Println("Virtual machine: ", virt.IsVM())
	fmt.Println("Container:       ", virt.IsContainer())
}