Documentation ¶
Index ¶
- Constants
- Variables
- func SetConfigVersion(settings *AccConfigFiles)
- type AccConfigFiles
- type AccWebAdvWindowsSettingsJson
- type AccWebConfigJson
- type AccWebSettingsJson
- type AssistRulesJson
- type BopJson
- type BopSettings
- type CarState
- type ConfigurationJson
- type DriverSettings
- type DriverState
- type EntrySettings
- type EntrylistJson
- type EventJson
- type EventRulesJson
- type Instance
- func (s *Instance) CanSaveSettings(aw AccWebSettingsJson, ac AccConfigFiles) error
- func (s *Instance) CheckDirectory() error
- func (s *Instance) CheckServerExeMd5Sum() (bool, error)
- func (s *Instance) ExportConfigFilesToZip() ([]byte, error)
- func (s *Instance) GetAccServerLogs() ([]byte, error)
- func (s *Instance) GetID() string
- func (s *Instance) GetProcessID() int
- func (s *Instance) HasAdvancedWindowsConfig() bool
- func (s *Instance) IsRunning() bool
- func (s *Instance) Save() error
- func (s *Instance) Start() error
- func (s *Instance) Stop() error
- func (s *Instance) UpdateAccServerExe(srcFile string) (bool, error)
- type LapState
- type LiveState
- type ServerChat
- type ServerState
- type SessionSettings
- type SettingsJson
Constants ¶
View Source
const ( WinCpuPriorityRealtime = 256 WinCpuPriorityHigh = 128 WinCpuPriorityAboveNormal = 32768 WinCpuPriorityNormal = 32 WinCpuPriorityBelowNormal = 16384 WinCpuPriorityLow = 64 )
Variables ¶
View Source
var ( ErrServerCantBeRunning = errors.New("server instance cant be running to perform this action") ErrServerDirIsInvalid = errors.New("server directory is invalid") ErrInvalidCoreAffinity = errors.New("invalid core affinity value") ErrInvalidCpuPriority = errors.New("invalid cpu priority value") )
View Source
var ( CpuPriorities = map[int]bool{ WinCpuPriorityRealtime: true, WinCpuPriorityHigh: true, WinCpuPriorityAboveNormal: true, WinCpuPriorityNormal: true, WinCpuPriorityBelowNormal: true, WinCpuPriorityLow: true, } )
Functions ¶
func SetConfigVersion ¶
func SetConfigVersion(settings *AccConfigFiles)
Types ¶
type AccConfigFiles ¶
type AccConfigFiles struct { Configuration ConfigurationJson `json:"configuration"` Settings SettingsJson `json:"settings"` Event EventJson `json:"event"` EventRules EventRulesJson `json:"eventRules"` Entrylist EntrylistJson `json:"entrylist"` Bop BopJson `json:"bop"` AssistRules AssistRulesJson `json:"assistRules"` }
type AccWebAdvWindowsSettingsJson ¶ added in v1.20.0
type AccWebConfigJson ¶
type AccWebConfigJson struct { ID string `json:"id"` Md5Sum string `json:"md5Sum"` AutoStart bool `json:"autoStart"` // backward compatibility Settings AccWebSettingsJson `json:"settings"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
func (*AccWebConfigJson) SetUpdateAt ¶
func (a *AccWebConfigJson) SetUpdateAt()
type AccWebSettingsJson ¶ added in v1.20.0
type AccWebSettingsJson struct { AutoStart bool `json:"autoStart"` EnableAdvWinCfg bool `json:"enableAdvWindowsCfg"` AdvWindowsCfg *AccWebAdvWindowsSettingsJson `json:"advWindowsCfg"` }
type AssistRulesJson ¶
type AssistRulesJson struct { ConfigVersion int `json:"configVersion"` StabilityControlLevelMax int `json:"stabilityControlLevelMax"` DisableAutosteer int `json:"disableAutosteer"` DisableAutoLights int `json:"disableAutoLights"` DisableAutoWiper int `json:"disableAutoWiper"` DisableAutoEngineStart int `json:"disableAutoEngineStart"` DisableAutoPitLimiter int `json:"disableAutoPitLimiter"` DisableAutoGear int `json:"disableAutoGear"` DisableAutoClutch int `json:"disableAutoClutch"` DisableIdealLine int `json:"disableIdealLine"` }
type BopJson ¶
type BopJson struct { ConfigVersion int `json:"configVersion"` Entries []BopSettings `json:"entries"` }
type BopSettings ¶
type CarState ¶ added in v1.16.0
type CarState struct { CarID int `json:"carID"` RaceNumber int `json:"raceNumber"` CarModel int `json:"carModel"` Drivers []*DriverState `json:"drivers"` CurrentDriver *DriverState `json:"currentDriver"` Fuel int `json:"fuel"` Position int `json:"position"` NrLaps int `json:"nrLaps"` BestLapMS int `json:"bestLapMS"` LastLapMS int `json:"lastLapMS"` LastLapTimestampMS int `json:"lastLapTimestampMS"` Laps []*LapState `json:"laps"` CurrLap LapState `json:"currLap"` }
CarState represents the current state of a single car
type ConfigurationJson ¶
type DriverSettings ¶
type DriverSettings struct { FirstName *string `json:"firstName,omitempty"` LastName *string `json:"lastName,omitempty"` ShortName *string `json:"shortName,omitempty"` DriverCategory *int `json:"driverCategory,omitempty"` PlayerID string `json:"playerID"` Nationality *int `json:"nationality,omitempty"` }
type DriverState ¶ added in v1.16.0
type DriverState struct { ConnectionID int `json:"-"` Name string `json:"name"` PlayerID string `json:"playerID"` // contains filtered or unexported fields }
DriverState contains the information about a single driver
type EntrySettings ¶
type EntrySettings struct { Drivers []DriverSettings `json:"drivers"` RaceNumber *int `json:"raceNumber,omitempty"` ForcedCarModel *int `json:"forcedCarModel,omitempty"` OverrideDriverInfo int `json:"overrideDriverInfo"` IsServerAdmin *int `json:"isServerAdmin,omitempty"` CustomCar *string `json:"customCar,omitempty"` OverrideCarModelForCustomCar int `json:"overrideCarModelForCustomCar"` BallastKg *int `json:"ballastKg,omitempty"` Restrictor *int `json:"restrictor,omitempty"` DefaultGridPosition *int `json:"defaultGridPosition,omitempty"` }
type EntrylistJson ¶
type EntrylistJson struct { ConfigVersion int `json:"configVersion"` Entries []EntrySettings `json:"entries"` ForceEntryList int `json:"forceEntryList"` }
type EventJson ¶
type EventJson struct { ConfigVersion int `json:"configVersion"` Track string `json:"track"` PreRaceWaitingTimeSeconds int `json:"preRaceWaitingTimeSeconds"` SessionOverTimeSeconds int `json:"sessionOverTimeSeconds"` AmbientTemp int `json:"ambientTemp"` TrackTemp int `json:"trackTemp,omitempty"` CloudLevel float64 `json:"cloudLevel"` Rain float64 `json:"rain"` WeatherRandomness int `json:"weatherRandomness"` Sessions []SessionSettings `json:"sessions"` MetaData string `json:"metaData"` PostQualySeconds int `json:"postQualySeconds"` PostRaceSeconds int `json:"postRaceSeconds"` SimracerWeatherConditions int `json:"simracerWeatherConditions"` IsFixedConditionQualification int `json:"isFixedConditionQualification"` }
type EventRulesJson ¶
type EventRulesJson struct { ConfigVersion int `json:"configVersion"` QualifyStandingType int `json:"qualifyStandingType"` PitWindowLengthSec int `json:"pitWindowLengthSec"` DriverStintTimeSec int `json:"driverStintTimeSec"` MandatoryPitstopCount int `json:"mandatoryPitstopCount"` MaxTotalDrivingTime int `json:"maxTotalDrivingTime"` MaxDriversCount int `json:"maxDriversCount"` IsRefuellingAllowedInRace bool `json:"isRefuellingAllowedInRace"` IsRefuellingTimeFixed bool `json:"isRefuellingTimeFixed"` IsMandatoryPitstopRefuellingRequired bool `json:"isMandatoryPitstopRefuellingRequired"` IsMandatoryPitstopTyreChangeRequired bool `json:"isMandatoryPitstopTyreChangeRequired"` IsMandatoryPitstopSwapDriverRequired bool `json:"isMandatoryPitstopSwapDriverRequired"` TyreSetCount int `json:"tyreSetCount"` }
type Instance ¶
type Instance struct { Path string Cfg AccWebConfigJson AccCfg AccConfigFiles Live *LiveState // contains filtered or unexported fields }
func LoadServerFromPath ¶
LoadServerFromPath load the server configuration data based on baseDir and returns a Instance instance
func (*Instance) CanSaveSettings ¶ added in v1.20.0
func (s *Instance) CanSaveSettings(aw AccWebSettingsJson, ac AccConfigFiles) error
func (*Instance) CheckDirectory ¶
func (*Instance) CheckServerExeMd5Sum ¶
func (*Instance) ExportConfigFilesToZip ¶
func (*Instance) GetAccServerLogs ¶
func (*Instance) GetProcessID ¶
func (*Instance) HasAdvancedWindowsConfig ¶ added in v1.20.0
type LapState ¶ added in v1.16.0
type LapState struct { CarID int `json:"carID"` DriverIndex int `json:"driverIndex"` Car *CarState `json:"-"` Driver *DriverState `json:"-"` LapTimeMS int `json:"lapTimeMS"` TimestampMS int `json:"timestampMS"` Flags int `json:"flags"` S1 string `json:"s1"` S2 string `json:"s2"` S3 string `json:"s3"` Fuel int `json:"fuel"` HasCut bool `json:"hasCut"` InLap bool `json:"inLap"` OutLap bool `json:"outLap"` SessionOver bool `json:"sessionOver"` }
type LiveState ¶ added in v1.16.0
type LiveState struct { ServerState ServerState `json:"serverState"` NrClients int `json:"nrClients"` Track string `json:"track"` SessionType string `json:"sessionType"` SessionPhase string `json:"sessionPhase"` SessionRemaining int `json:"sessionRemaining"` Cars map[int]*CarState `json:"cars"` UpdatedAt time.Time `json:"updatedAt"` Chats []ServerChat `json:"chats"` // contains filtered or unexported fields }
func NewLiveState ¶ added in v1.16.1
func NewLiveState() *LiveState
type ServerChat ¶ added in v1.18.0
type ServerState ¶ added in v1.16.0
type ServerState string
const ( ServerStateOffline ServerState = "offline" ServerStateStarting ServerState = "starting" ServerStateStoping ServerState = "stoping" ServerStateNotRegistered ServerState = "not_registered" ServerStateOnline ServerState = "online" )
type SessionSettings ¶
type SettingsJson ¶
type SettingsJson struct { ConfigVersion int `json:"configVersion"` ServerName string `json:"serverName"` Password string `json:"password"` AdminPassword string `json:"adminPassword"` SpectatorPassword string `json:"spectatorPassword"` TrackMedalsRequirement int `json:"trackMedalsRequirement"` SafetyRatingRequirement int `json:"safetyRatingRequirement"` RacecraftRatingRequirement int `json:"racecraftRatingRequirement"` IgnorePrematureDisconnects int `json:"ignorePrematureDisconnects"` DumpLeaderboards int `json:"dumpLeaderboards"` IsRaceLocked int `json:"isRaceLocked"` RandomizeTrackWhenEmpty int `json:"randomizeTrackWhenEmpty"` MaxCarSlots int `json:"maxCarSlots"` CentralEntryListPath string `json:"centralEntryListPath"` ShortFormationLap int `json:"shortFormationLap"` AllowAutoDQ int `json:"allowAutoDQ"` DumpEntryList int `json:"dumpEntryList"` FormationLapType int `json:"formationLapType"` CarGroup string `json:"carGroup"` }
Click to show internal directories.
Click to hide internal directories.