udp

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 12 Imported by: 3

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 PosIntervalModifierEnabled = false
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

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

func NewAdminCommand

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

func (AdminCommand) Event

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

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

type BroadcastChat

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

func NewBroadcastChat

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

func (BroadcastChat) Event

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"`
	DriverGUID DriverGUID `json:"DriverGUID"` // used for driver name colour in live timings
	DriverName string     `json:"DriverName"`
	Time       time.Time  `json:"Time"`
}

func NewChat added in v1.7.6

func NewChat(message string, carID CarID, driverName string, driverGUID DriverGUID) (Chat, error)

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

type DriverGUID string

type EnableRealtimePosInterval

type EnableRealtimePosInterval struct {
	Type     uint8
	Interval uint16
}

func NewEnableRealtimePosInterval

func NewEnableRealtimePosInterval(interval int) EnableRealtimePosInterval

func (EnableRealtimePosInterval) Event

type EndSession

type EndSession string

func (EndSession) Event

func (EndSession) Event() Event

type Event

type Event uint8

type GetSessionInfo

type GetSessionInfo struct {
}

func (GetSessionInfo) Event

func (GetSessionInfo) Event() Event

type KickUser

type KickUser struct {
	EventType uint8
	CarID     uint8
}

func NewKickUser

func NewKickUser(carID uint8) *KickUser

func (KickUser) Event

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

type NextSession struct {
}

func (NextSession) Event

func (NextSession) Event() Event

type RestartSession

type RestartSession struct {
}

func (RestartSession) Event

func (RestartSession) Event() Event

type SendChat

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

func NewSendChat

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

func (SendChat) Event

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"`
	CarName        string `json:"CarName"`

	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

type SessionType uint8

func (SessionType) String

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