irsdk-go

module
v0.0.0-...-08f7386 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: BSD-3-Clause

README

irsdk in Go

This is a port of the iRacing sdk to Go. The iRacing sdk logic is ported and slightly modified to make it a bit more go-y.

The initial idea for porting it to go was to make it compatible with the Linux version of iRacing (which runs under wine / CrossOver). I choose Go because of the (small) cross-platform standalone binaries without dependencies on a third-party frameworks (.Net).

This doesn't mean it's Linux only. Go runs fine on Windows and this library should work fine on Windows (not tested).

Installation

Windows
go get github.com/LeonB/irsdk-go
Linux
GOARCH=386 GOOS=windows go get github.com/LeonB/irsdk-go

Example

package main

import (
	"fmt"
	"log"

	irsdk "github.com/leonb/irsdk-go"
)

func main() {
	conn, err := irsdk.NewConnection()
	if err != nil {
		log.Fatal(err)
	}

	err = conn.Connect()
	if err != nil {
		log.Fatal(err)
	}

	fields := []string{}

	for {
		telemetryData, err := conn.GetTelemetryDataFiltered(fields)
		if err != nil {
			log.Println(err)
		}

		fmt.Printf("%+v\n", telemetryData)
	}
}

Terminalhud

This repository contains a sample program terminalhud:

iRacing Terminalhud

Known bugs / pitfalls

  • When running it under wine, Go time functions do not work: go-nuts thread / wine bug
  • broadcastmsg doesn't work (no idea why)

Inspiration

Directories

Path Synopsis
cmd
internal
shm
pkg
sdk

Jump to

Keyboard shortcuts

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