udp

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Receive
	EventCollisionWithCar Event = 10
	EventCollisionWithEnv Event = 11
	EventNewSession       Event = 50
	EventNewConnection    Event = 51
	EventConnectionClosed Event = 52
	EventCarUpdate        Event = 53
	EventCarInfo          Event = 54
	EventEndSession       Event = 55
	EventVersion          Event = 56
	EventChat             Event = 57
	EventClientLoaded     Event = 58
	EventSessionInfo      Event = 59
	EventError            Event = 60
	EventLapCompleted     Event = 73
	EventClientEvent      Event = 130

	// Send
	EventRealtimeposInterval Event = 200
	EventGetCarInfo          Event = 201
	EventSendChat            Event = 202
	EventBroadcastChat       Event = 203
	EventGetSessionInfo      Event = 204
	EventSetSessionInfo      Event = 205
	EventKickUser            Event = 206
	EventNextSession         Event = 207
	EventRestartSession      Event = 208
	EventAdminCommand        Event = 209

	SessionTypeRace       SessionType = 3
	SessionTypeQualifying SessionType = 2
	SessionTypePractice   SessionType = 1
	SessionTypeBooking    SessionType = 0
)

Variables

View Source
var CurrentRealtimePosIntervalMs = -1
View Source
var RealtimePosIntervalMs = -1

RealtimePosIntervalMs is the interval to request real time positional information. Set this to greater than 0 to enable.

Functions

This section is empty.

Types

type AdminCommand added in v1.5.0

type AdminCommand struct {
	EventType    uint8
	Len          uint8
	UTF32Encoded []byte
}

func NewAdminCommand added in v1.5.0

func NewAdminCommand(data string) (*AdminCommand, error)

func (AdminCommand) Event added in v1.5.0

func (AdminCommand) Event() Event

type AssettoServerUDP

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

func NewServerClient

func NewServerClient(addr string, receivePort, sendPort int, forward bool, forwardAddrStr string, forwardListenPort int, callback CallbackFunc) (*AssettoServerUDP, error)

func (*AssettoServerUDP) Close

func (asu *AssettoServerUDP) Close() error

func (*AssettoServerUDP) SendMessage added in v1.1.0

func (asu *AssettoServerUDP) SendMessage(message Message) error

type BroadcastChat added in v1.5.0

type BroadcastChat struct {
	EventType    uint8
	Len          uint8
	UTF32Encoded []byte
}

func NewBroadcastChat added in v1.5.0

func NewBroadcastChat(data string) (*BroadcastChat, error)

func (BroadcastChat) Event added in v1.5.0

func (BroadcastChat) Event() Event

type CallbackFunc

type CallbackFunc func(response Message)

type CarID

type CarID uint8

type CarInfo

type CarInfo struct {
	CarID       CarID      `json:"CarID"`
	IsConnected bool       `json:"IsConnected"`
	CarModel    string     `json:"CarModel"`
	CarSkin     string     `json:"CarSkin"`
	DriverName  string     `json:"DriverName"`
	DriverTeam  string     `json:"DriverTeam"`
	DriverGUID  DriverGUID `json:"DriverGUID"`
}

func (CarInfo) Event

func (CarInfo) Event() Event

type CarUpdate

type CarUpdate struct {
	CarID               CarID   `json:"CarID"`
	Pos                 Vec     `json:"Pos"`
	Velocity            Vec     `json:"Velocity"`
	Gear                uint8   `json:"Gear"`
	EngineRPM           uint16  `json:"EngineRPM"`
	NormalisedSplinePos float32 `json:"NormalisedSplinePos"`
}

func (CarUpdate) Event

func (CarUpdate) Event() Event

type Chat

type Chat struct {
	CarID   CarID  `json:"CarID"`
	Message string `json:"Message"`
}

func (Chat) Event

func (Chat) Event() Event

type ClientLoaded

type ClientLoaded CarID

func (ClientLoaded) Event

func (ClientLoaded) Event() Event

type CollisionWithCar

type CollisionWithCar struct {
	CarID       CarID   `json:"CarID"`
	OtherCarID  CarID   `json:"OtherCarID"`
	ImpactSpeed float32 `json:"ImpactSpeed"`
	WorldPos    Vec     `json:"WorldPos"`
	RelPos      Vec     `json:"RelPos"`
}

func (CollisionWithCar) Event

func (CollisionWithCar) Event() Event

type CollisionWithEnvironment

