platform

package
v0.46.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package platform regroups collecting information about the platform

Index

Constants

View Source
const (
	// SV_TYPE_WORKSTATION is for all workstations.
	SV_TYPE_WORKSTATION = uint32(0x00000001)
	// SV_TYPE_SERVER is for all computers that run the Server service.
	SV_TYPE_SERVER = uint32(0x00000002)
	// SV_TYPE_SQLSERVER is for any server that runs an instance of Microsoft SQL Server.
	SV_TYPE_SQLSERVER = uint32(0x00000004)
	// SV_TYPE_DOMAIN_CTRL is for a server that is primary domain controller.
	SV_TYPE_DOMAIN_CTRL = uint32(0x00000008)
	// SV_TYPE_DOMAIN_BAKCTRL is for any server that is a backup domain controller.
	SV_TYPE_DOMAIN_BAKCTRL = uint32(0x00000010)
	// SV_TYPE_TIME_SOURCE is for any server that runs the Timesource service.
	SV_TYPE_TIME_SOURCE = uint32(0x00000020)
	// SV_TYPE_AFP is for any server that runs the Apple Filing Protocol (AFP) file service.
	SV_TYPE_AFP = uint32(0x00000040)
	// SV_TYPE_NOVELL is for any server that is a Novell server.
	SV_TYPE_NOVELL = uint32(0x00000080)
	// SV_TYPE_DOMAIN_MEMBER is for any computer that is LAN Manager 2.x domain member.
	SV_TYPE_DOMAIN_MEMBER = uint32(0x00000100)
	// SV_TYPE_PRINTQ_SERVER is for any computer that shares a print queue.
	SV_TYPE_PRINTQ_SERVER = uint32(0x00000200)
	// SV_TYPE_DIALIN_SERVER is for any server that runs a dial-in service.
	SV_TYPE_DIALIN_SERVER = uint32(0x00000400)
	// SV_TYPE_XENIX_SERVER is for any server that is a Xenix server.
	SV_TYPE_XENIX_SERVER = uint32(0x00000800)
	// SV_TYPE_SERVER_UNIX is for any server that is a UNIX server. This is the same as the SV_TYPE_XENIX_SERVER.
	SV_TYPE_SERVER_UNIX = SV_TYPE_XENIX_SERVER
	// SV_TYPE_NT is for a workstation or server.
	SV_TYPE_NT = uint32(0x00001000)
	// SV_TYPE_WFW is for any computer that runs Windows for Workgroups.
	SV_TYPE_WFW = uint32(0x00002000)
	// SV_TYPE_SERVER_MFPN is for any server that runs the Microsoft File and Print for NetWare service.
	SV_TYPE_SERVER_MFPN = uint32(0x00004000)
	// SV_TYPE_SERVER_NT is for any server that is not a domain controller.
	SV_TYPE_SERVER_NT = uint32(0x00008000)
	// SV_TYPE_POTENTIAL_BROWSER is for any computer that can run the browser service.
	SV_TYPE_POTENTIAL_BROWSER = uint32(0x00010000)
	// SV_TYPE_BACKUP_BROWSER is for a computer that runs a browser service as backup.
	SV_TYPE_BACKUP_BROWSER = uint32(0x00020000)
	// SV_TYPE_MASTER_BROWSER is for a computer that runs the master browser service.
	SV_TYPE_MASTER_BROWSER = uint32(0x00040000)
	// SV_TYPE_DOMAIN_MASTER is for a computer that runs the domain master browser.
	SV_TYPE_DOMAIN_MASTER = uint32(0x00080000)
	// SV_TYPE_SERVER_OSF is for a computer that runs OSF/1.
	SV_TYPE_SERVER_OSF = uint32(0x00100000)
	// SV_TYPE_SERVER_VMS is for a computer that runs Open Virtual Memory System (VMS).
	SV_TYPE_SERVER_VMS = uint32(0x00200000)
	// SV_TYPE_WINDOWS is for a computer that runs Windows.
	SV_TYPE_WINDOWS = uint32(0x00400000) /* Windows95 and above */
	// SV_TYPE_DFS is for a computer that is the root of Distributed File System (DFS) tree.
	SV_TYPE_DFS = uint32(0x00800000)
	// SV_TYPE_CLUSTER_NT is for server clusters available in the domain.
	SV_TYPE_CLUSTER_NT = uint32(0x01000000)
	// SV_TYPE_TERMINALSERVER is for a server running the Terminal Server service.
	SV_TYPE_TERMINALSERVER = uint32(0x02000000)
	// SV_TYPE_CLUSTER_VS_NT is for cluster virtual servers available in the domain.
	SV_TYPE_CLUSTER_VS_NT = uint32(0x04000000)
	// SV_TYPE_DCE is for a computer that runs IBM Directory and Security Services (DSS) or equivalent.
	SV_TYPE_DCE = uint32(0x10000000)
	// SV_TYPE_ALTERNATE_XPORT is for a computer that over an alternate transport.
	SV_TYPE_ALTERNATE_XPORT = uint32(0x20000000)
	// SV_TYPE_LOCAL_LIST_ONLY is for any computer maintained in a list by the browser. See the following Remarks section.
	SV_TYPE_LOCAL_LIST_ONLY = uint32(0x40000000)
	// SV_TYPE_DOMAIN_ENUM is for the primary domain.
	SV_TYPE_DOMAIN_ENUM = uint32(0x80000000)
	// SV_TYPE_ALL is for all servers. This is a convenience that will return all possible servers
	SV_TYPE_ALL = uint32(0xFFFFFFFF) /* handy for NetServerEnum2 */
)

