go-ipmi

module
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0

README

go-ipmi

Native Go implementation of IPMI. It does not shell out to ipmitool.

The library provides an IPMI client (remote and in-band) and a reference IPMI server (BMC) for local development and tests, plus the protocol types they share. Public APIs live under pkg/. To use the client, start with pkg/client.

Compatibility

This module has not reached v1.0.0. The public API may change between versions, including renamed packages, types, functions, and constants. Pin to a specific version or commit for production use.

v0 releases carry no backward-compatibility promise, per the Go module versioning convention.

Install

go get github.com/bougou/go-ipmi

Client

package main

import (
	"context"
	"fmt"

	"github.com/bougou/go-ipmi/pkg/client"
)

func main() {
	c, err := client.NewClient("10.0.0.1", 623, "root", "123456")
	if err != nil {
		panic(err)
	}
	// c.WithInterface(client.InterfaceLan) // IPMI v1.5; default is lanplus (v2.0)
	// openClient, err := client.NewOpenClient() // in-band on Linux / Windows

	ctx := context.Background()
	if err := c.Connect(ctx); err != nil {
		panic(err)
	}
	defer c.Close(ctx)

	res, err := c.GetDeviceID(ctx)
	if err != nil {
		panic(err)
	}
	fmt.Println(res.Format())
}

Interfaces, options, and helpers: docs/client.md. Import path changes since v0.8.x: docs/migration.md.

Server

goipmi-server is a dual-stack reference BMC (RMCP+ and IPMI v1.5 on one UDP port). Build with make build, then run _output/goipmi-server. Defaults are user/password ADMIN/ADMIN on port 623.

Embedding the same stack in-process is described in docs/server.md.

Tools

make build
./_output/goipmi -I lanplus -H <bmc> -U <user> -P <pass> mc info
./_output/goipmi-server

goipmi mirrors common ipmitool subcommands so the library can be exercised against real BMCs. It is a verification front-end, not a drop-in replacement.

Docs

Specs

Checked-in copies (including IPMI v1.5) are under specs/.

Directories

Path Synopsis
cmd
goipmi command
goipmi-server command
goipmi-server is a reference IPMI BMC server for development and E2E testing.
goipmi-server is a reference IPMI BMC server for development and E2E testing.
goipmi-vmprobe command
goipmi-vmprobe is a minimal OpenIPMI VM protocol client for development and E2E testing: it connects to a stream socket served by goipmi-server's VM protocol mode (GOIPMI_SERVER_VM_SOCKET), sends one IPMI command, and reports the completion code and response.
goipmi-vmprobe is a minimal OpenIPMI VM protocol client for development and E2E testing: it connects to a stream socket served by goipmi-server's VM protocol mode (GOIPMI_SERVER_VM_SOCKET), sends one IPMI command, and reports the completion code and response.
pkg
bmc
Package bmc holds the runtime state of a Baseboard Management Controller.
Package bmc holds the runtime state of a Baseboard Management Controller.
clock
Package clock abstracts time so that embedded targets can inject a hardware RTC or monotonic counter, and tests can use a deterministic fake clock.
Package clock abstracts time so that embedded targets can inject a hardware RTC or monotonic counter, and tests can use a deterministic fake clock.
hal
Package hal defines the Hardware Abstraction Layer interfaces for an IPMI BMC.
Package hal defines the Hardware Abstraction Layer interfaces for an IPMI BMC.
hal/mock
Package mock provides in-memory hal.HAL implementations for use in tests and simulation environments.
Package mock provides in-memory hal.HAL implementations for use in tests and simulation environments.
handlers
Package handlers provides the IPMI command dispatch infrastructure and a set of default BMC command handlers.
Package handlers provides the IPMI command dispatch infrastructure and a set of default BMC command handlers.
open
Package open provides in-band (System Interface) access to a local BMC.
Package open provides in-band (System Interface) access to a local BMC.
protocol
Package protocol provides IPMI wire-format framing shared by both client and server: IPMB checksums, LAN message assembly/disassembly, and RMCP+ packet building.
Package protocol provides IPMI wire-format framing shared by both client and server: IPMB checksums, LAN message assembly/disassembly, and RMCP+ packet building.
transport
Package transport defines the network transport interfaces used by the IPMI server.
Package transport defines the network transport interfaces used by the IPMI server.
transport/udp
Package udp provides a [transport.PacketConn] backed by a standard UDP socket.
Package udp provides a [transport.PacketConn] backed by a standard UDP socket.
utils/md2
Package md2 implements the MD2 hash algorithm as defined in RFC 1319.
Package md2 implements the MD2 hash algorithm as defined in RFC 1319.
vmproto
Package vmproto implements a BMC server frontend that speaks QEMU's OpenIPMI VM protocol (the ipmi-bmc-extern wire format), a sibling to the RMCP+ UDP server in pkg/server.
Package vmproto implements a BMC server frontend that speaks QEMU's OpenIPMI VM protocol (the ipmi-bmc-extern wire format), a sibling to the RMCP+ UDP server in pkg/server.

Jump to

Keyboard shortcuts

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