type CollisionWithEnvironment struct {
	CarID       CarID   `json:"CarID"`
	ImpactSpeed float32 `json:"ImpactSpeed"`
	WorldPos    Vec     `json:"WorldPos"`
	RelPos      Vec     `json:"RelPos"`
}

func (CollisionWithEnvironment) Event

type DriverGUID added in v1.3.3

type DriverGUID string

type EnableRealtimePosInterval added in v1.1.0

type EnableRealtimePosInterval struct {
	Type     uint8
	Interval uint16
}

func NewEnableRealtimePosInterval added in v1.1.0

func NewEnableRealtimePosInterval(interval int) EnableRealtimePosInterval

func (EnableRealtimePosInterval) Event added in v1.1.0

type EndSession

type EndSession string

func (EndSession) Event

func (EndSession) Event() Event

type Event

type Event uint8

type GetSessionInfo added in v1.2.0

type GetSessionInfo struct {
}

func (GetSessionInfo) Event added in v1.2.0

func (GetSessionInfo) Event() Event

type KickUser added in v1.5.0

type KickUser struct {
	EventType uint8
	CarID     uint8
}

func NewKickUser added in v1.5.0

func NewKickUser(carID uint8) *KickUser

func (KickUser) Event added in v1.5.0

func (KickUser) Event() Event

type LapCompleted

type LapCompleted struct {
	CarID     CarID  `json:"CarID"`
	LapTime   uint32 `json:"LapTime"`
	Cuts      uint8  `json:"Cuts"`
	CarsCount uint8  `json:"CarsCount"`

	Cars []*LapCompletedCar `json:"Cars"`
}

func (LapCompleted) Event

func (LapCompleted) Event() Event

type LapCompletedCar

type LapCompletedCar struct {
	CarID     CarID  `json:"CarID"`
	LapTime   uint32 `json:"LapTime"`
	Laps      uint16 `json:"Laps"`
	Completed uint8  `json:"Completed"`
}

type Message

type Message interface {
	Event() Event
}

type NextSession added in v1.5.0

type NextSession struct {
}

func (NextSession) Event added in v1.5.0

func (NextSession) Event() Event

type RestartSession added in v1.5.0

type RestartSession struct {
}

func (RestartSession) Event added in v1.5.0

func (RestartSession) Event() Event

type SendChat added in v1.1.0

type SendChat struct {
	EventType    uint8
	CarID        uint8
	Len          uint8
	UTF32Encoded []byte
}

func NewSendChat added in v1.1.0

func NewSendChat(carID CarID, data string) (*SendChat, error)

func (SendChat) Event added in v1.1.0

func (SendChat) Event() Event

type ServerError

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

func (ServerError) Event

func (ServerError) Event() Event

type SessionCarInfo

type SessionCarInfo struct {
	CarID          CarID      `json:"CarID"`
	DriverName     string     `json:"DriverName"`
	DriverGUID     DriverGUID `json:"DriverGUID"`
	CarModel       string     `json:"CarModel"`
	CarSkin        string     `json:"CarSkin"`
	DriverInitials string     `json:"DriverInitials"`

	EventType Event `json:"EventType"`
}

func (SessionCarInfo) Event

func (s SessionCarInfo) Event() Event

type SessionInfo

type SessionInfo struct {
	Version             uint8       `json:"Version"`
	SessionIndex        uint8       `json:"SessionIndex"`
	CurrentSessionIndex uint8       `json:"CurrentSessionIndex"`
	SessionCount        uint8       `json:"SessionCount"`
	ServerName          string      `json:"ServerName"`
	Track               string      `json:"Track"`
	TrackConfig         string      `json:"TrackConfig"`
	Name                string      `json:"Name"`
	Type                SessionType `json:"Type"`
	Time                uint16      `json:"Time"`
	Laps                uint16      `json:"Laps"`
	WaitTime            uint16      `json:"WaitTime"`
	AmbientTemp         uint8       `json:"AmbientTemp"`
	RoadTemp            uint8       `json:"RoadTemp"`
	WeatherGraphics     string      `json:"WeatherGraphics"`
	ElapsedMilliseconds int32       `json:"ElapsedMilliseconds"`

	EventType Event `json:"EventType"`
}

func (SessionInfo) Event

func (s SessionInfo) Event() Event

type SessionType added in v1.3.3

type SessionType uint8

func (SessionType) String added in v1.3.3

func (s SessionType) String() string

type Vec

type Vec struct {
	X float32 `json:"X"`
	Y float32 `json:"Y"`
	Z float32 `json:"Z"`
}

type Version

type Version uint8

func (Version) Event

func (Version) Event() Event

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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