see https://learn.microsoft.com/en-us/windows/win32/api/lmserver/nf-lmserver-netserverenum

View Source
const (
	IMAGE_FILE_MACHINE_UNKNOWN     = uint16(0x0)
	IMAGE_FILE_MACHINE_TARGET_HOST = uint16(0x0001) // Useful for indicating we want to interact with the host and not a WoW guest.  Win10/2016 and above only
	IMAGE_FILE_MACHINE_I386        = uint16(0x014c) // Intel 386.
	IMAGE_FILE_MACHINE_R3000       = uint16(0x0162) // MIPS little-endian, = uint16(0x160 big-endian
	IMAGE_FILE_MACHINE_R4000       = uint16(0x0166) // MIPS little-endian
	IMAGE_FILE_MACHINE_R10000      = uint16(0x0168) // MIPS little-endian
	IMAGE_FILE_MACHINE_WCEMIPSV2   = uint16(0x0169) // MIPS little-endian WCE v2
	IMAGE_FILE_MACHINE_ALPHA       = uint16(0x0184) // Alpha_AXP
	IMAGE_FILE_MACHINE_SH3         = uint16(0x01a2) // SH3 little-endian
	IMAGE_FILE_MACHINE_SH3DSP      = uint16(0x01a3)
	IMAGE_FILE_MACHINE_SH3E        = uint16(0x01a4) // SH3E little-endian
	IMAGE_FILE_MACHINE_SH4         = uint16(0x01a6) // SH4 little-endian
	IMAGE_FILE_MACHINE_SH5         = uint16(0x01a8) // SH5
	IMAGE_FILE_MACHINE_ARM         = uint16(0x01c0) // ARM Little-Endian
	IMAGE_FILE_MACHINE_THUMB       = uint16(0x01c2) // ARM Thumb/Thumb-2 Little-Endian
	IMAGE_FILE_MACHINE_ARMNT       = uint16(0x01c4) // ARM Thumb-2 Little-Endian
	IMAGE_FILE_MACHINE_AM33        = uint16(0x01d3)
	IMAGE_FILE_MACHINE_POWERPC     = uint16(0x01F0) // IBM PowerPC Little-Endian
	IMAGE_FILE_MACHINE_POWERPCFP   = uint16(0x01f1)
	IMAGE_FILE_MACHINE_IA64        = uint16(0x0200) // Intel 64
	IMAGE_FILE_MACHINE_MIPS16      = uint16(0x0266) // MIPS
	IMAGE_FILE_MACHINE_ALPHA64     = uint16(0x0284) // ALPHA64
	IMAGE_FILE_MACHINE_MIPSFPU     = uint16(0x0366) // MIPS
	IMAGE_FILE_MACHINE_MIPSFPU16   = uint16(0x0466) // MIPS
	IMAGE_FILE_MACHINE_AXP64       = IMAGE_FILE_MACHINE_ALPHA64
	IMAGE_FILE_MACHINE_TRICORE     = uint16(0x0520) // Infineon
	IMAGE_FILE_MACHINE_CEF         = uint16(0x0CEF)
	IMAGE_FILE_MACHINE_EBC         = uint16(0x0EBC) // EFI Byte Code
	IMAGE_FILE_MACHINE_AMD64       = uint16(0x8664) // AMD64 (K8)
	IMAGE_FILE_MACHINE_M32R        = uint16(0x9041) // M32R little-endian
	IMAGE_FILE_MACHINE_ARM64       = uint16(0xAA64) // ARM64 Little-Endian
	IMAGE_FILE_MACHINE_CEE         = uint16(0xC0EE)
)

