Skip to content

sewiti/virt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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