simulator

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package simulator runs the official BitBox02 Linux simulator binary and returns a ready-to-use firmware.Communication.

The simulator is Linux/amd64 only. On other platforms Launch reports ErrUnsupportedPlatform and tests should t.Skip.

Index

Constants

View Source
const Port = 15423

Port is the TCP port the BitBox02 simulator listens on once started.

Variables

View Source
var ErrUnsupportedPlatform = errors.New("bitbox/simulator: requires linux/amd64")

ErrUnsupportedPlatform indicates the host cannot run the BitBox02 simulator binary.

Functions

func Simulators

func Simulators() []coresim.Binary

Simulators returns the embedded list of BitBox02 simulator binaries the testkit knows about, sorted newest-first. Mirrors upstream's api/firmware/testdata/simulators.json.

Override the list at runtime by setting the BITBOX_SIMULATOR env var to an absolute path; Launch will use that instead.

Types

type Instance

type Instance struct {
	Process *coresim.Process
	Conn    net.Conn
	Comm    firmware.Communication
}

Instance is a running BitBox02 simulator with an attached client.

func Launch

func Launch(cacheDir string) (*Instance, error)

Launch downloads (if needed) and starts the newest known simulator, connects via TCP, and returns an Instance ready for use with firmware.NewDevice.

cacheDir is where downloaded binaries live; reuse it across tests to avoid re-downloading.

func (*Instance) Stop

func (i *Instance) Stop()

Stop tears down the connection and kills the simulator subprocess.

Jump to

Keyboard shortcuts

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