Skip to content

Latest commit

 

History

History
93 lines (67 loc) · 1.76 KB

README.md

File metadata and controls

93 lines (67 loc) · 1.76 KB

CodeFactor

War Telemetry

drawing

A simple library to get WarThunder data provided by the localhost server

Usage

Installation

go get -u github.com/lucasvmx/WarTelemetry/telemetry

Example (Remote host)

package main

import (
	"log"
	"time"

	"github.com/lucasvmx/WarTelemetry/logger"
	wartelemetry "github.com/lucasvmx/WarTelemetry/telemetry"
)

func main() {
	// Use this to collect data from remote computer
	wartelemetry.InitializeRemote("192.168.1.35")

	// Enable internal debug logging (disabled by default)
	logger.EnableDebug()

	for {

		data, err := wartelemetry.GetTelemetryData()
		if err != nil {
			log.Printf("failed to collect data: %v", err)
			time.Sleep(time.Second * 3)
			continue
		} else {
			log.Printf("Aircraft Name: %v", data.Indicators.AircraftName)
		}
	}
}

Example (Localhost)

package main

import (
	"log"
	"time"

	"github.com/lucasvmx/WarTelemetry/logger"
	wartelemetry "github.com/lucasvmx/WarTelemetry/telemetry"
)

func main() {
	// Use this for localhost
	wartelemetry.InitializeLocalHost()

	// Enable internal debug logging (disabled by default)
	logger.EnableDebug()

	for {

		data, err := wartelemetry.GetTelemetryData()
		if err != nil {
			log.Printf("failed to collect data: %v", err)
			time.Sleep(time.Second * 3)
			continue
		} else {
			log.Printf("Aircraft Name: %v", data.Indicators.AircraftName)
		}
	}
}

Build program

go build

Thanks