Variables

View Source
var (

	// ERROR_SUCCESS is the error returned in case of success
	//
	//nolint:revive
	ERROR_SUCCESS syscall.Errno
)

Functions

func GetArchInfo

func GetArchInfo() (map[string]string, error)

GetArchInfo returns basic host architecture information

Types

type OSVERSIONINFOEXW

type OSVERSIONINFOEXW struct {
	// contains filtered or unexported fields
}

OSVERSIONINFOEXW contains operating system version information. From winnt.h (see https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexw) This is used by https://docs.microsoft.com/en-us/windows/win32/devnotes/rtlgetversion

type Platform

type Platform struct {
	// GoVersion is the golang version.
	GoVersion string
	// GoOS is equal to "runtime.GOOS"
	GoOS string
	// GoArch is equal to "runtime.GOARCH"
	GoArch string

	// KernelName is the kernel name (ex:  "windows", "Linux", ...)
	KernelName string
	// KernelRelease the kernel release (ex: "10.0.20348", "4.15.0-1080-gcp", ...)
	KernelRelease string
	// Hostname is the hostname for the host
	Hostname string
	// Machine the architecture for the host (is: x86_64 vs arm).
	Machine string
	// OS is the os name description (ex: "GNU/Linux", "Windows Server 2022 Datacenter", ...)
	OS string

	// Family is the OS family (Windows only)
	Family string

	// KernelVersion the kernel version, Unix only
	KernelVersion string
	// Processor is the processor type, Unix only (ex "x86_64", "arm", ...)
	Processor string
	// HardwarePlatform is the hardware name, Linux only (ex "x86_64")
	HardwarePlatform string
}

Platform holds metadata about the host

func Get

func Get() (*Platform, []string, error)

Get returns a Platform struct already initialized, a list of warnings and an error. The method will try to collect as much metadata as possible, an error is returned if nothing could be collected. The list of warnings contains errors if some metadata could not be collected.

func (*Platform) Collect

func (platform *Platform) Collect() (result interface{}, err error)

Collect collects the Platform information. Returns an object which can be converted to a JSON or an error if nothing could be collected. Tries to collect as much information as possible.

func (*Platform) Name

func (platform *Platform) Name() string

Name returns the name of the package

type SERVER_INFO_101

type SERVER_INFO_101 struct {
	// contains filtered or unexported fields
}

SERVER_INFO_101 contains server-specific information see https://learn.microsoft.com/en-us/windows/win32/api/lmserver/ns-lmserver-server_info_101

type WKSTA_INFO_100

type WKSTA_INFO_100 struct {
	// contains filtered or unexported fields
}

WKSTA_INFO_100 contains platform-specific information see https://learn.microsoft.com/en-us/windows/win32/api/lmwksta/ns-lmwksta-wksta_info_100

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL