servermanager

package module
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: 88 Imported by: 0

README

Assetto Server Manager

Build Status Discord

A web interface to manage an Assetto Corsa Server.

Features

  • Quick Race Mode
  • Custom Race Mode with saved presets
  • Live Timings for current sessions
  • Results pages for all previous sessions, with the ability to apply penalties
  • Content Management - Upload tracks, weather and cars
  • Sol Integration - Sol weather is compatible, including 24 hour time cycles (session start may advance/reverse time really fast before it syncs up - requires drivers to launch from content manager)
  • Championship mode - configure multiple race events and keep track of driver, class and team points
  • Race Weekends - a group of sequential sessions that can be run at any time. For example, you could set up a Qualifying session to run on a Saturday, then the Race to follow it on a Sunday. Server Manager handles the starting grid for you, and lets you organise Entrants into splits based on their results and other factors!
  • Automatic event looping
  • Server Logs / Options Editing
  • Accounts system with different permissions levels
  • Linux and Windows Support!

If you like Assetto Server Manager, please consider supporting us with a donation!

Installation

Manual
  1. Download the latest release from the releases page
  2. Extract the release
  3. Edit the config.yml to suit your preferences
  4. Either:
    • Copy the server folder from your Assetto Corsa install into the directory you configured in config.yml, or
    • Make sure that you have steamcmd installed and in your $PATH and have configured the steam username and password in the config.yml file.
  5. Start the server using ./server-manager (on Linux) or by running server-manager.exe (on Windows)
Docker

A docker image is available under the name seejy/assetto-server-manager. We recommend using docker-compose to set up a docker environment for the server manager. This docker image has steamcmd pre-installed.

See Manual to set up server manager without Docker.

Note: if you are using a directory volume for the server install (as is shown below), be sure to make the directory before running docker-compose up - otherwise its permissions may be incorrect.

You will need a config.yml file to mount into the docker container.

An example docker-compose.yml looks like this:

version: "3"

services:
  server-manager:
    image: seejy/assetto-server-manager:latest
    ports:
    # the port that the server manager runs on
    - "8772:8772"
    # the port that the assetto server runs on (may vary depending on your configuration inside server manager)
    - "9600:9600"
    - "9600:9600/udp"
    # the port that the assetto server HTTP API runs on.
    - "8081:8081"
    # you may also wish to bind your configured UDP plugin ports here. 
    volumes: 
    # volume mount the entire server install so that 
    # content etc persists across restarts
    - ./server-install:/home/assetto/server-manager/assetto
    
    # volume mount the config
    - ./config.yml:/home/assetto/server-manager/config.yml
Post Installation

We recommend uploading your entire Assetto Corsa content/tracks folder to get the full features of Server Manager. This includes things like track images, all the correct layouts and any mod tracks you may have installed.

Also, we recommend installing Sol locally and uploading your Sol weather files to Server Manager as well so you can try out Day/Night cycles and cool weather!

Updating

Follow the steps below to update Server Manager:

  1. Back up your current Server Manager database and config.yml.
  2. Download the latest version of Server Manager
  3. Extract the zip file.
  4. Open the Changelog, read the entries between your current version and the new version. There may be configuration changes that you need to make!
  5. Make any necessary configuration changes.
  6. Find the Server Manager executable for your operating system. Replace your current Server Manager executable with it.
  7. Start the new Server Manager executable.

Build From Source Process

This is written with Linux in mind. Note that for other platforms this general flow should work, but specific commands may differ.

  1. Install Go 1.13; follow https://golang.org/doc/install#install

  2. Install Node js 11; this varies a lot based on os/distribution, Google is your friend.

  3. Enter the following commands in your terminal:

     # clone the repository (and dependencies) to your $GOPATH
     go get -u github.com/cj123/assetto-server-manager/...
     # move to the repository root
     cd $GOPATH/src/github.com/cj123/assetto-server-manager
    
  4. Set up the config.yml file in assetto-server-manager/cmd/server-manager (best to copy config.example.yml to config.yml then edit). There are important settings in here that need to be configured before sever manager will run, such as the path to steamcmd, default account information and more. Make sure you read it carefully!

  5. Time to run the manager, enter the following in your terminal:

     export GO111MODULE=on
     # run makefile commands to build and run server manager
     make clean
     make assets
     make asset-embed
     make run
    
  6. Server Manager should now be running! You can find the UI in your browser at your configured hostname (default 0.0.0.0:8772).

Credits & Thanks

Assetto Corsa Server Manager would not have been possible without the following people:

  • Henry Spencer - Twitter / GitHub
  • Callum Jones - Twitter / GitHub
  • Joseph Elton
  • The Pizzabab Championship
  • ACServerManager and its authors, for inspiration and reference on understanding the AC configuration files

Screenshots

Check out the screenshots folder!

Documentation

Index

Constants

View Source
const (
	ChampionshipEntrantAll      = "All"
	ChampionshipEntrantAccepted = "Accepted"
	ChampionshipEntrantRejected = "Rejected"
	ChampionshipEntrantPending  = "Pending Approval"
)
View Source
const (
	ContentTypeCar     = "Car"
	ContentTypeTrack   = "Track"
	ContentTypeWeather = "Weather"
)
View Source
const (
	ThemeDefault = "default"
	ThemeLight   = "light"
	ThemeDark    = "dark"
)
View Source
const (
	AnyCarModel = "any_car_model"
)
View Source
const (
	ContentManagerJoinLinkBase string = "https://acstuff.ru/s/q:race/online/join"
)
View Source
const IERP13c = "ier_p13c"
View Source
const MOTDFilename = "motd.txt"
View Source
const MaxLogSizeBytes = 1e6
View Source
const ServerExecutablePath = "acServer"

Variables

View Source
var (
	ErrInvalidChampionshipEvent = errors.New("servermanager: invalid championship event")
	ErrInvalidChampionshipClass = errors.New("servermanager: invalid championship class")
)
View Source
var (
	ErrSessionNotFound    = errors.New("servermanager: session not found")
	ErrResultFileNotFound = errors.New("servermanager: results files not found")
)
View Source
var (
	IsHosted           = os.Getenv("HOSTED") == "true"
	MaxClientsOverride = formValueAsInt(os.Getenv("MAX_CLIENTS_OVERRIDE"))
	IsPremium          = "false"
)
View Source
var (
	ErrRaceWeekendNotFound     = errors.New("servermanager: race weekend not found")
	RaceWeekendSessionNotFound = errors.New("servermanager: race weekend session not found")
)
View Source
var (
	ErrNoSteamCMD = errors.New("servermanager: steamcmd was not found in $PATH")

	// ServerInstallPath is where the assetto corsa server should be/is installed
	ServerInstallPath = "assetto"

	ServerConfigPath = "cfg"
)
View Source
var BuildVersion string

BuildVersion is the time Server Manager was built at

View Source
var ChampionshipClassColors = []string{
	"#9ec6f5",
	"#91d8af",
	"#dba8ed",
	"#e3a488",
	"#e3819a",
	"#908ba1",
	"#a2b5b9",
	"#a681b4",
	"#c1929d",
	"#999ecf",
}

ChampionshipClassColors are sequentially selected to indicate different classes within a Championship

View Source
var Changelog template.HTML
View Source
var (
	CurrentMigrationVersion = len(migrations)
)
View Source
var (
	Debug = os.Getenv("DEBUG") == "true"
)
View Source
var DefaultChampionshipPoints = ChampionshipPoints{
	Places: []int{
		25,
		18,
		15,
		12,
		10,
		8,
		6,
		4,
		2,
		1,
	},
	BestLap:              0,
	PolePosition:         0,
	SecondRaceMultiplier: 1,

	CollisionWithDriver: 0,
	CollisionWithEnv:    0,
	CutTrack:            0,
}

DefaultChampionshipPoints is the Formula 1 points system.

View Source
var DefaultTrackSurfacePresets = []TrackSurfacePreset{
	{
		Name:            "Dusty",
		SessionStart:    86,
		SessionTransfer: 50,
		Randomness:      1,
		LapGain:         30,
		Description:     "A very slippery track, improves fast with more laps.",
	},
	{
		Name:            "Old",
		SessionStart:    89,
		SessionTransfer: 80,
		Randomness:      3,
		LapGain:         50,
		Description:     "Old tarmac. Bad grip that won't get better soon.",
	},
	{
		Name:            "Slow",
		SessionStart:    96,
		SessionTransfer: 80,
		Randomness:      1,
		LapGain:         300,
		Description:     "A slow track that doesn't improve much.",
	},
	{
		Name:            "Green",
		SessionStart:    95,
		SessionTransfer: 90,
		Randomness:      2,
		LapGain:         132,
		Description:     "A clean track, gets better with more laps.",
	},
	{
		Name:            "Fast",
		SessionStart:    98,
		SessionTransfer: 80,
		Randomness:      2,
		LapGain:         700,
		Description:     "Very grippy track right from the start.",
	},
	{
		Name:            "Optimum",
		SessionStart:    100,
		SessionTransfer: 100,
		Randomness:      0,
		LapGain:         1,
		Description:     "Perfect track for hotlapping.",
	},
}
View Source
var ErrAccountNeedsPassword = errors.New("servermanager: account needs to set a password")
View Source
var ErrAccountNotFound = errors.New("servermanager: account not found")
View Source
var ErrChampionshipNotFound = errors.New("servermanager: championship not found")
View Source
var ErrClassNotFound = errors.New("servermanager: championship class not found")
View Source
var ErrCouldNotFindTyreForCar = errors.New("servermanager: could not find tyres for car")
View Source
var ErrCustomRaceNotFound = errors.New("servermanager: custom race not found")
View Source
var ErrEntryListFull = errors.New("servermanager: entry list is full")
View Source
var ErrEntryListTooBig = errors.New("servermanager: EntryList exceeds MaxClients setting")
View Source
var ErrInvalidUsernameOrPassword = errors.New("servermanager: invalid username or password")
View Source
var ErrMustSubmitCar = errors.New("servermanager: you must set a car")
View Source
var ErrNoActiveChampionshipEvent = errors.New("servermanager: no active championship event")
View Source
var ErrNoActiveRaceWeekendSession = errors.New("servermanager: no active race weekend session")
View Source
var ErrNoOpenUDPConnection = errors.New("servermanager: no open UDP connection found")
View Source
var ErrRaceWeekendFilterNotFound = errors.New("servermanager: race weekend filter not found")
View Source
var ErrRaceWeekendSessionDependencyIncomplete = errors.New("servermanager: race weekend session dependency incomplete")
View Source
var ErrResultsPageNotFound = errors.New("servermanager: results page not found")
View Source
var ErrScheduledTimeIsZero = errors.New("servermanager: can't schedule race for zero time")
View Source
var ErrServerAlreadyRunning = errors.New("servermanager: assetto corsa server is already running")
View Source
var ErrSessionCarNotFound = errors.New("servermanager: session car not found")
View Source
var (
	ErrStrackerConfigurationRequiresUDPPluginConfiguration = errors.New("servermanager: stracker configuration requires UDP plugin configuration in Server Options")
)
View Source
var ErrValueNotSet = errors.New("servermanager: value not set")
View Source
var HTTPCounter = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: "web_requests_total",
		Help: "A counter for requests to the wrapped handler.",
	},
	[]string{"code", "method"},
)
View Source
var HTTPDuration = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Name:    "request_duration_seconds",
		Help:    "A histogram of latencies for requests.",
		Buckets: []float64{.25, .5, 1, 2.5, 5, 10},
	},
	[]string{"handler", "method"},
)

HTTPDuration is partitioned by the HTTP method and handler. It uses custom buckets based on the expected request duration.

View Source
var HTTPInFlightGauge = prometheus.NewGauge(prometheus.GaugeOpts{
	Name: "in_flight_requests",
	Help: "A gauge of requests currently being served by the wrapped handler.",
})
View Source
var HTTPResponseSize = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Name:    "response_size_bytes",
		Help:    "A histogram of response sizes for requests.",
		Buckets: []float64{200, 500, 900, 1500},
	},
	[]string{},
)

HTTPResponseSize has no labels, making it a zero-dimensional ObserverVec.

View Source
var IERP13cTyres = []string{"S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8"}
View Source
var LaunchTime = time.Now()
View Source
var OpenAccount = &Account{
	Name:            "Free Access",
	Group:           GroupRead,
	LastSeenVersion: BuildVersion,
	Theme:           ThemeDefault,
}
View Source
var RaceWeekendEntryListSorters = []RaceWeekendEntryListSorterDescription{
	{
		Name:                  "No Sort (Use Finishing Grid)",
		Key:                   "",
		Sorter:                RaceWeekendEntryListSortFunc(UnchangedRaceWeekendEntryListSort),
		NeedsParentSession:    false,
		ShowInManageEntryList: true,
	},
	{
		Name:                  "Fastest Lap",
		Key:                   "fastest_lap",
		Sorter:                RaceWeekendEntryListSortFunc(FastestLapRaceWeekendEntryListSort),
		NeedsParentSession:    true,
		ShowInManageEntryList: true,
	},
	{
		Name:                  "Total Race Time",
		Key:                   "total_race_time",
		Sorter:                RaceWeekendEntryListSortFunc(TotalRaceTimeRaceWeekendEntryListSort),
		NeedsParentSession:    true,
		ShowInManageEntryList: true,
	},
	{
		Name:                  "Fastest Lap Across Multiple Results Files",
		Key:                   "fastest_multi_results_lap",
		Sorter:                RaceWeekendEntryListSortFunc(FastestResultsFileRaceWeekendEntryListSort),
		NeedsParentSession:    false,
		ShowInManageEntryList: false,
	},
	{
		Name:                  "Number of Laps Across Multiple Results Files",
		Key:                   "number_multi_results_lap",
		Sorter:                RaceWeekendEntryListSortFunc(NumberResultsFileRaceWeekendEntryListSort),
		NeedsParentSession:    false,
		ShowInManageEntryList: false,
	},
	{
		Name:                  "Fewest Collisions",
		Key:                   "fewest_collisions",
		Sorter:                RaceWeekendEntryListSortFunc(FewestCollisionsRaceWeekendEntryListSort),
		NeedsParentSession:    true,
		ShowInManageEntryList: true,
	},
	{
		Name:                  "Fewest Cuts",
		Key:                   "fewest_cuts",
		Sorter:                RaceWeekendEntryListSortFunc(FewestCutsRaceWeekendEntryListSort),
		NeedsParentSession:    true,
		ShowInManageEntryList: true,
	},
	{
		Name:                  "Safety (Collisions then Cuts)",
		Key:                   "safety",
		Sorter:                RaceWeekendEntryListSortFunc(SafetyRaceWeekendEntryListSort),
		NeedsParentSession:    true,
		ShowInManageEntryList: true,
	},
	{
		Name:                  "Championship Standings Order",
		Key:                   "championship_standings_order",
		Sorter:                &ChampionshipStandingsOrderEntryListSort{},
		NeedsParentSession:    false,
		ShowInManageEntryList: true,
	},
	{
		Name:                  "Random",
		Key:                   "random",
		Sorter:                RaceWeekendEntryListSortFunc(RandomRaceWeekendEntryListSort),
		NeedsParentSession:    false,
		ShowInManageEntryList: true,
	},
	{
		Name:                  "Alphabetical (Using Driver Name)",
		Key:                   "alphabetical",
		Sorter:                RaceWeekendEntryListSortFunc(AlphabeticalRaceWeekendEntryListSort),
		NeedsParentSession:    false,
		ShowInManageEntryList: true,
	},
}
View Source
var ThemeOptions = []ThemeDetails{
	{
		Theme: ThemeDefault,
		Name:  "Use Default",
	},
	{
		Theme: ThemeLight,
		Name:  "Light",
	},
	{
		Theme: ThemeDark,
		Name:  "Dark",
	},
}
View Source
var UseFallBackSorting = false
View Source
var UseShortenedDriverNames = true

Functions

func ACSRSendResult added in v1.5.0

func ACSRSendResult(championship Championship)

Sends a championship to ACSR, called OnEndSession and when a championship is created

func AddErrorFlash added in v1.3.1

func AddErrorFlash(w http.ResponseWriter, r *http.Request, message string)

func AddFlash added in v1.3.1

func AddFlash(w http.ResponseWriter, r *http.Request, message string)

Helper function to get message session and add a flash

func AdminAccess

func AdminAccess(r *http.Request) func() bool

func AlphabeticalRaceWeekendEntryListSort added in v1.5.0

func AlphabeticalRaceWeekendEntryListSort(_ *RaceWeekend, _ *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, _ *RaceWeekendSessionToSessionFilter) error

func AssetCacheHeaders added in v1.4.0

func AssetCacheHeaders(next http.HandlerFunc, useRevalidation bool) http.HandlerFunc

func BuildICalEvent added in v1.2.1

func BuildICalEvent(event ScheduledEvent) *components.Event

func CarDataFile added in v1.5.1

func CarDataFile(carModel, dataFile string) (io.ReadCloser, error)

func CarNameFromFilepath

func CarNameFromFilepath(path string) (string, error)

CarNameFromFilepath takes a filepath e.g. content/cars/rss_formula_rss_4/data.acd and returns the car name, e.g. in this case: rss_formula_rss_4.

func ChampionshipClassColor added in v1.5.0

func ChampionshipClassColor(i int) string

func DeleteAccess added in v1.2.0

func DeleteAccess(r *http.Request) func() bool

func FastestLapRaceWeekendEntryListSort added in v1.5.0

func FastestLapRaceWeekendEntryListSort(rw *RaceWeekend, session *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, _ *RaceWeekendSessionToSessionFilter) error

func FastestResultsFileRaceWeekendEntryListSort added in v1.6.0

func FastestResultsFileRaceWeekendEntryListSort(_ *RaceWeekend, _ *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, filter *RaceWeekendSessionToSessionFilter) error

func FewestCollisionsRaceWeekendEntryListSort added in v1.5.0

func FewestCollisionsRaceWeekendEntryListSort(rw *RaceWeekend, session *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, _ *RaceWeekendSessionToSessionFilter) error

func FewestCutsRaceWeekendEntryListSort added in v1.5.0

func FewestCutsRaceWeekendEntryListSort(rw *RaceWeekend, session *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, _ *RaceWeekendSessionToSessionFilter) error

func FileServer

func FileServer(r chi.Router, path string, root http.FileSystem, useRevalidation bool)

func FreeUDPPort

func FreeUDPPort() (int, error)

func GenerateSummary added in v1.5.0

func GenerateSummary(raceSetup CurrentRaceConfig, eventType string) string

func GetMD5Hash added in v1.5.0

func GetMD5Hash(guid string) string

func GetResultDate added in v1.5.0

func GetResultDate(name string) (time.Time, error)

func InitLogging added in v1.3.3

func InitLogging()

func InitLua added in v1.6.0

func InitLua()

func InitMonitoring added in v1.3.0

func InitMonitoring()

func InitWithResolver added in v1.4.0

func InitWithResolver(resolver *Resolver) error

func InstallAssettoCorsaServer

func InstallAssettoCorsaServer(login, password string, force bool) error

InstallAssettoCorsaServer takes a steam login and password and runs steamcmd to install the assetto server. If the "ServerInstallPath" exists, this function will exit without installing - unless force == true.

func IsAssettoInstalled added in v1.5.3

func IsAssettoInstalled() bool

func IsDirWriteable added in v1.5.3

func IsDirWriteable(dir string) error

func IsStrackerInstalled added in v1.5.1

func IsStrackerInstalled() bool

IsStrackerInstalled looks in the ServerInstallPath for an "stracker" directory with the correct stracker executable for the given platform

func ListSetupsForCar added in v1.4.0

func ListSetupsForCar(model string) (map[string][]string, error)

func LoadTrackMapImage added in v1.5.1

func LoadTrackMapImage(track, trackLayout string) (image.Image, error)

func LoadTyresFromACDINI

func LoadTyresFromACDINI(data []byte) (map[string]string, error)

LoadTyresFromACDINI reads the tyres.ini file from within the data.acd of a car and finds all available tyre compounds.

func LoggedIn

func LoggedIn(r *http.Request) func() bool

func LuaHTTPRequest added in v1.6.0

func LuaHTTPRequest(L *lua.LState) int

func Migrate added in v1.2.0

func Migrate(store Store) error

func NumberResultsFileRaceWeekendEntryListSort added in v1.6.0

func NumberResultsFileRaceWeekendEntryListSort(_ *RaceWeekend, _ *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, filter *RaceWeekendSessionToSessionFilter) error

func RandomRaceWeekendEntryListSort added in v1.5.0

func RandomRaceWeekendEntryListSort(_ *RaceWeekend, _ *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, _ *RaceWeekendSessionToSessionFilter) error

func ReadAccess

func ReadAccess(r *http.Request) func() bool

func RoundTripper added in v1.3.0

func RoundTripper(t http.RoundTripper) http.RoundTripper

func Router

func Router(
	fs http.FileSystem,
	quickRaceHandler *QuickRaceHandler,
	customRaceHandler *CustomRaceHandler,
	championshipsHandler *ChampionshipsHandler,
	accountHandler *AccountHandler,
	auditLogHandler *AuditLogHandler,
	carsHandler *CarsHandler,
	tracksHandler *TracksHandler,
	weatherHandler *WeatherHandler,
	penaltiesHandler *PenaltiesHandler,
	resultsHandler *ResultsHandler,
	contentUploadHandler *ContentUploadHandler,
	serverAdministrationHandler *ServerAdministrationHandler,
	raceControlHandler *RaceControlHandler,
	scheduledRacesHandler *ScheduledRacesHandler,
	raceWeekendHandler *RaceWeekendHandler,
	strackerHandler *StrackerHandler,
	healthCheck *HealthCheck,
) http.Handler

func SafetyRaceWeekendEntryListSort added in v1.5.0

func SafetyRaceWeekendEntryListSort(rw *RaceWeekend, session *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, _ *RaceWeekendSessionToSessionFilter) error

func SetAssettoInstallPath

func SetAssettoInstallPath(installPath string)

func StrackerExecutablePath added in v1.5.1

func StrackerExecutablePath() string

func StrackerFolderPath added in v1.5.1

func StrackerFolderPath() string

func ToggleDRSForTrack added in v1.3.3

func ToggleDRSForTrack(track, layout string, drsEnabled bool) error

func TotalRaceTimeRaceWeekendEntryListSort added in v1.5.0

func TotalRaceTimeRaceWeekendEntryListSort(rw *RaceWeekend, session *RaceWeekendSession, entrants []*RaceWeekendSessionEntrant, _ *RaceWeekendSessionToSessionFilter) error

func UnchangedRaceWeekendEntryListSort added in v1.5.0

func UnchangedRaceWeekendEntryListSort(_ *RaceWeekend, _ *RaceWeekendSession, _ []*RaceWeekendSessionEntrant, _ *RaceWeekendSessionToSessionFilter) error

func WriteAccess

func WriteAccess(r *http.Request) func() bool

Types

type ACHTTPPlayers added in v1.4.0

type ACHTTPPlayers struct {
	Cars []*CMCar `json:"Cars"`
}

type ACHTTPSessionInfo added in v1.4.0

type ACHTTPSessionInfo struct {
	Cars         []string    `json:"cars"`
	Clients      int64       `json:"clients"`
	Country      []string    `json:"country"`
	HTTPPort     int64       `json:"cport"`
	Durations    []int64     `json:"durations"`
	Extra        bool        `json:"extra"`
	Inverted     int64       `json:"inverted"`
	IP           string      `json:"ip"`
	JSON         interface{} `json:"json"`
	L            bool        `json:"l"`
	MaxClients   int64       `json:"maxclients"`
	Name         string      `json:"name"`
	Pass         bool        `json:"pass"`
	Pickup       bool        `json:"pickup"`
	Pit          bool        `json:"pit"`
	Port         int64       `json:"port"`
	Session      int64       `json:"session"`
	Sessiontypes []int64     `json:"sessiontypes"`
	Timed        bool        `json:"timed"`
	Timeleft     int64       `json:"timeleft"`
	Timeofday    int64       `json:"timeofday"`
	Timestamp    int64       `json:"timestamp"`
	TCPPort      int64       `json:"tport"`
	Track        string      `json:"track"`
}

type ACSRConfig added in v1.5.0

type ACSRConfig struct {
	URL       string `yaml:"url"`
	Enabled   bool   `yaml:"enabled"`
	APIKey    string `yaml:"api_key"`
	AccountID string `yaml:"account_id"`
}

type Account

type Account struct {
	ID uuid.UUID

	Created time.Time
	Updated time.Time
	Deleted time.Time

	Name  string
	Group Group

	DriverName, GUID, Team string

	PasswordHash string
	PasswordSalt string

	DefaultPassword string
	LastSeenVersion string

	Theme Theme
}

func AccountFromRequest added in v1.2.0

func AccountFromRequest(r *http.Request) *Account

func NewAccount added in v1.2.0

func NewAccount() *Account

func (Account) HasGroupPrivilege

func (a Account) HasGroupPrivilege(g Group) bool

func (Account) HasSeenCurrentVersion added in v1.4.0

func (a Account) HasSeenCurrentVersion() bool

func (Account) HasSeenVersion added in v1.4.0

func (a Account) HasSeenVersion(version string) bool

func (Account) NeedsPasswordReset added in v1.2.0

func (a Account) NeedsPasswordReset() bool

func (Account) ShowDarkTheme added in v1.5.0

func (a Account) ShowDarkTheme(serverManagerDarkThemeEnabled bool) bool

type AccountHandler added in v1.4.0

type AccountHandler struct {
	*BaseHandler
	SteamLoginHandler
	// contains filtered or unexported fields
}

func NewAccountHandler added in v1.4.0

func NewAccountHandler(baseHandler *BaseHandler, store Store, accountManager *AccountManager) *AccountHandler

func (*AccountHandler) AdminAccessMiddleware added in v1.4.0

func (ah *AccountHandler) AdminAccessMiddleware(next http.Handler) http.Handler

func (*AccountHandler) DeleteAccessMiddleware added in v1.4.0

func (ah *AccountHandler) DeleteAccessMiddleware(next http.Handler) http.Handler

func (*AccountHandler) MustLoginMiddleware added in v1.4.0

func (ah *AccountHandler) MustLoginMiddleware(requiredGroup Group, next http.Handler) http.Handler

MustLoginMiddleware determines whether an account needs to log in to access a given Group page

func (*AccountHandler) ReadAccessMiddleware added in v1.4.0

func (ah *AccountHandler) ReadAccessMiddleware(next http.Handler) http.Handler

func (*AccountHandler) WriteAccessMiddleware added in v1.4.0

func (ah *AccountHandler) WriteAccessMiddleware(next http.Handler) http.Handler

type AccountManager added in v1.2.0

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

func NewAccountManager added in v1.2.0

func NewAccountManager(store Store) *AccountManager

func (*AccountManager) ChangePassword added in v1.5.0

func (am *AccountManager) ChangePassword(account *Account, password string) error

func (*AccountManager) SetCurrentVersion added in v1.4.0

func (am *AccountManager) SetCurrentVersion(account *Account) error

type AccountsConfig added in v1.2.0

type AccountsConfig struct {
	AdminPasswordOverride string `yaml:"admin_password_override"`
}

type ActiveChampionship

type ActiveChampionship struct {
	Name                    string
	ChampionshipID, EventID uuid.UUID
	SessionType             SessionType
	OverridePassword        bool
	ReplacementPassword     string
	Description             string
	IsPracticeSession       bool
	RaceConfig              CurrentRaceConfig
	EntryList               EntryList

	NumLapsCompleted   int `json:"-"`
	NumRaceStartEvents int `json:"-"`
	// contains filtered or unexported fields
}

func (*ActiveChampionship) EventDescription added in v1.4.0

func (a *ActiveChampionship) EventDescription() string

func (*ActiveChampionship) EventName added in v1.3.0

func (a *ActiveChampionship) EventName() string

func (*ActiveChampionship) GetEntryList added in v1.5.3

func (a *ActiveChampionship) GetEntryList() EntryList

func (*ActiveChampionship) GetRaceConfig added in v1.5.3

func (a *ActiveChampionship) GetRaceConfig() CurrentRaceConfig

func (*ActiveChampionship) GetURL added in v1.4.0

func (a *ActiveChampionship) GetURL() string

func (*ActiveChampionship) IsChampionship added in v1.3.0

func (a *ActiveChampionship) IsChampionship() bool

func (*ActiveChampionship) IsLooping added in v1.5.3

func (a *ActiveChampionship) IsLooping() bool

func (*ActiveChampionship) IsPractice added in v1.5.3

func (a *ActiveChampionship) IsPractice() bool

func (*ActiveChampionship) IsRaceWeekend added in v1.5.0

func (a *ActiveChampionship) IsRaceWeekend() bool

func (*ActiveChampionship) OverrideServerPassword added in v1.3.0

func (a *ActiveChampionship) OverrideServerPassword() bool

func (*ActiveChampionship) ReplacementServerPassword added in v1.3.0

func (a *ActiveChampionship) ReplacementServerPassword() string

type ActiveRaceWeekend added in v1.5.0

type ActiveRaceWeekend struct {
	Name                     string
	RaceWeekendID, SessionID uuid.UUID
	OverridePassword         bool
	ReplacementPassword      string
	Description              string
	IsPracticeSession        bool
	RaceConfig               CurrentRaceConfig
	EntryList                EntryList
}

ActiveRaceWeekend indicates which RaceWeekend and RaceWeekendSession are currently running on the server.

func (ActiveRaceWeekend) EventDescription added in v1.5.0

func (a ActiveRaceWeekend) EventDescription() string

func (ActiveRaceWeekend) EventName added in v1.5.0

func (a ActiveRaceWeekend) EventName() string

func (ActiveRaceWeekend) GetEntryList added in v1.5.3

func (a ActiveRaceWeekend) GetEntryList() EntryList

func (ActiveRaceWeekend) GetRaceConfig added in v1.5.3

func (a ActiveRaceWeekend) GetRaceConfig() CurrentRaceConfig

func (ActiveRaceWeekend) GetURL added in v1.5.0

func (a ActiveRaceWeekend) GetURL() string

func (ActiveRaceWeekend) IsChampionship added in v1.5.0

func (a ActiveRaceWeekend) IsChampionship() bool

func (ActiveRaceWeekend) IsLooping added in v1.5.3

func (a ActiveRaceWeekend) IsLooping() bool

func (ActiveRaceWeekend) IsPractice added in v1.5.3

func (a ActiveRaceWeekend) IsPractice() bool

func (ActiveRaceWeekend) IsRaceWeekend added in v1.5.0

func (a ActiveRaceWeekend) IsRaceWeekend() bool

func (ActiveRaceWeekend) OverrideServerPassword added in v1.5.0

func (a ActiveRaceWeekend) OverrideServerPassword() bool

func (ActiveRaceWeekend) ReplacementServerPassword added in v1.5.0

func (a ActiveRaceWeekend) ReplacementServerPassword() string

type AssetHelper

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

func NewAssetHelper

func NewAssetHelper(baseURL, prefix, suffix string, query map[string]string) *AssetHelper

func (*AssetHelper) GetURL

func (a *AssetHelper) GetURL(location string) string

type AssettoServerProcess

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

AssettoServerProcess manages the assetto corsa server process.

func NewAssettoServerProcess added in v1.2.0

func NewAssettoServerProcess(callbackFunc udp.CallbackFunc, store Store, contentManagerWrapper *ContentManagerWrapper) *AssettoServerProcess

func (*AssettoServerProcess) Done added in v1.2.0

func (as *AssettoServerProcess) Done() <-chan struct{}

func (*AssettoServerProcess) Event added in v1.4.0

func (as *AssettoServerProcess) Event() RaceEvent

func (*AssettoServerProcess) GetServerConfig added in v1.4.0

func (as *AssettoServerProcess) GetServerConfig() ServerConfig

func (*AssettoServerProcess) IsRunning

func (as *AssettoServerProcess) IsRunning() bool

IsRunning of the server. returns true if running

func (*AssettoServerProcess) Logs

func (as *AssettoServerProcess) Logs() string

Logs outputs the server logs

func (*AssettoServerProcess) Restart

func (as *AssettoServerProcess) Restart() error

Restart the assetto server.

func (*AssettoServerProcess) SendUDPMessage added in v1.2.1

func (as *AssettoServerProcess) SendUDPMessage(message udp.Message) error

func (*AssettoServerProcess) Start

func (as *AssettoServerProcess) Start(cfg ServerConfig, entryList EntryList, forwardingAddress string, forwardListenPort int, event RaceEvent) error

Start the assetto server. If it's already running, an ErrServerAlreadyRunning is returned.

func (*AssettoServerProcess) Stop

func (as *AssettoServerProcess) Stop() error

Stop the assetto server.

func (*AssettoServerProcess) UDPCallback added in v1.2.1

func (as *AssettoServerProcess) UDPCallback(message udp.Message)

type AuditEntry added in v1.3.3

type AuditEntry struct {
	UserGroup Group
	Method    string
	URL       string
	User      string
	Time      time.Time
}

type AuditLogHandler added in v1.4.0

type AuditLogHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewAuditLogHandler added in v1.4.0

func NewAuditLogHandler(baseHandler *BaseHandler, store Store) *AuditLogHandler

func (*AuditLogHandler) Middleware added in v1.4.0

func (alh *AuditLogHandler) Middleware(next http.Handler) http.Handler

type BaseHandler added in v1.4.0

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

func NewBaseHandler added in v1.4.0

func NewBaseHandler(viewRenderer *Renderer) *BaseHandler

type BaseTemplateVars added in v1.5.0

type BaseTemplateVars struct {
	Messages           []interface{}
	Errors             []interface{}
	ServerStatus       bool
	ServerEvent        RaceEvent
	ServerName         string
	CustomCSS          template.CSS
	User               *Account
	IsHosted           bool
	IsPremium          string
	MaxClientsOverride int
	IsDarkTheme        bool
	Request            *http.Request
	Debug              bool
	MonitoringEnabled  bool
	SentryDSN          template.JSStr
	RecaptchaSiteKey   string
	WideContainer      bool
	OGImage            string
}

func (*BaseTemplateVars) Get added in v1.5.0

type BoltStore added in v1.2.0

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

func (*BoltStore) AddAuditEntry added in v1.3.3

func (rs *BoltStore) AddAuditEntry(entry *AuditEntry) error

func (*BoltStore) ClearLastRaceEvent added in v1.5.3

func (rs *BoltStore) ClearLastRaceEvent() error

func (*BoltStore) DeleteAccount added in v1.2.0

func (rs *BoltStore) DeleteAccount(id string) error

func (*BoltStore) DeleteChampionship added in v1.2.0

func (rs *BoltStore) DeleteChampionship(id string) error

func (*BoltStore) DeleteCustomRace added in v1.2.0

func (rs *BoltStore) DeleteCustomRace(race *CustomRace) error

func (*BoltStore) DeleteEntrant added in v1.3.1

func (rs *BoltStore) DeleteEntrant(id string) error

func (*BoltStore) DeleteRaceWeekend added in v1.5.0

func (rs *BoltStore) DeleteRaceWeekend(id string) error

func (*BoltStore) FindAccountByID added in v1.2.0

func (rs *BoltStore) FindAccountByID(id string) (*Account, error)

func (*BoltStore) FindAccountByName added in v1.2.0

func (rs *BoltStore) FindAccountByName(name string) (*Account, error)

func (*BoltStore) FindCustomRaceByID added in v1.2.0

func (rs *BoltStore) FindCustomRaceByID(uuid string) (*CustomRace, error)

func (*BoltStore) GetAuditEntries added in v1.3.3

func (rs *BoltStore) GetAuditEntries() ([]*AuditEntry, error)

func (*BoltStore) GetMeta added in v1.2.0

func (rs *BoltStore) GetMeta(key string, out interface{}) error

func (*BoltStore) ListAccounts added in v1.2.0

func (rs *BoltStore) ListAccounts() ([]*Account, error)

func (*BoltStore) ListChampionships added in v1.2.0

func (rs *BoltStore) ListChampionships() ([]*Championship, error)

func (*BoltStore) ListCustomRaces added in v1.2.0

func (rs *BoltStore) ListCustomRaces() ([]*CustomRace, error)

func (*BoltStore) ListEntrants added in v1.2.0

func (rs *BoltStore) ListEntrants() ([]*Entrant, error)

func (*BoltStore) ListPrevFrames added in v1.2.0

func (rs *BoltStore) ListPrevFrames() ([]string, error)

func (*BoltStore) ListRaceWeekends added in v1.5.0

func (rs *BoltStore) ListRaceWeekends() ([]*RaceWeekend, error)

func (*BoltStore) LoadChampionship added in v1.2.0

func (rs *BoltStore) LoadChampionship(id string) (*Championship, error)

func (*BoltStore) LoadLastRaceEvent added in v1.5.3

func (rs *BoltStore) LoadLastRaceEvent() (RaceEvent, error)

func (*BoltStore) LoadLiveTimingsData added in v1.5.3

func (rs *BoltStore) LoadLiveTimingsData() (*LiveTimingsPersistedData, error)

func (*BoltStore) LoadRaceWeekend added in v1.5.0

func (rs *BoltStore) LoadRaceWeekend(id string) (*RaceWeekend, error)

func (*BoltStore) LoadServerOptions added in v1.2.0

func (rs *BoltStore) LoadServerOptions() (*GlobalServerConfig, error)

func (*BoltStore) LoadStrackerOptions added in v1.5.1

func (rs *BoltStore) LoadStrackerOptions() (*StrackerConfiguration, error)

func (*BoltStore) SetMeta added in v1.2.0

func (rs *BoltStore) SetMeta(key string, value interface{}) error

func (*BoltStore) UpsertAccount added in v1.2.0

func (rs *BoltStore) UpsertAccount(a *Account) error

func (*BoltStore) UpsertChampionship added in v1.2.0

func (rs *BoltStore) UpsertChampionship(c *Championship) error

func (*BoltStore) UpsertCustomRace added in v1.2.0

func (rs *BoltStore) UpsertCustomRace(race *CustomRace) error

func (*BoltStore) UpsertEntrant added in v1.2.0

func (rs *BoltStore) UpsertEntrant(entrant Entrant) error

func (*BoltStore) UpsertLastRaceEvent added in v1.5.3

func (rs *BoltStore) UpsertLastRaceEvent(r RaceEvent) error

func (*BoltStore) UpsertLiveFrames added in v1.2.0

func (rs *BoltStore) UpsertLiveFrames(frameLinks []string) error

func (*BoltStore) UpsertLiveTimingsData added in v1.5.3

func (rs *BoltStore) UpsertLiveTimingsData(lt *LiveTimingsPersistedData) error

func (*BoltStore) UpsertRaceWeekend added in v1.5.0

func (rs *BoltStore) UpsertRaceWeekend(rw *RaceWeekend) error

func (*BoltStore) UpsertServerOptions added in v1.2.0

func (rs *BoltStore) UpsertServerOptions(so *GlobalServerConfig) error

func (*BoltStore) UpsertStrackerOptions added in v1.5.1

func (rs *BoltStore) UpsertStrackerOptions(sto *StrackerConfiguration) error

type Broadcaster added in v1.3.3

type Broadcaster interface {
	Send(message udp.Message) error
}

type ByteReaderCloser added in v1.5.1

type ByteReaderCloser struct {
	*bytes.Reader
}

func (ByteReaderCloser) Close added in v1.5.1

func (ByteReaderCloser) Close() error

type CMAssists added in v1.4.0

type CMAssists struct {
	ABSState             int  `json:"absState"`
	AllowedTyresOut      int  `json:"allowedTyresOut"`
	AutoClutchAllowed    bool `json:"autoclutchAllowed"`
	DamageMultiplier     int  `json:"damageMultiplier"`
	ForceVirtualMirror   bool `json:"forceVirtualMirror"`
	FuelRate             int  `json:"fuelRate"`
	StabilityAllowed     bool `json:"stabilityAllowed"`
	TractionControlState int  `json:"tcState"`
	TyreBlanketsAllowed  bool `json:"tyreBlanketsAllowed"`
	TyreWearRate         int  `json:"tyreWearRate"`
}

type CMCar added in v1.4.0

type CMCar struct {
	DriverName      string `json:"DriverName"`
	DriverNation    string `json:"DriverNation"`
	DriverTeam      string `json:"DriverTeam"`
	ID              string `json:"ID"`
	IsConnected     bool   `json:"IsConnected"`
	IsEntryList     bool   `json:"IsEntryList"`
	IsRequestedGUID bool   `json:"IsRequestedGUID"`
	Model           string `json:"Model"`
	Skin            string `json:"Skin"`
}

type CMContent added in v1.4.0

type CMContent struct {
	Cars  map[string]ContentURL `json:"cars"`
	Track ContentURL            `json:"track"`
}

type CalendarObject added in v1.5.0

type CalendarObject struct {
	ID               string    `json:"id"`
	GroupID          string    `json:"groupId"`
	AllDay           bool      `json:"allDay"`
	Start            time.Time `json:"start"`
	End              time.Time `json:"end"`
	Title            string    `json:"title"`
	Description      string    `json:"description"`
	URL              string    `json:"url"`
	SignUpURL        string    `json:"signUpURL"`
	ClassNames       []string  `json:"classNames"`
	Editable         bool      `json:"editable"`
	StartEditable    bool      `json:"startEditable"`
	DurationEditable bool      `json:"durationEditable"`
	ResourceEditable bool      `json:"resourceEditable"`
	Rendering        string    `json:"rendering"`
	Overlap          bool      `json:"overlap"`

	Constraint      string `json:"constraint"`
	BackgroundColor string `json:"backgroundColor"`
	BorderColor     string `json:"borderColor"`
	TextColor       string `json:"textColor"`
}

func BuildCalObject added in v1.5.0

func BuildCalObject(scheduled []ScheduledEvent, calendarObjects []CalendarObject) ([]CalendarObject, error)

type Car

type Car struct {
	Name    string
	Skins   []string
	Tyres   map[string]string
	Details CarDetails
}

func (Car) IsMod added in v1.5.2

func (c Car) IsMod() bool

func (Car) IsPaidDLC added in v1.5.2

func (c Car) IsPaidDLC() bool

func (Car) PrettyName

func (c Car) PrettyName() string

type CarDetails added in v1.4.0

type CarDetails struct {
	Author       string          `json:"author"`
	Brand        string          `json:"brand"`
	Class        string          `json:"class"`
	Country      string          `json:"country"`
	Description  string          `json:"description"`
	Name         string          `json:"name"`
	PowerCurve   [][]json.Number `json:"powerCurve"`
	Specs        CarSpecs        `json:"specs"`
	SpecsNumeric CarSpecsNumeric `json:"spec"`
	Tags         []string        `json:"tags"`
	TorqueCurve  [][]json.Number `json:"torqueCurve"`
	URL          string          `json:"url"`
	Version      string          `json:"version"`
	Year         ShouldBeAnInt   `json:"year"`
	IsStock      bool            `json:"stock"`
	IsDLC        bool            `json:"dlc"`
	IsMod        bool            `json:"mod"`

	DownloadURL string `json:"downloadURL"`
	Notes       string `json:"notes"`
}

func (*CarDetails) AddTag added in v1.4.0

func (cd *CarDetails) AddTag(name string)

func (*CarDetails) DelTag added in v1.4.0

func (cd *CarDetails) DelTag(name string)

func (*CarDetails) Load added in v1.4.0

func (cd *CarDetails) Load(carName string) error

func (*CarDetails) Save added in v1.4.0

func (cd *CarDetails) Save(carName string) error

type CarManager added in v1.4.0

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

func NewCarManager added in v1.4.0

func NewCarManager(trackManager *TrackManager, watchForCarChanges bool) *CarManager

func (*CarManager) AddTag added in v1.4.0

func (cm *CarManager) AddTag(carName, tag string) error

func (*CarManager) CreateOrOpenSearchIndex added in v1.4.0

func (cm *CarManager) CreateOrOpenSearchIndex() error

CreateSearchIndex builds a search index for the cars

func (*CarManager) DeIndexCar added in v1.4.0

func (cm *CarManager) DeIndexCar(name string) error

DeIndexCar removes a car from the index.

func (*CarManager) DelTag added in v1.4.0

func (cm *CarManager) DelTag(carName, tag string) error

func (*CarManager) DeleteCar added in v1.4.0

func (cm *CarManager) DeleteCar(carName string) error

DeleteCar removes a car from the file system and search index.

func (*CarManager) DeleteSkin added in v1.4.0

func (cm *CarManager) DeleteSkin(car, skin string) error

func (*CarManager) IndexAllCars added in v1.4.0

func (cm *CarManager) IndexAllCars() error

IndexAllCars loads all current cars and adds them to the search index

func (*CarManager) IndexCar added in v1.4.0

func (cm *CarManager) IndexCar(car *Car) error

IndexCar indexes an individual car.

func (*CarManager) ListCars added in v1.4.0

func (cm *CarManager) ListCars() (Cars, error)

func (*CarManager) LoadCar added in v1.4.0

func (cm *CarManager) LoadCar(name string, tyres Tyres) (*Car, error)

LoadCar reads a car from the content folder on the filesystem

func (*CarManager) LoadCarDetailsForTemplate added in v1.4.0

func (cm *CarManager) LoadCarDetailsForTemplate(carName string) (*carDetailsTemplateVars, error)

LoadCarDetailsForTemplate loads all necessary items to generate the car details template.

func (*CarManager) RandomSkin added in v1.6.1

func (cm *CarManager) RandomSkin(model string) string

func (*CarManager) ResultsForCar added in v1.4.0

func (cm *CarManager) ResultsForCar(car string) ([]SessionResults, error)

ResultsForCar finds results for a given car.

func (*CarManager) SaveCarDetails added in v1.4.0

func (cm *CarManager) SaveCarDetails(carName string, car *Car) error

SaveCarDetails saves a car's details, and indexes that car.

func (*CarManager) Search added in v1.4.0

func (cm *CarManager) Search(ctx context.Context, term string, from, size int) (*bleve.SearchResult, Cars, error)

Search looks for cars in the search index.

func (*CarManager) UpdateCarMetadata added in v1.4.0

func (cm *CarManager) UpdateCarMetadata(carName string, r *http.Request) error

func (*CarManager) UploadSkin added in v1.4.0

func (cm *CarManager) UploadSkin(carName string, files map[string][]*multipart.FileHeader) error

type CarSetups added in v1.2.0

type CarSetups map[string]map[string][]string

CarSetups is a map of car name to the setups for that car. it is a map of car name => track name => []setup

func ListAllSetups added in v1.4.0

func ListAllSetups() (CarSetups, error)

type CarSpecs added in v1.4.0

type CarSpecs struct {
	Acceleration string `json:"acceleration"`
	BHP          string `json:"bhp"`
	PWRatio      string `json:"pwratio"`
	TopSpeed     string `json:"topspeed"`
	Torque       string `json:"torque"`
	Weight       string `json:"weight"`
}

func (CarSpecs) Numeric added in v1.4.0

func (cs CarSpecs) Numeric() CarSpecsNumeric

type CarSpecsNumeric added in v1.4.0

type CarSpecsNumeric struct {
	Acceleration int `json:"acceleration"`
	BHP          int `json:"bhp"`
	PWRatio      int `json:"pwratio"`
	TopSpeed     int `json:"topspeed"`
	Torque       int `json:"torque"`
	Weight       int `json:"weight"`
}

type Cars

type Cars []*Car

func (Cars) AsMap

func (cs Cars) AsMap() map[string][]string

type CarsHandler added in v1.4.0

type CarsHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewCarsHandler added in v1.4.0

func NewCarsHandler(baseHandler *BaseHandler, carManager *CarManager) *CarsHandler

type Championship

type Championship struct {
	ID                  uuid.UUID
	Name                string
	Created             time.Time
	Updated             time.Time
	Deleted             time.Time
	OverridePassword    bool
	ReplacementPassword string

	// acsr integration - sends the championship to acsr on save and event complete
	ACSR bool

	// Raw html can be attached to championships, used to share tracks/cars etc.
	Info template.HTML

	// URL to a specific OG Image for the championship
	OGImage string

	// OpenEntrants indicates that entrant names do not need to be specified in the EntryList.
	// As Entrants join a championship, the available Entrant slots will be filled by the information
	// provided by a join message. The EntryList for each class will still need creating, but
	// can omit names/GUIDs/teams as necessary. These can then be edited after the fact.
	OpenEntrants bool

	// PersistOpenEntrants (used with OpenEntrants) indicates that drivers who join the Championship
	// should be added to the Championship EntryList. This is ON by default.
	PersistOpenEntrants bool

	// SignUpForm gives anyone on the web access to a Championship Sign Up Form so that they can
	// mark themselves for participation in this Championship.
	SignUpForm ChampionshipSignUpForm

	Classes []*ChampionshipClass
	Events  []*ChampionshipEvent
	// contains filtered or unexported fields
}

A Championship is a collection of ChampionshipEvents for a group of Entrants. Each Entrant in a Championship is awarded Points for their position in a ChampionshipEvent.

func NewChampionship

func NewChampionship(name string) *Championship

NewChampionship creates a Championship with a given name, creating a UUID for the championship as well.

func (*Championship) AddClass

func (c *Championship) AddClass(class *ChampionshipClass)

AddClass to the championship

func (*Championship) AddEntrantFromSession added in v1.3.0

func (c *Championship) AddEntrantFromSession(potentialEntrant PotentialChampionshipEntrant) (foundFreeEntrantSlot bool, entrant *Entrant, entrantClass *ChampionshipClass, err error)

func (*Championship) AddEntrantInFirstFreeSlot added in v1.4.2

func (c *Championship) AddEntrantInFirstFreeSlot(potentialEntrant PotentialChampionshipEntrant) (foundFreeEntrantSlot bool, entrant *Entrant, entrantClass *ChampionshipClass, err error)

func (*Championship) AllEntrants

func (c *Championship) AllEntrants() EntryList

AllEntrants returns the list of all entrants in the championship (across ALL classes)

func (*Championship) AttachClassIDToResults added in v1.4.2

func (c *Championship) AttachClassIDToResults(results *SessionResults)

func (*Championship) ClassByID added in v1.3.0

func (c *Championship) ClassByID(id string) (*ChampionshipClass, error)

ClassByID finds a ChampionshipClass by its ID string.

func (*Championship) ClearEntrant added in v1.3.1

func (c *Championship) ClearEntrant(entrantGUID string)

func (*Championship) EnhanceResults added in v1.2.0

func (c *Championship) EnhanceResults(results *SessionResults)

EnhanceResults takes a set of SessionResults and attaches Championship information to them.

func (*Championship) EntrantAttendance added in v1.5.1

func (c *Championship) EntrantAttendance(guid string) int

func (*Championship) EventByID

func (c *Championship) EventByID(id string) (*ChampionshipEvent, error)

EventByID finds a ChampionshipEvent by its ID string.

func (*Championship) FindClassForCarModel

func (c *Championship) FindClassForCarModel(model string) (*ChampionshipClass, error)

func (*Championship) FindLastResultForDriver added in v1.4.2

func (c *Championship) FindLastResultForDriver(guid string) (out *SessionResult, teamName string)

func (*Championship) GetPlayerSummary added in v1.1.0

func (c *Championship) GetPlayerSummary(guid string) string

func (*Championship) GetURL added in v1.5.0

func (c *Championship) GetURL() string

func (*Championship) HasScheduledEvents added in v1.2.1

func (c *Championship) HasScheduledEvents() bool

func (*Championship) HasTeamNames added in v1.3.1

func (c *Championship) HasTeamNames() bool

func (*Championship) ImportEvent added in v1.6.0

func (c *Championship) ImportEvent(eventToImport interface{}) error

func (*Championship) IsMultiClass

func (c *Championship) IsMultiClass() bool

IsMultiClass is true if the Championship has more than one Class

func (*Championship) NumCompletedEvents added in v1.5.1

func (c *Championship) NumCompletedEvents() int

func (*Championship) NumEntrants

func (c *Championship) NumEntrants() int

NumEntrants is the number of entrants across all Classes in a Championship.

func (*Championship) NumPendingSignUps added in v1.4.2

func (c *Championship) NumPendingSignUps() int

func (*Championship) Progress

func (c *Championship) Progress() float64

Progress of the Championship as a percentage

func (*Championship) SignUpAvailable added in v1.5.0

func (c *Championship) SignUpAvailable() bool

func (*Championship) ValidCarIDs

func (c *Championship) ValidCarIDs() []string

ValidCarIDs returns a set of all of the valid cars in the Championship - that is, the smallest possible list of Cars driven by the Entrants.

type ChampionshipClass

type ChampionshipClass struct {
	ID   uuid.UUID
	Name string

	Entrants      EntryList
	Points        ChampionshipPoints
	AvailableCars []string

	DriverPenalties, TeamPenalties map[string]int
}

ChampionshipClass contains a Name, Entrants (including Cars, Skins) and Points for those Entrants

func NewChampionshipClass

func NewChampionshipClass(name string) *ChampionshipClass

NewChampionshipClass creates a championship class with the default points

func (*ChampionshipClass) AssignToFreeEntrantSlot added in v1.5.1

func (c *ChampionshipClass) AssignToFreeEntrantSlot(entrant *Entrant, potentialEntrant PotentialChampionshipEntrant)

func (*ChampionshipClass) AttachEntrantToResult added in v1.2.0

func (c *ChampionshipClass) AttachEntrantToResult(entrant *Entrant, results *SessionResults)

func (*ChampionshipClass) DriverInClass added in v1.2.0

func (c *ChampionshipClass) DriverInClass(result *SessionResult) bool

func (*ChampionshipClass) PenaltyForGUID added in v1.3.0

func (c *ChampionshipClass) PenaltyForGUID(guid string) int

func (*ChampionshipClass) PenaltyForTeam added in v1.3.0

func (c *ChampionshipClass) PenaltyForTeam(name string) int

func (*ChampionshipClass) ResultsForClass

func (c *ChampionshipClass) ResultsForClass(results []*SessionResult) (filtered []*SessionResult)

func (*ChampionshipClass) Standings

func (c *ChampionshipClass) Standings(inEvents []*ChampionshipEvent) []*ChampionshipStanding

Standings returns the current Driver Standings for the Championship.

func (*ChampionshipClass) StandingsForEvent added in v1.3.2

func (c *ChampionshipClass) StandingsForEvent(event *ChampionshipEvent) []*ChampionshipStanding

func (*ChampionshipClass) TeamStandings

func (c *ChampionshipClass) TeamStandings(inEvents []*ChampionshipEvent) []*TeamStanding

TeamStandings returns the current position of Teams in the Championship.

func (*ChampionshipClass) ValidCarIDs

func (c *ChampionshipClass) ValidCarIDs() []string

ValidCarIDs returns a set of all cars chosen within the given class

type ChampionshipEntrantStatus added in v1.3.0

type ChampionshipEntrantStatus string

type ChampionshipEvent

type ChampionshipEvent struct {
	ScheduledEventBase

	ID uuid.UUID

	RaceSetup CurrentRaceConfig
	EntryList EntryList

	Sessions map[SessionType]*ChampionshipSession `json:",omitempty"`

	// RaceWeekendID is the ID of the linked RaceWeekend for this ChampionshipEvent
	RaceWeekendID uuid.UUID
	// If RaceWeekendID is non-nil, RaceWeekend will be populated on loading the Championship.
	RaceWeekend *RaceWeekend

	StartedTime   time.Time
	CompletedTime time.Time
	// contains filtered or unexported fields
}

A ChampionshipEvent is a given RaceSetup with Sessions.

func DuplicateChampionshipEvent added in v1.5.1

func DuplicateChampionshipEvent(event *ChampionshipEvent) *ChampionshipEvent

copied an existing ChampionshipEvent but assigns a new ID

func ExtractRaceWeekendSessionsIntoIndividualEvents added in v1.5.0

func ExtractRaceWeekendSessionsIntoIndividualEvents(inEvents []*ChampionshipEvent) []*ChampionshipEvent

extractRaceWeekendSessionsIntoIndividualEvents looks for race weekend events, and makes each indiivdual session of that race weekend a Championship Event, to aide with points tallying

func NewChampionshipEvent

func NewChampionshipEvent() *ChampionshipEvent

NewChampionshipEvent creates a ChampionshipEvent with an ID

func (*ChampionshipEvent) Cars added in v1.2.0

func (cr *ChampionshipEvent) Cars(c *Championship) []string

func (*ChampionshipEvent) CombineEntryLists added in v1.2.0

func (cr *ChampionshipEvent) CombineEntryLists(championship *Championship) EntryList

func (*ChampionshipEvent) Completed

func (cr *ChampionshipEvent) Completed() bool

Completed ChampionshipEvents have a non-zero CompletedTime

func (*ChampionshipEvent) GetID added in v1.2.1

func (cr *ChampionshipEvent) GetID() uuid.UUID

func (*ChampionshipEvent) GetRaceSetup added in v1.2.1

func (cr *ChampionshipEvent) GetRaceSetup() CurrentRaceConfig

func (*ChampionshipEvent) GetSummary added in v1.2.1

func (cr *ChampionshipEvent) GetSummary() string

func (*ChampionshipEvent) GetURL added in v1.2.1

func (cr *ChampionshipEvent) GetURL() string

func (*ChampionshipEvent) HasSignUpForm added in v1.4.0

func (cr *ChampionshipEvent) HasSignUpForm() bool

func (*ChampionshipEvent) InProgress

func (cr *ChampionshipEvent) InProgress() bool

InProgress indicates whether a ChampionshipEvent has been started but not stopped

func (*ChampionshipEvent) IsRaceWeekend added in v1.5.0

func (cr *ChampionshipEvent) IsRaceWeekend() bool

func (*ChampionshipEvent) LastSession

func (cr *ChampionshipEvent) LastSession() SessionType

LastSession returns the last configured session in the championship, in the following order: Race, Qualifying, Practice, Booking

func (*ChampionshipEvent) ReadOnlyEntryList added in v1.3.3

func (cr *ChampionshipEvent) ReadOnlyEntryList() EntryList

type ChampionshipManager

type ChampionshipManager struct {
	*RaceManager
	// contains filtered or unexported fields
}

func NewChampionshipManager

func NewChampionshipManager(raceManager *RaceManager) *ChampionshipManager

func (*ChampionshipManager) AddEntrantFromSessionData added in v1.4.0

func (cm *ChampionshipManager) AddEntrantFromSessionData(championship *Championship, potentialEntrant PotentialChampionshipEntrant, overwriteSkinForAllEvents bool, takeFirstFreeSlot bool) (foundFreeEntrantSlot bool, entrantClass *ChampionshipClass, err error)

func (*ChampionshipManager) BuildChampionshipEventOpts

func (cm *ChampionshipManager) BuildChampionshipEventOpts(r *http.Request) (*RaceTemplateVars, error)

func (*ChampionshipManager) BuildChampionshipOpts

func (cm *ChampionshipManager) BuildChampionshipOpts(r *http.Request) (championship *Championship, opts *ChampionshipTemplateVars, err error)

func (*ChampionshipManager) BuildICalFeed added in v1.2.1

func (cm *ChampionshipManager) BuildICalFeed(championshipID string, w io.Writer) error

func (*ChampionshipManager) CancelEvent

func (cm *ChampionshipManager) CancelEvent(championshipID string, eventID string) error

func (*ChampionshipManager) ChampionshipEventCallback

func (cm *ChampionshipManager) ChampionshipEventCallback(message udp.Message)

func (*ChampionshipManager) ChampionshipEventIsRunning added in v1.5.3

func (cm *ChampionshipManager) ChampionshipEventIsRunning() bool

func (*ChampionshipManager) DeleteChampionship

func (cm *ChampionshipManager) DeleteChampionship(id string) error

func (*ChampionshipManager) DeleteEvent

func (cm *ChampionshipManager) DeleteEvent(championshipID string, eventID string) error

func (*ChampionshipManager) FindNextEventRecurrence added in v1.5.1

func (cm *ChampionshipManager) FindNextEventRecurrence(event *ChampionshipEvent, start time.Time) time.Time

func (*ChampionshipManager) GetChampionshipAndEvent added in v1.1.0

func (cm *ChampionshipManager) GetChampionshipAndEvent(championshipID string, eventID string) (*Championship, *ChampionshipEvent, error)

func (*ChampionshipManager) HandleChampionshipSignUp added in v1.3.0

func (cm *ChampionshipManager) HandleChampionshipSignUp(r *http.Request) (response *ChampionshipSignUpResponse, foundSlot bool, err error)

func (*ChampionshipManager) HandleCreateChampionship

func (cm *ChampionshipManager) HandleCreateChampionship(r *http.Request) (championship *Championship, edited bool, err error)

func (*ChampionshipManager) ImportChampionship added in v1.3.0

func (cm *ChampionshipManager) ImportChampionship(jsonData string) (string, error)

func (*ChampionshipManager) ImportEvent added in v1.2.0

func (cm *ChampionshipManager) ImportEvent(championshipID string, eventID string, r *http.Request) error

func (*ChampionshipManager) ImportEventSetup added in v1.6.0

func (cm *ChampionshipManager) ImportEventSetup(championshipID string, eventID string) error

func (*ChampionshipManager) ImportRaceWeekendSetup added in v1.6.0

func (cm *ChampionshipManager) ImportRaceWeekendSetup(championshipID string, eventID string) error

func (*ChampionshipManager) InitScheduledChampionships added in v1.4.0

func (cm *ChampionshipManager) InitScheduledChampionships() error

func (*ChampionshipManager) ListAvailableResultsFilesForEvent added in v1.2.0

func (cm *ChampionshipManager) ListAvailableResultsFilesForEvent(championshipID string, eventID string) (*ChampionshipEvent, []SessionResults, error)

func (*ChampionshipManager) ListChampionships

func (cm *ChampionshipManager) ListChampionships() ([]*Championship, error)

func (*ChampionshipManager) LoadChampionship

func (cm *ChampionshipManager) LoadChampionship(id string) (*Championship, error)

func (*ChampionshipManager) ModifyDriverPenalty added in v1.3.0

func (cm *ChampionshipManager) ModifyDriverPenalty(championshipID, classID, driverGUID string, action PenaltyAction, penalty int) error

func (*ChampionshipManager) ModifyTeamPenalty added in v1.3.0

func (cm *ChampionshipManager) ModifyTeamPenalty(championshipID, classID, team string, action PenaltyAction, penalty int) error

func (*ChampionshipManager) ReorderChampionshipEvents added in v1.5.0

func (cm *ChampionshipManager) ReorderChampionshipEvents(championshipID string, championshipEventIDsInOrder []string) error

func (*ChampionshipManager) RestartActiveEvent added in v1.2.0

func (cm *ChampionshipManager) RestartActiveEvent() error

func (*ChampionshipManager) RestartEvent

func (cm *ChampionshipManager) RestartEvent(championshipID string, eventID string) error

func (*ChampionshipManager) SaveChampionshipEvent

func (cm *ChampionshipManager) SaveChampionshipEvent(r *http.Request) (championship *Championship, event *ChampionshipEvent, edited bool, err error)

func (*ChampionshipManager) ScheduleEvent added in v1.1.0

func (cm *ChampionshipManager) ScheduleEvent(championshipID string, eventID string, date time.Time, action string, recurrence string) error

func (*ChampionshipManager) ScheduleNextEventFromRecurrence added in v1.5.1

func (cm *ChampionshipManager) ScheduleNextEventFromRecurrence(championship *Championship, event *ChampionshipEvent) error

func (*ChampionshipManager) StartEvent

func (cm *ChampionshipManager) StartEvent(championshipID string, eventID string, isPreChampionshipPracticeEvent bool) error

func (*ChampionshipManager) StartPracticeEvent

func (cm *ChampionshipManager) StartPracticeEvent(championshipID string, eventID string) error

Start a 2hr long Practice Event based off the existing championship event with eventID

func (*ChampionshipManager) StartScheduledEvent added in v1.5.1

func (cm *ChampionshipManager) StartScheduledEvent(championship *Championship, event *ChampionshipEvent) error

func (*ChampionshipManager) StopActiveEvent added in v1.2.0

func (cm *ChampionshipManager) StopActiveEvent() error

func (*ChampionshipManager) UpsertChampionship

func (cm *ChampionshipManager) UpsertChampionship(c *Championship) error

type ChampionshipPoints

type ChampionshipPoints struct {
	Places       []int
	BestLap      int
	PolePosition int

	CollisionWithDriver int
	CollisionWithEnv    int
	CutTrack            int

	SecondRaceMultiplier float64
}

ChampionshipPoints represent the potential points for positions as well as other awards in a Championship.

func (*ChampionshipPoints) ForPos added in v1.5.0

func (pts *ChampionshipPoints) ForPos(i int) float64

PointForPos uses the Championship's Points to determine what number should be awarded to a given position

type ChampionshipSession

type ChampionshipSession struct {
	StartedTime   time.Time
	CompletedTime time.Time

	Results *SessionResults

	RaceWeekendSession *RaceWeekendSession
}

A ChampionshipSession contains information found from the live portion of the Championship tool

func (*ChampionshipSession) Completed

func (ce *ChampionshipSession) Completed() bool

Completed ChampionshipSessions have a non-zero CompletedTime

func (*ChampionshipSession) InProgress

func (ce *ChampionshipSession) InProgress() bool

InProgress indicates whether a ChampionshipSession has been started but not stopped

func (*ChampionshipSession) IsRaceWeekend added in v1.5.0

func (ce *ChampionshipSession) IsRaceWeekend() bool

type ChampionshipSignUpForm added in v1.3.0

type ChampionshipSignUpForm struct {
	Enabled          bool
	AskForEmail      bool
	AskForTeam       bool
	HideCarChoice    bool
	ExtraFields      []string
	RequiresApproval bool

	Responses []*ChampionshipSignUpResponse
}

func (ChampionshipSignUpForm) EmailList added in v1.3.0

func (c ChampionshipSignUpForm) EmailList(group string) string

type ChampionshipSignUpResponse added in v1.3.0

type ChampionshipSignUpResponse struct {
	Created time.Time

	Name      string
	GUID      string
	Team      string
	Email     string
	Car       string
	Skin      string
	Questions map[string]string

	Status ChampionshipEntrantStatus
}

func (ChampionshipSignUpResponse) GetCar added in v1.3.0

func (csr ChampionshipSignUpResponse) GetCar() string

func (ChampionshipSignUpResponse) GetGUID added in v1.3.0

func (csr ChampionshipSignUpResponse) GetGUID() string

func (ChampionshipSignUpResponse) GetName added in v1.3.0

func (csr ChampionshipSignUpResponse) GetName() string

func (ChampionshipSignUpResponse) GetSkin added in v1.3.0

func (csr ChampionshipSignUpResponse) GetSkin() string

func (ChampionshipSignUpResponse) GetTeam added in v1.3.0

func (csr ChampionshipSignUpResponse) GetTeam() string

type ChampionshipStanding

type ChampionshipStanding struct {
	Car *SessionCar

	// Teams is a map of Team Name to how many Events per team were completed.
	Teams  map[string]int
	Points float64
}

ChampionshipStanding is the current number of Points an Entrant in the Championship has.

func NewChampionshipStanding added in v1.2.0

func NewChampionshipStanding(car *SessionCar) *ChampionshipStanding

func (*ChampionshipStanding) AddEventForTeam added in v1.2.0

func (cs *ChampionshipStanding) AddEventForTeam(team string)

func (*ChampionshipStanding) TeamSummary added in v1.2.0

func (cs *ChampionshipStanding) TeamSummary() string

type ChampionshipStandingsOrderEntryListSort added in v1.5.3

type ChampionshipStandingsOrderEntryListSort struct{}

func (ChampionshipStandingsOrderEntryListSort) Sort added in v1.5.3

type ChampionshipTemplateVars added in v1.5.0

type ChampionshipTemplateVars struct {
	*RaceTemplateVars

	DefaultPoints ChampionshipPoints
	DefaultClass  *ChampionshipClass
	ACSREnabled   bool
}

type ChampionshipsConfig added in v1.3.0

type ChampionshipsConfig struct {
	RecaptchaConfig struct {
		SiteKey   string `yaml:"site_key"`
		SecretKey string `yaml:"secret_key"`
	} `yaml:"recaptcha"`
}

type ChampionshipsHandler added in v1.4.0

type ChampionshipsHandler struct {
	*BaseHandler
	SteamLoginHandler
	// contains filtered or unexported fields
}

func NewChampionshipsHandler added in v1.4.0

func NewChampionshipsHandler(baseHandler *BaseHandler, championshipManager *ChampionshipManager) *ChampionshipsHandler

type Collision

type Collision struct {
	ID              string         `json:"ID"`
	Type            CollisionType  `json:"Type"`
	Time            time.Time      `json:"Time" ts:"date"`
	OtherDriverGUID udp.DriverGUID `json:"OtherDriverGUID"`
	OtherDriverName string         `json:"OtherDriverName"`
	Speed           float64        `json:"Speed"`
}

type CollisionType added in v1.3.3

type CollisionType string
const (
	CollisionWithCar         CollisionType = "with other car"
	CollisionWithEnvironment CollisionType = "with environment"
)

type CommandPlugin added in v1.6.1

type CommandPlugin struct {
	Executable string   `yaml:"executable"`
	Arguments  []string `yaml:"arguments"`
}

func (*CommandPlugin) String added in v1.6.1

func (c *CommandPlugin) String() string

type Configuration

type Configuration struct {
	HTTP          HTTPConfig          `yaml:"http"`
	Steam         SteamConfig         `yaml:"steam"`
	Store         StoreConfig         `yaml:"store"`
	LiveMap       LiveMapConfig       `yaml:"live_map"`
	Server        ServerExtraConfig   `yaml:"server"`
	Accounts      AccountsConfig      `yaml:"accounts"`
	Monitoring    MonitoringConfig    `yaml:"monitoring"`
	Championships ChampionshipsConfig `yaml:"championships"`
	ACSR          ACSRConfig          `yaml:"acsr"`
	Lua           LuaConfig           `yaml:"lua"`
}

func ReadConfig

func ReadConfig(location string) (conf *Configuration, err error)

type ContentFile

type ContentFile struct {
	Name     string `json:"name"`
	FileType string `json:"type"`
	FilePath string `json:"filepath"`
	Data     string `json:"dataBase64"`
	Size     int    `json:"size"`
}

type ContentManagerWrapper added in v1.4.0

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

func NewContentManagerWrapper added in v1.4.0

func NewContentManagerWrapper(store Store, carManager *CarManager, trackManager *TrackManager) *ContentManagerWrapper

func (*ContentManagerWrapper) NewCMContent added in v1.5.3

func (cmw *ContentManagerWrapper) NewCMContent(cars []string, trackName string) (*CMContent, error)

func (*ContentManagerWrapper) ServeHTTP added in v1.4.0

func (cmw *ContentManagerWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ContentManagerWrapper) Start added in v1.4.0

func (cmw *ContentManagerWrapper) Start(process ServerProcess, servePort int, serverConfig ServerConfig, entryList EntryList, event RaceEvent) error

func (*ContentManagerWrapper) Stop added in v1.4.0

func (cmw *ContentManagerWrapper) Stop()

func (*ContentManagerWrapper) UDPCallback added in v1.4.0

func (cmw *ContentManagerWrapper) UDPCallback(message udp.Message)

type ContentManagerWrapperData added in v1.4.0

type ContentManagerWrapperData struct {
	ACHTTPSessionInfo
	Players ACHTTPPlayers `json:"players"`

	Description string `json:"description"`

	AmbientTemperature uint8  `json:"ambientTemperature"`
	RoadTemperature    uint8  `json:"roadTemperature"`
	WindDirection      int    `json:"windDirection"`
	WindSpeed          int    `json:"windSpeed"`
	CurrentWeatherID   string `json:"currentWeatherId"`
	Grip               int    `json:"grip"`
	GripTransfer       int    `json:"gripTransfer"`

	Assists          CMAssists `json:"assists"`
	MaxContactsPerKM int       `json:"maxContactsPerKm"`

	City             string    `json:"city"`
	PasswordChecksum [2]string `json:"passwordChecksum"`
	WrappedPort      int       `json:"wrappedPort"`

	Content   *CMContent `json:"content"`
	Frequency int        `json:"frequency"`
	Until     int64      `json:"until"`
}

type ContentType added in v1.4.0

type ContentType string

type ContentURL added in v1.5.3

type ContentURL struct {
	URL string `json:"url"`
}

type ContentUploadHandler added in v1.4.0

type ContentUploadHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewContentUploadHandler added in v1.4.0

func NewContentUploadHandler(baseHandler *BaseHandler, carManager *CarManager) *ContentUploadHandler

type CurrentRaceConfig

type CurrentRaceConfig struct {
	Cars                      string `ini:"CARS" show:"quick" input:"multiSelect" formopts:"CarOpts" help:"Models of cars allowed in the server"`
	Track                     string `ini:"TRACK" show:"quick" input:"dropdown" formopts:"TrackOpts" help:"Track name"`
	TrackLayout               string `` /* 128-byte string literal not displayed */
	SunAngle                  int    `ini:"SUN_ANGLE" help:"Angle of the position of the sun"`
	LegalTyres                string `ini:"LEGAL_TYRES" help:"List of tyres short names that are allowed"`
	FuelRate                  int    `ini:"FUEL_RATE" min:"0" help:"Fuel usage from 0 (no fuel usage) to XXX (100 is the realistic one)"`
	DamageMultiplier          int    `ini:"DAMAGE_MULTIPLIER" min:"0" max:"100" help:"Damage from 0 (no damage) to 100 (full damage)"`
	TyreWearRate              int    `ini:"TYRE_WEAR_RATE" min:"0" help:"Tyre wear from 0 (no tyre wear) to XXX (100 is the realistic one)"`
	AllowedTyresOut           int    `ini:"ALLOWED_TYRES_OUT" help:"TODO: I have no idea"`
	ABSAllowed                int    `` /* 133-byte string literal not displayed */
	TractionControlAllowed    int    `` /* 129-byte string literal not displayed */
	StabilityControlAllowed   int    `ini:"STABILITY_ALLOWED" input:"checkbox" help:"Stability assist 0 -> OFF; 1 -> ON"`
	AutoClutchAllowed         int    `ini:"AUTOCLUTCH_ALLOWED" input:"checkbox" help:"Autoclutch assist 0 -> OFF; 1 -> ON"`
	TyreBlanketsAllowed       int    `` /* 147-byte string literal not displayed */
	ForceVirtualMirror        int    `` /* 126-byte string literal not displayed */
	RacePitWindowStart        int    `ini:"RACE_PIT_WINDOW_START" help:"pit window opens at lap/minute specified"`
	RacePitWindowEnd          int    `ini:"RACE_PIT_WINDOW_END" help:"pit window closes at lap/minute specified"`
	ReversedGridRacePositions int    `` /* 216-byte string literal not displayed */
	TimeOfDayMultiplier       int    `ini:"TIME_OF_DAY_MULT" help:"multiplier for the time of day"`
	QualifyMaxWaitPercentage  int    `` /* 205-byte string literal not displayed */
	RaceGasPenaltyDisabled    int    `` /* 195-byte string literal not displayed */
	MaxBallastKilograms       int    `` /* 131-byte string literal not displayed */
	RaceExtraLap              int    `ini:"RACE_EXTRA_LAP" input:"checkbox" help:"If the race is timed, force an extra lap after the leader has crossed the line"`
	MaxContactsPerKilometer   int    `ini:"MAX_CONTACTS_PER_KM" help:"Maximum number times you can make contact with another car in 1 kilometer."`
	ResultScreenTime          int    `ini:"RESULT_SCREEN_TIME" help:"Seconds of result screen between racing sessions"`

	PickupModeEnabled int `` /* 227-byte string literal not displayed */
	LockedEntryList   int `ini:"LOCKED_ENTRY_LIST" input:"checkbox" help:"Only players already included in the entry list can join the server"`
	LoopMode          int `ini:"LOOP_MODE" input:"checkbox" help:"the server restarts from the first track, to disable this set it to 0"`

	MaxClients   int `ini:"MAX_CLIENTS" help:"max number of clients (must be <= track's number of pits)"`
	RaceOverTime int `` /* 128-byte string literal not displayed */
	StartRule    int `` /* 173-byte string literal not displayed */

	IsSol int `` /* 138-byte string literal not displayed */

	WindBaseSpeedMin       int `ini:"WIND_BASE_SPEED_MIN" help:"Min speed of the session possible"`
	WindBaseSpeedMax       int `ini:"WIND_BASE_SPEED_MAX" help:"Max speed of session possible (max 40)"`
	WindBaseDirection      int `ini:"WIND_BASE_DIRECTION" help:"base direction of the wind (wind is pointing at); 0 = North, 90 = East etc"`
	WindVariationDirection int `ini:"WIND_VARIATION_DIRECTION" help:"variation (+ or -) of the base direction"`

	DisableDRSZones bool `ini:"-"`

	DynamicTrack DynamicTrackConfig `ini:"-"`

	Sessions Sessions                  `ini:"-"`
	Weather  map[string]*WeatherConfig `ini:"-"`
}

func (*CurrentRaceConfig) AddSession

func (c *CurrentRaceConfig) AddSession(sessionType SessionType, config *SessionConfig)

func (*CurrentRaceConfig) AddWeather

func (c *CurrentRaceConfig) AddWeather(weather *WeatherConfig)

func (CurrentRaceConfig) GetSession added in v1.5.0

func (c CurrentRaceConfig) GetSession(sessionType SessionType) *SessionConfig

func (CurrentRaceConfig) HasMultipleRaces added in v1.1.0

func (c CurrentRaceConfig) HasMultipleRaces() bool

func (CurrentRaceConfig) HasSession

func (c CurrentRaceConfig) HasSession(sess SessionType) bool

func (*CurrentRaceConfig) RemoveSession

func (c *CurrentRaceConfig) RemoveSession(sessionType SessionType)

func (*CurrentRaceConfig) RemoveWeather

func (c *CurrentRaceConfig) RemoveWeather(weather *WeatherConfig)

func (CurrentRaceConfig) Tyres added in v1.5.1

func (c CurrentRaceConfig) Tyres() map[string]bool

type CustomRace

type CustomRace struct {
	ScheduledEventBase

	Name                            string
	HasCustomName, OverridePassword bool
	ReplacementPassword             string

	Created       time.Time
	Updated       time.Time
	Deleted       time.Time
	UUID          uuid.UUID
	Starred, Loop bool

	RaceConfig CurrentRaceConfig
	EntryList  EntryList
}

func (*CustomRace) EventDescription added in v1.4.0

func (cr *CustomRace) EventDescription() string

func (*CustomRace) EventName added in v1.3.0

func (cr *CustomRace) EventName() string

func (*CustomRace) GetEntryList added in v1.2.1

func (cr *CustomRace) GetEntryList() EntryList

func (*CustomRace) GetID added in v1.2.1

func (cr *CustomRace) GetID() uuid.UUID

func (*CustomRace) GetRaceConfig added in v1.5.3

func (cr *CustomRace) GetRaceConfig() CurrentRaceConfig

func (*CustomRace) GetRaceSetup added in v1.2.1

func (cr *CustomRace) GetRaceSetup() CurrentRaceConfig

func (*CustomRace) GetSummary added in v1.2.1

func (cr *CustomRace) GetSummary() string

func (*CustomRace) GetURL added in v1.2.1

func (cr *CustomRace) GetURL() string

func (*CustomRace) HasSignUpForm added in v1.4.0

func (cr *CustomRace) HasSignUpForm() bool

func (*CustomRace) IsChampionship added in v1.3.0

func (cr *CustomRace) IsChampionship() bool

func (*CustomRace) IsLooping added in v1.5.3

func (cr *CustomRace) IsLooping() bool

func (*CustomRace) IsPractice added in v1.5.3

func (cr *CustomRace) IsPractice() bool

func (*CustomRace) IsRaceWeekend added in v1.5.0

func (cr *CustomRace) IsRaceWeekend() bool

func (*CustomRace) OverrideServerPassword added in v1.3.0

func (cr *CustomRace) OverrideServerPassword() bool

func (*CustomRace) ReadOnlyEntryList added in v1.3.3

func (cr *CustomRace) ReadOnlyEntryList() EntryList

func (*CustomRace) ReplacementServerPassword added in v1.3.0

func (cr *CustomRace) ReplacementServerPassword() string

type CustomRaceHandler added in v1.4.0

type CustomRaceHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewCustomRaceHandler added in v1.4.0

func NewCustomRaceHandler(base *BaseHandler, raceManager *RaceManager) *CustomRaceHandler

type DiscordManager added in v1.5.0

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

func NewDiscordManager added in v1.5.0

func NewDiscordManager(store Store, scheduledRacesManager *ScheduledRacesManager) (*DiscordManager, error)

NewDiscordManager instantiates the DiscordManager type. On error, it will log the error and return the type flagged as disabled

func (*DiscordManager) CommandHandler added in v1.5.0

func (dm *DiscordManager) CommandHandler(s *discordgo.Session, m *discordgo.MessageCreate)

func (*DiscordManager) CommandNotify added in v1.5.2

func (dm *DiscordManager) CommandNotify(s *discordgo.Session, m *discordgo.MessageCreate) (string, error)

CommandNotify attempts to add a role ID (if configured) to the user issuing the !notify command The role will be added as a mention on all Discord notifications

func (*DiscordManager) CommandSchedule added in v1.5.2

func (dm *DiscordManager) CommandSchedule() (string, error)

CommandSchedule outputs an abbreviated list of all scheduled events

func (*DiscordManager) CommandSessions added in v1.5.2

func (dm *DiscordManager) CommandSessions() (string, error)

CommandSessions outputs a full list of all scheduled sessions (P, Q & R), using buildCalendar as a base

func (*DiscordManager) SaveServerOptions added in v1.5.0

func (dm *DiscordManager) SaveServerOptions(oldServerOpts *GlobalServerConfig, newServerOpts *GlobalServerConfig) error

func (*DiscordManager) SendMessage added in v1.5.0

func (dm *DiscordManager) SendMessage(msg string) error

SendMessage sends a message to the configured channel and logs any errors

func (dm *DiscordManager) SendMessageWithLink(msg string, linkText string, link *url.URL) error

SendMessage sends a message to the configured channel and logs any errors

func (*DiscordManager) Stop added in v1.5.0

func (dm *DiscordManager) Stop() error

type DriverMap added in v1.3.3

type DriverMap struct {
	Drivers                map[udp.DriverGUID]*RaceControlDriver `json:"Drivers"`
	GUIDsInPositionalOrder []udp.DriverGUID                      `json:"GUIDsInPositionalOrder"`
	// contains filtered or unexported fields
}

func NewDriverMap added in v1.3.3

func NewDriverMap(driverGroup RaceControlDriverGroup, driverSortLessFunc driverSortLessFunc) *DriverMap

func (*DriverMap) Add added in v1.3.3

func (d *DriverMap) Add(driverGUID udp.DriverGUID, driver *RaceControlDriver)

func (*DriverMap) Del added in v1.3.3

func (d *DriverMap) Del(driverGUID udp.DriverGUID)

func (*DriverMap) Each added in v1.3.3

func (d *DriverMap) Each(fn func(driverGUID udp.DriverGUID, driver *RaceControlDriver) error) error

func (*DriverMap) Get added in v1.3.3

func (d *DriverMap) Get(driverGUID udp.DriverGUID) (*RaceControlDriver, bool)

func (*DriverMap) Len added in v1.3.3

func (d *DriverMap) Len() int

type DynamicTrackConfig

type DynamicTrackConfig struct {
	SessionStart    int `ini:"SESSION_START" help:"% level of grip at session start"`
	Randomness      int `ini:"RANDOMNESS" help:"level of randomness added to the start grip"`
	SessionTransfer int `` /* 281-byte string literal not displayed */
	LapGain         int `ini:"LAP_GAIN" help:"how many laps are needed to add 1% grip"`
}

type Entrant

type Entrant struct {
	InternalUUID uuid.UUID `ini:"-"`
	PitBox       int       `ini:"-"`

	Name string `ini:"DRIVERNAME"`
	Team string `ini:"TEAM"`
	GUID string `ini:"GUID"`

	Model string `ini:"MODEL"`
	Skin  string `ini:"SKIN"`

	Ballast       int    `ini:"BALLAST"`
	SpectatorMode int    `ini:"SPECTATOR_MODE"`
	Restrictor    int    `ini:"RESTRICTOR"`
	FixedSetup    string `ini:"FIXED_SETUP"`

	TransferTeamPoints bool `ini:"-" json:"-"`
	OverwriteAllEvents bool `ini:"-" json:"-"`
	IsPlaceHolder      bool `ini:"-"`
}

func NewEntrant added in v1.2.0

func NewEntrant() *Entrant

func (*Entrant) AsSessionCar added in v1.5.0

func (e *Entrant) AsSessionCar() *SessionCar

func (*Entrant) AsSessionResult added in v1.5.0

func (e *Entrant) AsSessionResult() *SessionResult

func (*Entrant) AssignFromResult added in v1.5.0

func (e *Entrant) AssignFromResult(result *SessionResult, car *SessionCar)

func (Entrant) ID

func (e Entrant) ID() string

func (*Entrant) OverwriteProperties added in v1.2.0

func (e *Entrant) OverwriteProperties(other *Entrant)

func (*Entrant) SwapProperties added in v1.4.0

func (e *Entrant) SwapProperties(other *Entrant, entrantRemainedInClass bool)

type EntryList

type EntryList map[string]*Entrant

func (EntryList) Add

func (e EntryList) Add(entrant *Entrant)

Add an Entrant to the EntryList

func (EntryList) AddInPitBox added in v1.5.0

func (e EntryList) AddInPitBox(entrant *Entrant, pitBox int)

AddInPitBox adds an Entrant in a specific pitbox - overwriting any entrant that was in that pitbox previously.

func (EntryList) AlphaSlice added in v1.5.0

func (e EntryList) AlphaSlice() []*Entrant

func (EntryList) AsSlice

func (e EntryList) AsSlice() []*Entrant

func (EntryList) CarIDs added in v1.5.0

func (e EntryList) CarIDs() []string

CarIDs returns a unique list of car IDs used in the EntryList

func (EntryList) Delete

func (e EntryList) Delete(entrant *Entrant)

Remove an Entrant from the EntryList

func (EntryList) Entrants

func (e EntryList) Entrants() string

func (EntryList) FindEntrantByInternalUUID added in v1.2.0

func (e EntryList) FindEntrantByInternalUUID(internalUUID uuid.UUID) *Entrant

func (EntryList) FindGreatestBallast added in v1.6.0

func (e EntryList) FindGreatestBallast() int

returns the greatest ballast set on any entrant

func (EntryList) PrettyList added in v1.2.0

func (e EntryList) PrettyList() []*Entrant

func (EntryList) Write

func (e EntryList) Write() error

Write the EntryList to the server location

type FilterError added in v1.5.0

type FilterError string

func (FilterError) Error added in v1.5.0

func (f FilterError) Error() string

type Form

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

func NewForm

func NewForm(i interface{}, dropdownOpts map[string][]string, visibility string, forceShowAllOptions bool) *Form

func (Form) Fields

func (f Form) Fields() []FormElement

func (Form) Submit

func (f Form) Submit(r *http.Request) error

type FormElement

type FormElement interface {
	HTML() template.HTML
}

type FormHeader

type FormHeader struct {
	Name string
}

func (FormHeader) HTML

func (fh FormHeader) HTML() template.HTML

type FormHeading added in v1.5.0

type FormHeading string

type FormOption

type FormOption struct {
	Name     string
	Key      string
	Type     string
	HelpText template.HTML
	Value    interface{}
	Min, Max string
	Hidden   bool

	Opts map[string]bool
}

func (FormOption) HTML

func (f FormOption) HTML() template.HTML

type GeoIP added in v1.4.0

type GeoIP struct {
	CountryCode string `json:"country_code"`
	CountryName string `json:"country_name"`
	IP          string `json:"ip"`
}

type GlobalServerConfig

type GlobalServerConfig struct {
	AssettoCorsaServer FormHeading `ini:"-" json:"-" input:"heading"`

	Name                      string `ini:"NAME" help:"Server Name"`
	Password                  string `ini:"PASSWORD" input:"password" help:"Server password"`
	AdminPassword             string `` /* 225-byte string literal not displayed */
	UDPPort                   int    `ini:"UDP_PORT" show:"open" min:"0" max:"65535" help:"UDP port number: open this port on your server's firewall"`
	TCPPort                   int    `ini:"TCP_PORT" show:"open" min:"0" max:"65535" help:"TCP port number: open this port on your server's firewall"`
	HTTPPort                  int    `` /* 135-byte string literal not displayed */
	UDPPluginLocalPort        int    `` /* 487-byte string literal not displayed */
	UDPPluginAddress          string `` /* 463-byte string literal not displayed */
	AuthPluginAddress         string `ini:"AUTH_PLUGIN_ADDRESS" show:"open" help:"The address of the auth plugin"`
	RegisterToLobby           int    `ini:"REGISTER_TO_LOBBY" show:"open" input:"checkbox" help:"Register the AC Server to the main lobby"`
	ClientSendIntervalInHertz int    `` /* 228-byte string literal not displayed */
	SendBufferSize            int    `ini:"SEND_BUFFER_SIZE" show:"open" help:""`
	ReceiveBufferSize         int    `ini:"RECV_BUFFER_SIZE" show:"open" help:""`
	KickQuorum                int    `ini:"KICK_QUORUM" help:"Percentage that is required for the kick vote to pass"`
	VotingQuorum              int    `ini:"VOTING_QUORUM" min:"0" max:"100" help:"Percentage that is required for the session vote to pass"`
	VoteDuration              int    `ini:"VOTE_DURATION" min:"0" help:"Vote length in seconds"`
	BlacklistMode             int    `` /* 294-byte string literal not displayed */
	NumberOfThreads           int    `ini:"NUM_THREADS" show:"open" min:"1" help:"Number of threads to run on"`
	WelcomeMessage            string `ini:"WELCOME_MESSAGE" show:"-" help:"Path to the file that contains the server welcome message"`

	SleepTime int `` /* 178-byte string literal not displayed */

	FreeUDPPluginLocalPort int    `ini:"-" show:"-"`
	FreeUDPPluginAddress   string `ini:"-" show:"-"`

	ServerName                FormHeading `ini:"-" json:"-" input:"heading"`
	ShowRaceNameInServerLobby int         `` /* 154-byte string literal not displayed */
	ServerNameTemplate        string      `` /* 442-byte string literal not displayed */

	Theme     FormHeading `ini:"-" json:"-" input:"heading"`
	DarkTheme int         `ini:"-" input:"checkbox" help:"Enable Server Manager's Dark Theme by default"`
	CustomCSS string      `` /* 212-byte string literal not displayed */
	OGImage   string      `` /* 126-byte string literal not displayed */

	ContentManagerIntegration   FormHeading `ini:"-" json:"-" input:"heading"`
	EnableContentManagerWrapper int         `` /* 492-byte string literal not displayed */
	ContentManagerWrapperPort   int         `` /* 158-byte string literal not displayed */
	ShowContentManagerJoinLink  int         `` /* 190-byte string literal not displayed */

	Miscellaneous                     FormHeading `ini:"-" json:"-" input:"heading"`
	UseShortenedDriverNames           int         `` /* 146-byte string literal not displayed */
	FallBackResultsSorting            int         `` /* 181-byte string literal not displayed */
	UseMPH                            int         `ini:"-" input:"checkbox" help:"When on, this option will make Server Manager use MPH instead of Km/h for all speed values."`
	PreventWebCrawlers                int         `` /* 195-byte string literal not displayed */
	RestartEventOnServerManagerLaunch int         `` /* 185-byte string literal not displayed */

	// Discord Integration
	DiscordIntegration FormHeading `ini:"-" json:"-" input:"heading"`
	DiscordAPIToken    string      `` /* 169-byte string literal not displayed */
	DiscordChannelID   string      `` /* 246-byte string literal not displayed */
	DiscordRoleID      string      `` /* 272-byte string literal not displayed */
	DiscordRoleCommand string      `` /* 431-byte string literal not displayed */

	NotificationReminderTimer   int    `` /* 161-byte string literal not displayed */
	NotificationReminderTimers  string `` /* 237-byte string literal not displayed */
	ShowPasswordInNotifications int    `ini:"-" input:"checkbox" help:"Show the server password in race start notifications."`
	NotifyWhenScheduled         int    `ini:"-" input:"checkbox" help:"Send a notification when a race is scheduled (or cancelled)."`

	// Messages
	ContentManagerWelcomeMessage string `ini:"-" show:"-"`
	ServerJoinMessage            string `ini:"-" show:"-"`
}

func (GlobalServerConfig) GetName added in v1.4.0

func (gsc GlobalServerConfig) GetName() string

type Group

type Group string
const (
	GroupRead   Group = "read"
	GroupWrite  Group = "write"
	GroupDelete Group = "delete"
	GroupAdmin  Group = "admin"
)

type HTTPConfig

type HTTPConfig struct {
	Hostname         string `yaml:"hostname"`
	SessionKey       string `yaml:"session_key"`
	SessionStoreType string `yaml:"session_store_type"`
	SessionStorePath string `yaml:"session_store_path"`
	BaseURL          string `yaml:"server_manager_base_URL"`
}

type HealthCheck added in v1.5.3

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

func NewHealthCheck added in v1.5.3

func NewHealthCheck(raceControl *RaceControl, store Store) *HealthCheck

func (*HealthCheck) ServeHTTP added in v1.5.3

func (h *HealthCheck) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HealthCheckResponse added in v1.5.3

type HealthCheckResponse struct {
	OK        bool
	Version   string
	IsPremium bool
	IsHosted  bool

	OS            string
	NumCPU        int
	NumGoroutines int
	Uptime        string
	GoVersion     string

	AssettoIsInstalled  bool
	StrackerIsInstalled bool

	CarDirectoryIsWritable     bool
	TrackDirectoryIsWritable   bool
	WeatherDirectoryIsWritable bool
	SetupsDirectoryIsWritable  bool
	ConfigDirectoryIsWritable  bool
	ResultsDirectoryIsWritable bool

	ServerName          string
	EventInProgress     bool
	EventIsCritical     bool
	EventIsChampionship bool
	EventIsRaceWeekend  bool
	EventIsPractice     bool
	NumConnectedDrivers int
	MaxClientsOverride  int
}

type JSONStore added in v1.2.0

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

func (*JSONStore) AddAuditEntry added in v1.3.3

func (rs *JSONStore) AddAuditEntry(entry *AuditEntry) error

func (*JSONStore) ClearLastRaceEvent added in v1.5.3

func (rs *JSONStore) ClearLastRaceEvent() error

func (*JSONStore) DeleteAccount added in v1.2.0

func (rs *JSONStore) DeleteAccount(id string) error

func (*JSONStore) DeleteChampionship added in v1.2.0

func (rs *JSONStore) DeleteChampionship(id string) error

func (*JSONStore) DeleteCustomRace added in v1.2.0

func (rs *JSONStore) DeleteCustomRace(race *CustomRace) error

func (*JSONStore) DeleteEntrant added in v1.3.1

func (rs *JSONStore) DeleteEntrant(id string) error

func (*JSONStore) DeleteRaceWeekend added in v1.5.0

func (rs *JSONStore) DeleteRaceWeekend(id string) error

func (*JSONStore) FindAccountByID added in v1.2.0

func (rs *JSONStore) FindAccountByID(id string) (*Account, error)

func (*JSONStore) FindAccountByName added in v1.2.0

func (rs *JSONStore) FindAccountByName(name string) (*Account, error)

func (*JSONStore) FindCustomRaceByID added in v1.2.0

func (rs *JSONStore) FindCustomRaceByID(uuid string) (*CustomRace, error)

func (*JSONStore) GetAuditEntries added in v1.3.3

func (rs *JSONStore) GetAuditEntries() ([]*AuditEntry, error)

func (*JSONStore) GetMeta added in v1.2.0

func (rs *JSONStore) GetMeta(key string, out interface{}) error

func (*JSONStore) ListAccounts added in v1.2.0

func (rs *JSONStore) ListAccounts() ([]*Account, error)

func (*JSONStore) ListChampionships added in v1.2.0

func (rs *JSONStore) ListChampionships() ([]*Championship, error)

func (*JSONStore) ListCustomRaces added in v1.2.0

func (rs *JSONStore) ListCustomRaces() ([]*CustomRace, error)

func (*JSONStore) ListEntrants added in v1.2.0

func (rs *JSONStore) ListEntrants() ([]*Entrant, error)

func (*JSONStore) ListPrevFrames added in v1.2.0

func (rs *JSONStore) ListPrevFrames() ([]string, error)

func (*JSONStore) ListRaceWeekends added in v1.5.0

func (rs *JSONStore) ListRaceWeekends() ([]*RaceWeekend, error)

func (*JSONStore) LoadChampionship added in v1.2.0

func (rs *JSONStore) LoadChampionship(id string) (*Championship, error)

func (*JSONStore) LoadLastRaceEvent added in v1.5.3

func (rs *JSONStore) LoadLastRaceEvent() (RaceEvent, error)

func (*JSONStore) LoadLiveTimingsData added in v1.5.3

func (rs *JSONStore) LoadLiveTimingsData() (*LiveTimingsPersistedData, error)

func (*JSONStore) LoadRaceWeekend added in v1.5.0

func (rs *JSONStore) LoadRaceWeekend(id string) (*RaceWeekend, error)

func (*JSONStore) LoadServerOptions added in v1.2.0

func (rs *JSONStore) LoadServerOptions() (*GlobalServerConfig, error)

func (*JSONStore) LoadStrackerOptions added in v1.5.1

func (rs *JSONStore) LoadStrackerOptions() (*StrackerConfiguration, error)

func (*JSONStore) SetMeta added in v1.2.0

func (rs *JSONStore) SetMeta(key string, value interface{}) error

func (*JSONStore) UpsertAccount added in v1.2.0

func (rs *JSONStore) UpsertAccount(a *Account) error

func (*JSONStore) UpsertChampionship added in v1.2.0

func (rs *JSONStore) UpsertChampionship(c *Championship) error

func (*JSONStore) UpsertCustomRace added in v1.2.0

func (rs *JSONStore) UpsertCustomRace(race *CustomRace) error

func (*JSONStore) UpsertEntrant added in v1.2.0

func (rs *JSONStore) UpsertEntrant(entrant Entrant) error

func (*JSONStore) UpsertLastRaceEvent added in v1.5.3

func (rs *JSONStore) UpsertLastRaceEvent(r RaceEvent) error

func (*JSONStore) UpsertLiveFrames added in v1.2.0

func (rs *JSONStore) UpsertLiveFrames(frameLinks []string) error

func (*JSONStore) UpsertLiveTimingsData added in v1.5.3

func (rs *JSONStore) UpsertLiveTimingsData(lt *LiveTimingsPersistedData) error

func (*JSONStore) UpsertRaceWeekend added in v1.5.0

func (rs *JSONStore) UpsertRaceWeekend(rw *RaceWeekend) error

func (*JSONStore) UpsertServerOptions added in v1.2.0

func (rs *JSONStore) UpsertServerOptions(so *GlobalServerConfig) error

func (*JSONStore) UpsertStrackerOptions added in v1.5.1

func (rs *JSONStore) UpsertStrackerOptions(sto *StrackerConfiguration) error

type LiveMapConfig added in v1.1.0

type LiveMapConfig struct {
	IntervalMs int `yaml:"refresh_interval_ms"`
}

func (*LiveMapConfig) IsEnabled added in v1.1.0

func (l *LiveMapConfig) IsEnabled() bool

type LiveTimingsPersistedData added in v1.5.3

type LiveTimingsPersistedData struct {
	SessionType udp.SessionType
	Track       string
	TrackLayout string
	SessionName string

	Drivers map[udp.DriverGUID]*RaceControlDriver
}

type LuaConfig added in v1.6.0

type LuaConfig struct {
	Enabled bool `yaml:"enabled"`
}

type LuaPlugin added in v1.6.0

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

func (*LuaPlugin) Call added in v1.6.0

func (l *LuaPlugin) Call(fileName, functionName string) error

func (*LuaPlugin) Inputs added in v1.6.0

func (l *LuaPlugin) Inputs(i ...interface{}) *LuaPlugin

func (*LuaPlugin) Outputs added in v1.6.0

func (l *LuaPlugin) Outputs(o ...interface{}) *LuaPlugin

type MonitoringConfig added in v1.3.0

type MonitoringConfig struct {
	Enabled bool `yaml:"enabled"`
}

type NilBroadcaster added in v1.3.3

type NilBroadcaster struct{}

func (NilBroadcaster) Send added in v1.3.3

func (NilBroadcaster) Send(message udp.Message) error

type NotificationDispatcher added in v1.5.0

type NotificationDispatcher interface {
	HasNotificationReminders() bool
	GetNotificationReminders() []int
	SendMessage(msg string) error
	SendMessageWithLink(msg string, linkText string, link *url.URL) error
	SendRaceStartMessage(config ServerConfig, event RaceEvent) error
	SendRaceScheduledMessage(event *CustomRace, date time.Time) error
	SendRaceCancelledMessage(event *CustomRace, date time.Time) error
	SendRaceReminderMessage(event *CustomRace, timer int) error
	SendChampionshipReminderMessage(championship *Championship, event *ChampionshipEvent, timer int) error
	SendRaceWeekendReminderMessage(raceWeekend *RaceWeekend, session *RaceWeekendSession, timer int) error
	SaveServerOptions(oldServerOpts *GlobalServerConfig, newServerOpts *GlobalServerConfig) error
}

type NotificationManager added in v1.5.0

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

NotificationManager is the generic notification handler, which calls the individual notification managers. Initially, only a Discord manager is implemented.

func NewNotificationManager added in v1.5.0

func NewNotificationManager(discord *DiscordManager, cars *CarManager, store Store) *NotificationManager

func (*NotificationManager) GetCarList added in v1.5.3

func (nm *NotificationManager) GetCarList(cars string) string

GetCarList takes a ; sep string of cars from a race config, returns , sep of UI names with download links added

func (*NotificationManager) GetNotificationReminders added in v1.5.2

func (nm *NotificationManager) GetNotificationReminders() []int

GetNotificationReminders returns an array of int timers Doesn't return errors, just omits anything it doesn't like and logs errors

func (*NotificationManager) GetTrackInfo added in v1.5.3

func (nm *NotificationManager) GetTrackInfo(track string, layout string) string

GetTrackInfo returns the track summary with any download link appended

func (*NotificationManager) HasNotificationReminders added in v1.5.2

func (nm *NotificationManager) HasNotificationReminders() bool

HasNotificationReminders just tells us if we need to do any reminder scheduling

func (*NotificationManager) SaveServerOptions added in v1.5.0

func (nm *NotificationManager) SaveServerOptions(oldServerOpts *GlobalServerConfig, newServerOpts *GlobalServerConfig) error

check to see if any notification handlers need to process option changes

func (*NotificationManager) SendChampionshipReminderMessage added in v1.5.0

func (nm *NotificationManager) SendChampionshipReminderMessage(championship *Championship, event *ChampionshipEvent, timer int) error

SendChampionshipReminderMessage sends a reminder a configurable number of minutes prior to a championship race starting

func (*NotificationManager) SendMessage added in v1.5.0

func (nm *NotificationManager) SendMessage(msg string) error

SendMessage sends a message (surprise surprise)

func (nm *NotificationManager) SendMessageWithLink(msg string, linkText string, link *url.URL) error

SendMessageWithLink sends a message with an embedded CM join link

func (*NotificationManager) SendRaceCancelledMessage added in v1.5.2

func (nm *NotificationManager) SendRaceCancelledMessage(event *CustomRace, date time.Time) error

SendRaceCancelledMessage sends a notification when a race is cancelled

func (*NotificationManager) SendRaceReminderMessage added in v1.5.0

func (nm *NotificationManager) SendRaceReminderMessage(event *CustomRace, timer int) error

SendRaceReminderMessage sends a reminder a configurable number of minutes prior to a race starting

func (*NotificationManager) SendRaceScheduledMessage added in v1.5.0

func (nm *NotificationManager) SendRaceScheduledMessage(event *CustomRace, date time.Time) error

SendRaceScheduledMessage sends a notification when a race is scheduled

func (*NotificationManager) SendRaceStartMessage added in v1.5.0

func (nm *NotificationManager) SendRaceStartMessage(config ServerConfig, event RaceEvent) error

SendRaceStartMessage sends a message as a race session is started

func (*NotificationManager) SendRaceWeekendReminderMessage added in v1.5.0

func (nm *NotificationManager) SendRaceWeekendReminderMessage(raceWeekend *RaceWeekend, session *RaceWeekendSession, timer int) error

SendRaceWeekendReminderMessage sends a reminder a configurable number of minutes prior to a RaceWeekendSession starting

func (*NotificationManager) Stop added in v1.5.0

func (nm *NotificationManager) Stop() error

type PenaltiesHandler added in v1.4.0

type PenaltiesHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewPenaltiesHandler added in v1.4.0

func NewPenaltiesHandler(baseHandler *BaseHandler, championshipManager *ChampionshipManager, raceWeekendManager *RaceWeekendManager) *PenaltiesHandler

type PenaltyAction added in v1.3.0

type PenaltyAction string
const (
	SetPenalty    PenaltyAction = "set"
	RemovePenalty PenaltyAction = "remove"
)

type PointsReason added in v1.5.3

type PointsReason int
const (
	PointsEventFinish PointsReason = iota
	PointsPolePosition
	PointsFastestLap
	PointsCollisionWithCar
	PointsCollisionWithEnvironment
	PointsCutTrack
)

type PotentialChampionshipEntrant added in v1.3.0

type PotentialChampionshipEntrant interface {
	GetName() string
	GetTeam() string
	GetCar() string
	GetSkin() string
	GetGUID() string
}

type QuickRace added in v1.5.0

type QuickRace struct {
	OverridePassword    bool
	ReplacementPassword string
	RaceConfig          CurrentRaceConfig
	EntryList           EntryList
}

func (QuickRace) EventDescription added in v1.5.0

func (q QuickRace) EventDescription() string

func (QuickRace) EventName added in v1.5.0

func (q QuickRace) EventName() string

func (QuickRace) GetEntryList added in v1.5.3

func (q QuickRace) GetEntryList() EntryList

func (QuickRace) GetRaceConfig added in v1.5.3

func (q QuickRace) GetRaceConfig() CurrentRaceConfig

func (QuickRace) GetURL added in v1.5.0

func (q QuickRace) GetURL() string

func (QuickRace) IsChampionship added in v1.5.0

func (q QuickRace) IsChampionship() bool

func (QuickRace) IsLooping added in v1.5.3

func (q QuickRace) IsLooping() bool

func (QuickRace) IsPractice added in v1.5.3

func (q QuickRace) IsPractice() bool

func (QuickRace) IsRaceWeekend added in v1.5.0

func (q QuickRace) IsRaceWeekend() bool

func (QuickRace) OverrideServerPassword added in v1.5.0

func (q QuickRace) OverrideServerPassword() bool

func (QuickRace) ReplacementServerPassword added in v1.5.0

func (q QuickRace) ReplacementServerPassword() string

type QuickRaceHandler added in v1.4.0

type QuickRaceHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewQuickRaceHandler added in v1.4.0

func NewQuickRaceHandler(baseHandler *BaseHandler, raceManager *RaceManager) *QuickRaceHandler

type RaceControl added in v1.3.3

type RaceControl struct {
	SessionInfo                udp.SessionInfo `json:"SessionInfo"`
	TrackMapData               TrackMapData    `json:"TrackMapData"`
	TrackInfo                  TrackInfo       `json:"TrackInfo"`
	SessionStartTime           time.Time       `json:"SessionStartTime"`
	CurrentRealtimePosInterval int             `json:"CurrentRealtimePosInterval"`

	ConnectedDrivers    *DriverMap `json:"ConnectedDrivers"`
	DisconnectedDrivers *DriverMap `json:"DisconnectedDrivers"`

	CarIDToGUID map[udp.CarID]udp.DriverGUID `json:"CarIDToGUID"`
	// contains filtered or unexported fields
}

func NewRaceControl added in v1.3.3

func NewRaceControl(broadcaster Broadcaster, trackDataGateway TrackDataGateway, process ServerProcess, store Store) *RaceControl

func (*RaceControl) AllLapTimes added in v1.5.3

func (rc *RaceControl) AllLapTimes() map[udp.DriverGUID]*RaceControlDriver

func (*RaceControl) Event added in v1.3.3

func (rc *RaceControl) Event() udp.Event

RaceControl piggyback's on the udp.Message interface so that the entire data can be sent to newly connected clients.

func (*RaceControl) OnCarUpdate added in v1.3.3

func (rc *RaceControl) OnCarUpdate(update udp.CarUpdate) error

OnCarUpdate occurs every udp.RealTimePosInterval and returns car position, speed, etc. drivers top speeds are recorded per lap, as well as their last seen updated.

func (*RaceControl) OnClientConnect added in v1.3.3

func (rc *RaceControl) OnClientConnect(client udp.SessionCarInfo) error

OnClientConnect stores CarID -> DriverGUID mappings. if a driver is known to have previously been in this event, they will be moved from DisconnectedDrivers to ConnectedDrivers.

func (*RaceControl) OnClientDisconnect added in v1.3.3

func (rc *RaceControl) OnClientDisconnect(client udp.SessionCarInfo) error

OnClientDisconnect moves a client from ConnectedDrivers to DisconnectedDrivers.

func (*RaceControl) OnClientLoaded added in v1.3.3

func (rc *RaceControl) OnClientLoaded(loadedCar udp.ClientLoaded) error

OnClientLoaded marks a connected client as having loaded in.

func (*RaceControl) OnCollisionWithCar added in v1.3.3

func (rc *RaceControl) OnCollisionWithCar(collision udp.CollisionWithCar) error

OnCollisionWithCar registers a driver's collision with another car.

func (*RaceControl) OnCollisionWithEnvironment added in v1.3.3

func (rc *RaceControl) OnCollisionWithEnvironment(collision udp.CollisionWithEnvironment) error

OnCollisionWithEnvironment registers a driver's collision with the environment.

func (*RaceControl) OnEndSession added in v1.3.3

func (rc *RaceControl) OnEndSession(sessionFile udp.EndSession) error

OnEndSession is called at the end of every session.

func (*RaceControl) OnLapCompleted added in v1.3.3

func (rc *RaceControl) OnLapCompleted(lap udp.LapCompleted) error

OnLapCompleted occurs every time a driver crosses the line. Lap information is collected for the driver and best lap time and top speed are calculated. OnLapCompleted also remembers the car the lap was completed in a PreviousCars map on the driver. This is so that lap times between different cars can be compared.

func (*RaceControl) OnNewSession added in v1.3.3

func (rc *RaceControl) OnNewSession(sessionInfo udp.SessionInfo) error

OnNewSession occurs every new session. If the session is the first in an event and it is not a looped practice, then all driver information is cleared.

func (*RaceControl) OnSessionUpdate added in v1.3.3

func (rc *RaceControl) OnSessionUpdate(sessionInfo udp.SessionInfo) (bool, error)

OnSessionUpdate is called every sessionRequestInterval.

func (*RaceControl) OnVersion added in v1.3.3

func (rc *RaceControl) OnVersion(version udp.Version) error

OnVersion occurs when the Assetto Corsa Server starts up for the first time.

func (*RaceControl) SortDrivers added in v1.3.3

func (rc *RaceControl) SortDrivers(driverGroup RaceControlDriverGroup, driverA, driverB *RaceControlDriver) bool

func (*RaceControl) UDPCallback added in v1.3.3

func (rc *RaceControl) UDPCallback(message udp.Message)

type RaceControlCarLapInfo added in v1.3.3

type RaceControlCarLapInfo struct {
	TopSpeedThisLap      float64       `json:"TopSpeedThisLap"`
	TopSpeedBestLap      float64       `json:"TopSpeedBestLap"`
	BestLap              time.Duration `json:"BestLap"`
	NumLaps              int           `json:"NumLaps"`
	LastLap              time.Duration `json:"LastLap"`
	LastLapCompletedTime time.Time     `json:"LastLapCompletedTime" ts:"date"`
	TotalLapTime         time.Duration `json:"TotalLapTime"`
}

type RaceControlDriver added in v1.3.3

type RaceControlDriver struct {
	CarInfo      udp.SessionCarInfo `json:"CarInfo"`
	TotalNumLaps int                `json:"TotalNumLaps"`

	ConnectedTime time.Time `json:"ConnectedTime" ts:"date"`
	LoadedTime    time.Time `json:"LoadedTime" ts:"date"`

	Position int       `json:"Position"`
	Split    string    `json:"Split"`
	LastSeen time.Time `json:"LastSeen" ts:"date"`
	LastPos  udp.Vec   `json:"LastPos"`

	Collisions []Collision `json:"Collisions"`

	// Cars is a map of CarModel to the information for that car.
	Cars map[string]*RaceControlCarLapInfo `json:"Cars"`
}

func NewRaceControlDriver added in v1.3.3

func NewRaceControlDriver(carInfo udp.SessionCarInfo) *RaceControlDriver

func (*RaceControlDriver) CurrentCar added in v1.3.3

func (rcd *RaceControlDriver) CurrentCar() *RaceControlCarLapInfo

type RaceControlDriverGroup added in v1.3.3

type RaceControlDriverGroup int
const (
	ConnectedDrivers    RaceControlDriverGroup = 0
	DisconnectedDrivers RaceControlDriverGroup = 1
)

type RaceControlHandler added in v1.4.0

type RaceControlHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewRaceControlHandler added in v1.4.0

func NewRaceControlHandler(baseHandler *BaseHandler, store Store, raceManager *RaceManager, raceControl *RaceControl, raceControlHub *RaceControlHub, serverProcess ServerProcess) *RaceControlHandler

type RaceControlHub added in v1.4.0

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

func (*RaceControlHub) Send added in v1.4.0

func (h *RaceControlHub) Send(message udp.Message) error

type RaceEvent added in v1.3.0

type RaceEvent interface {
	GetRaceConfig() CurrentRaceConfig
	GetEntryList() EntryList

	IsLooping() bool
	IsChampionship() bool
	IsRaceWeekend() bool
	IsPractice() bool

	OverrideServerPassword() bool
	ReplacementServerPassword() string

	EventName() string
	EventDescription() string
	GetURL() string
}

type RaceManager

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

func NewRaceManager

func NewRaceManager(
	store Store,
	process ServerProcess,
	carManager *CarManager,
	trackManager *TrackManager,
	notificationManager NotificationDispatcher,
) *RaceManager

func (*RaceManager) BuildCustomRaceFromForm

func (rm *RaceManager) BuildCustomRaceFromForm(r *http.Request) (*CurrentRaceConfig, error)

func (*RaceManager) BuildEntryList

func (rm *RaceManager) BuildEntryList(r *http.Request, start, length int) (EntryList, error)

func (*RaceManager) BuildRaceOpts

func (rm *RaceManager) BuildRaceOpts(r *http.Request) (*RaceTemplateVars, error)

BuildRaceOpts builds a quick race form

func (*RaceManager) CurrentRace

func (rm *RaceManager) CurrentRace() (*ServerConfig, EntryList)

func (*RaceManager) DeleteCustomRace

func (rm *RaceManager) DeleteCustomRace(uuid string) error

func (*RaceManager) FindNextRecurrence added in v1.4.0

func (rm *RaceManager) FindNextRecurrence(race *CustomRace, start time.Time) time.Time

func (*RaceManager) InitScheduledRaces added in v1.4.0

func (rm *RaceManager) InitScheduledRaces() error

func (*RaceManager) ListAutoFillEntrants added in v1.3.2

func (rm *RaceManager) ListAutoFillEntrants() ([]*Entrant, error)

func (*RaceManager) ListCustomRaces

func (rm *RaceManager) ListCustomRaces() (recent, starred, looped, scheduled []*CustomRace, err error)

func (*RaceManager) LoadServerOptions

func (rm *RaceManager) LoadServerOptions() (*GlobalServerConfig, error)

func (*RaceManager) LoopCallback added in v1.4.0

func (rm *RaceManager) LoopCallback(message udp.Message)

callback check for udp end session, load result file, check session type against sessionTypes if session matches last session in sessionTypes then stop server and clear sessionTypes

func (*RaceManager) LoopRaces added in v1.4.0

func (rm *RaceManager) LoopRaces()

func (*RaceManager) RescheduleNotifications added in v1.5.0

func (rm *RaceManager) RescheduleNotifications(oldServerOpts *GlobalServerConfig, newServerOpts *GlobalServerConfig) error

reschedule notifications if notification timer changed

func (*RaceManager) SaveCustomRace

func (rm *RaceManager) SaveCustomRace(
	name string,
	overridePassword bool,
	replacementPassword string,
	config CurrentRaceConfig,
	entryList EntryList,
	starred bool,
) (*CustomRace, error)

func (*RaceManager) SaveEntrantsForAutoFill added in v1.2.0

func (rm *RaceManager) SaveEntrantsForAutoFill(entryList EntryList) error

func (*RaceManager) SaveServerOptions

func (rm *RaceManager) SaveServerOptions(newServerOpts *GlobalServerConfig) error

func (*RaceManager) ScheduleNextFromRecurrence added in v1.4.0

func (rm *RaceManager) ScheduleNextFromRecurrence(race *CustomRace) error

func (*RaceManager) ScheduleRace added in v1.1.0

func (rm *RaceManager) ScheduleRace(uuid string, date time.Time, action string, recurrence string) error

func (*RaceManager) SetupCustomRace

func (rm *RaceManager) SetupCustomRace(r *http.Request) error

func (*RaceManager) SetupQuickRace

func (rm *RaceManager) SetupQuickRace(r *http.Request) error

func (*RaceManager) StartCustomRace

func (rm *RaceManager) StartCustomRace(uuid string, forceRestart bool) error

func (*RaceManager) StartScheduledRace added in v1.4.0

func (rm *RaceManager) StartScheduledRace(race *CustomRace) error

func (*RaceManager) ToggleLoopCustomRace

func (rm *RaceManager) ToggleLoopCustomRace(uuid string) error

func (*RaceManager) ToggleStarCustomRace

func (rm *RaceManager) ToggleStarCustomRace(uuid string) error

type RaceTemplateVars added in v1.5.0

type RaceTemplateVars struct {
	BaseTemplateVars

	CarOpts             Cars
	TrackOpts           []Track
	AvailableSessions   []SessionType
	Weather             Weather
	SolIsInstalled      bool
	Current             CurrentRaceConfig
	CurrentEntrants     EntryList
	PossibleEntrants    []*Entrant
	FixedSetups         CarSetups
	IsEditing           bool
	EditingID           string
	CustomRaceName      string
	SurfacePresets      []TrackSurfacePreset
	OverridePassword    bool
	ReplacementPassword string
	Tyres               Tyres
	DeselectedTyres     map[string]bool

	IsChampionship                 bool
	Championship                   *Championship
	ChampionshipHasAtLeastOnceRace bool

	IsRaceWeekend                   bool
	RaceWeekend                     *RaceWeekend
	RaceWeekendSession              *RaceWeekendSession
	RaceWeekendHasAtLeastOneSession bool

	ShowOverridePasswordCard bool
}

type RaceWeekend added in v1.5.0

type RaceWeekend struct {
	ID      uuid.UUID
	Name    string
	Created time.Time
	Updated time.Time
	Deleted time.Time

	// Filters is a map of Parent ID -> Child ID -> Filter
	Filters map[string]map[string]*RaceWeekendSessionToSessionFilter

	// Deprecated: use GetEntryList() instead
	EntryList EntryList
	Sessions  []*RaceWeekendSession

	// ChampionshipID links a RaceWeekend to a Championship. It can be uuid.Nil
	ChampionshipID uuid.UUID
	// Championship is the Championship that is linked to the RaceWeekend.
	// If ChampionshipID is uuid.Nil, Championship will also be nil
	Championship *Championship `json:"-"`
}

RaceWeekends are a collection of sessions, where one session influences the EntryList of the next.

func NewRaceWeekend added in v1.5.0

func NewRaceWeekend() *RaceWeekend

NewRaceWeekend creates a RaceWeekend

func (*RaceWeekend) AddFilter added in v1.5.0

func (rw *RaceWeekend) AddFilter(parentID, childID string, filter *RaceWeekendSessionToSessionFilter)

AddFilter creates a link between parentID and childID with a filter that specifies how to take the EntrantResult of parent and modify them to make an EntryList for child

func (*RaceWeekend) AddSession added in v1.5.0

func (rw *RaceWeekend) AddSession(s *RaceWeekendSession, parent *RaceWeekendSession)

AddSession adds a RaceWeekendSession to a RaceWeekend, with an optional parent session (can be nil).

func (*RaceWeekend) Completed added in v1.5.0

func (rw *RaceWeekend) Completed() bool

func (*RaceWeekend) DelSession added in v1.5.0

func (rw *RaceWeekend) DelSession(sessionID string)

DelSession removes a RaceWeekendSession from a RaceWeekend. This also removes any parent links from the removed session to any other sessions.

func (*RaceWeekend) EnhanceResults added in v1.5.0

func (rw *RaceWeekend) EnhanceResults(results *SessionResults)

EnhanceResults takes a set of SessionResults and attaches Championship information to them.

func (*RaceWeekend) FindChildren added in v1.5.0

func (rw *RaceWeekend) FindChildren(parentID string) []*RaceWeekendSession

func (*RaceWeekend) FindSessionByID added in v1.5.0

func (rw *RaceWeekend) FindSessionByID(id string) (*RaceWeekendSession, error)

FindSessionByID finds a RaceWeekendSession by its unique identifier

func (*RaceWeekend) FindTotalNumParents added in v1.5.0

func (rw *RaceWeekend) FindTotalNumParents(session *RaceWeekendSession) int

FindTotalNumParents recursively finds all parents for a given session, including their parents etc...

func (*RaceWeekend) GetEntryList added in v1.5.0

func (rw *RaceWeekend) GetEntryList() EntryList

func (*RaceWeekend) GetFilter added in v1.5.0

func (rw *RaceWeekend) GetFilter(parentID, childID string) (*RaceWeekendSessionToSessionFilter, error)

GetFilter returns the Filter between parentID and childID, erroring if no Filter is found.

func (*RaceWeekend) GetFilterOrUseDefault added in v1.5.0

func (rw *RaceWeekend) GetFilterOrUseDefault(parentID, childID string) (*RaceWeekendSessionToSessionFilter, error)

GetFilterOrUseDefault attempts to find a filter between parentID and childID. If a filter is not found, a 'default' filter is created. The default filter takes all entrants from the parent results and applies them directly to the child entrylist, in their finishing order.

func (*RaceWeekend) HasLinkedChampionship added in v1.5.0

func (rw *RaceWeekend) HasLinkedChampionship() bool

func (*RaceWeekend) HasParentRecursive added in v1.5.0

func (rw *RaceWeekend) HasParentRecursive(session *RaceWeekendSession, otherSessionID string) bool

HasParentRecursive looks for otherSessionID in session's parents, grandparents, etc...

func (*RaceWeekend) HasTeamNames added in v1.5.0

func (rw *RaceWeekend) HasTeamNames() bool

HasTeamNames indicates whether a RaceWeekend entrylist has team names in it

func (*RaceWeekend) InProgress added in v1.5.0

func (rw *RaceWeekend) InProgress() bool

func (*RaceWeekend) Progress added in v1.5.0

func (rw *RaceWeekend) Progress() float64

Progress indicates how far (0 -> 1) a RaceWeekend has progressed.

func (*RaceWeekend) RemoveFilter added in v1.5.0

func (rw *RaceWeekend) RemoveFilter(parentID, childID string)

RemoveFilter removes the link between parent and child

func (*RaceWeekend) SessionCanBeRun added in v1.5.0

func (rw *RaceWeekend) SessionCanBeRun(s *RaceWeekendSession) bool

SessionCanBeRun determines whether a RaceWeekendSession has all of its parent dependencies met to be allowed to run (i.e. all parent RaceWeekendSessions must be complete to allow it to run)

func (*RaceWeekend) SortedSessions added in v1.5.0

func (rw *RaceWeekend) SortedSessions() []*RaceWeekendSession

SortedSessions returns the RaceWeekendSessions in order by the number of parents the sessions have.

func (*RaceWeekend) TrackOverview added in v1.5.0

func (rw *RaceWeekend) TrackOverview() string

type RaceWeekendEntryList added in v1.5.0

type RaceWeekendEntryList []*RaceWeekendSessionEntrant

A RaceWeekendEntryList is a collection of RaceWeekendSessionEntrants

func EntryListToRaceWeekendEntryList added in v1.5.0

func EntryListToRaceWeekendEntryList(e EntryList, sessionID uuid.UUID) RaceWeekendEntryList

EntryListToRaceWeekendEntryList converts an EntryList to a RaceWeekendEntryList for a given RaceWeekendSession

func (*RaceWeekendEntryList) Add added in v1.5.0

Add an Entrant to the EntryList

func (*RaceWeekendEntryList) AddInPitBox added in v1.5.0

func (e *RaceWeekendEntryList) AddInPitBox(entrant *RaceWeekendSessionEntrant, pitBox int)

AddInPitBox adds an Entrant in a specific pitbox - overwriting any entrant that was in that pitbox previously.

func (RaceWeekendEntryList) AsEntryList added in v1.5.0

func (e RaceWeekendEntryList) AsEntryList() EntryList

AsEntryList returns a RaceWeekendEntryList as an EntryList

func (*RaceWeekendEntryList) Delete added in v1.5.0

func (e *RaceWeekendEntryList) Delete(entrant *RaceWeekendSessionEntrant)

Remove an Entrant from the EntryList

func (*RaceWeekendEntryList) Sorted added in v1.5.0

Sorted returns the RaceWeekendEntryList ordered by Entrant PitBoxes

type RaceWeekendEntryListSortFunc added in v1.5.3

func (RaceWeekendEntryListSortFunc) Sort added in v1.5.3

type RaceWeekendEntryListSorter added in v1.5.0

type RaceWeekendEntryListSorter interface {
	Sort(*RaceWeekend, *RaceWeekendSession, []*RaceWeekendSessionEntrant, *RaceWeekendSessionToSessionFilter) error
}

RaceWeekendEntryListSorter is a function which takes a race weekend, session and entrylist and sorts the entrylist based on some criteria.

func GetRaceWeekendEntryListSort added in v1.5.0

func GetRaceWeekendEntryListSort(key string) RaceWeekendEntryListSorter

func PerClassSort added in v1.5.0

type RaceWeekendEntryListSorterDescription added in v1.5.0

type RaceWeekendEntryListSorterDescription struct {
	Name                  string
	Key                   string
	Sorter                RaceWeekendEntryListSorter
	NeedsParentSession    bool
	ShowInManageEntryList bool
}

type RaceWeekendGridPreview added in v1.5.0

type RaceWeekendGridPreview struct {
	Results map[int]SessionPreviewEntrant
	Grid    map[int]SessionPreviewEntrant
	Classes map[string]string
}

func NewRaceWeekendGridPreview added in v1.5.0

func NewRaceWeekendGridPreview() *RaceWeekendGridPreview

type RaceWeekendHandler added in v1.5.0

type RaceWeekendHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewRaceWeekendHandler added in v1.5.0

func NewRaceWeekendHandler(baseHandler *BaseHandler, raceWeekendManager *RaceWeekendManager) *RaceWeekendHandler

type RaceWeekendManager added in v1.5.0

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

func NewRaceWeekendManager added in v1.5.0

func NewRaceWeekendManager(raceManager *RaceManager, championshipManager *ChampionshipManager, store Store, process ServerProcess, notificationManager NotificationDispatcher) *RaceWeekendManager

func (*RaceWeekendManager) BuildRaceWeekendSessionOpts added in v1.5.0

func (rwm *RaceWeekendManager) BuildRaceWeekendSessionOpts(r *http.Request) (*RaceTemplateVars, error)

func (*RaceWeekendManager) BuildRaceWeekendTemplateOpts added in v1.5.0

func (rwm *RaceWeekendManager) BuildRaceWeekendTemplateOpts(r *http.Request) (*RaceTemplateVars, error)

func (*RaceWeekendManager) CancelSession added in v1.5.0

func (rwm *RaceWeekendManager) CancelSession(raceWeekendID string, raceWeekendSessionID string) error

func (*RaceWeekendManager) ClearLockedTyreSetups added in v1.5.1

func (rwm *RaceWeekendManager) ClearLockedTyreSetups(raceWeekend *RaceWeekend, session *RaceWeekendSession) error

func (*RaceWeekendManager) DeScheduleSession added in v1.5.0

func (rwm *RaceWeekendManager) DeScheduleSession(raceWeekendID, sessionID string) error

func (*RaceWeekendManager) DeleteRaceWeekend added in v1.5.0

func (rwm *RaceWeekendManager) DeleteRaceWeekend(id string) error

func (*RaceWeekendManager) DeleteSession added in v1.5.0

func (rwm *RaceWeekendManager) DeleteSession(raceWeekendID string, raceWeekendSessionID string) error

func (*RaceWeekendManager) FindConnectedSessions added in v1.5.0

func (rwm *RaceWeekendManager) FindConnectedSessions(raceWeekendID, parentSessionID, childSessionID string) (*RaceWeekend, *RaceWeekendSession, *RaceWeekendSession, error)

func (*RaceWeekendManager) FindSession added in v1.5.0

func (rwm *RaceWeekendManager) FindSession(raceWeekendID, sessionID string) (*RaceWeekend, *RaceWeekendSession, error)

func (*RaceWeekendManager) ImportRaceWeekend added in v1.5.0

func (rwm *RaceWeekendManager) ImportRaceWeekend(data string) (string, error)

func (*RaceWeekendManager) ImportSession added in v1.5.0

func (rwm *RaceWeekendManager) ImportSession(raceWeekendID string, raceWeekendSessionID string, r *http.Request) error

func (*RaceWeekendManager) ListAvailableResultsFilesForSession added in v1.5.0

func (rwm *RaceWeekendManager) ListAvailableResultsFilesForSession(raceWeekendID string, raceWeekendSessionID string) (*RaceWeekendSession, []SessionResults, error)

func (*RaceWeekendManager) ListAvailableResultsFilesForSorting added in v1.6.0

func (rwm *RaceWeekendManager) ListAvailableResultsFilesForSorting(raceWeekend *RaceWeekend, session *RaceWeekendSession) ([]SessionResults, error)

func (*RaceWeekendManager) ListRaceWeekends added in v1.5.0

func (rwm *RaceWeekendManager) ListRaceWeekends() ([]*RaceWeekend, error)

func (*RaceWeekendManager) LoadRaceWeekend added in v1.5.0

func (rwm *RaceWeekendManager) LoadRaceWeekend(id string) (*RaceWeekend, error)

func (*RaceWeekendManager) PreviewGrid added in v1.5.0

func (rwm *RaceWeekendManager) PreviewGrid(raceWeekendID, parentSessionID, childSessionID string, filter *RaceWeekendSessionToSessionFilter) (*RaceWeekendGridPreview, error)

func (*RaceWeekendManager) PreviewSessionEntryList added in v1.5.0

func (rwm *RaceWeekendManager) PreviewSessionEntryList(raceWeekendID, sessionID, sortType string, reverseGrid int) (*RaceWeekendGridPreview, error)

func (*RaceWeekendManager) RaceWeekendSessionIsRunning added in v1.5.3

func (rwm *RaceWeekendManager) RaceWeekendSessionIsRunning() bool

func (*RaceWeekendManager) RestartActiveSession added in v1.5.0

func (rwm *RaceWeekendManager) RestartActiveSession() error

func (*RaceWeekendManager) RestartSession added in v1.5.0

func (rwm *RaceWeekendManager) RestartSession(raceWeekendID string, raceWeekendSessionID string) error

func (*RaceWeekendManager) SaveRaceWeekend added in v1.5.0

func (rwm *RaceWeekendManager) SaveRaceWeekend(r *http.Request) (raceWeekend *RaceWeekend, edited bool, err error)

func (*RaceWeekendManager) SaveRaceWeekendSession added in v1.5.0

func (rwm *RaceWeekendManager) SaveRaceWeekendSession(r *http.Request) (raceWeekend *RaceWeekend, session *RaceWeekendSession, edited bool, err error)

func (*RaceWeekendManager) ScheduleSession added in v1.5.0

func (rwm *RaceWeekendManager) ScheduleSession(raceWeekendID, sessionID string, date time.Time, startWhenParentFinishes bool) error

func (*RaceWeekendManager) StartPracticeSession added in v1.5.0

func (rwm *RaceWeekendManager) StartPracticeSession(raceWeekendID string, raceWeekendSessionID string) error

func (*RaceWeekendManager) StartSession added in v1.5.0

func (rwm *RaceWeekendManager) StartSession(raceWeekendID string, raceWeekendSessionID string, isPracticeSession bool) error

func (*RaceWeekendManager) StopActiveSession added in v1.5.0

func (rwm *RaceWeekendManager) StopActiveSession() error

func (*RaceWeekendManager) UDPCallback added in v1.5.0

func (rwm *RaceWeekendManager) UDPCallback(message udp.Message)

func (*RaceWeekendManager) UpdateGrid added in v1.5.0

func (rwm *RaceWeekendManager) UpdateGrid(raceWeekendID, parentSessionID, childSessionID string, filter *RaceWeekendSessionToSessionFilter) error

func (*RaceWeekendManager) UpdateSessionSorting added in v1.5.0

func (rwm *RaceWeekendManager) UpdateSessionSorting(raceWeekendID, sessionID string, sortType string, numEntrantsToReverse int) error

func (*RaceWeekendManager) UpsertRaceWeekend added in v1.5.0

func (rwm *RaceWeekendManager) UpsertRaceWeekend(raceWeekend *RaceWeekend) error

func (*RaceWeekendManager) WatchForScheduledSessions added in v1.5.0

func (rwm *RaceWeekendManager) WatchForScheduledSessions() error

type RaceWeekendSession added in v1.5.0

type RaceWeekendSession struct {
	ID      uuid.UUID
	Created time.Time
	Updated time.Time
	Deleted time.Time

	ParentIDs            []uuid.UUID
	SortType             string
	NumEntrantsToReverse int

	RaceConfig          CurrentRaceConfig
	OverridePassword    bool
	ReplacementPassword string

	StartedTime                time.Time
	CompletedTime              time.Time
	ScheduledTime              time.Time
	ScheduledServerID          string
	Results                    *SessionResults
	StartWhenParentHasFinished bool

	Points map[uuid.UUID]*ChampionshipPoints
	// contains filtered or unexported fields
}

A RaceWeekendSession is a single session within a RaceWeekend. It can have parent sessions. It must have a RaceConfig. Once completed, a RaceWeekendSession will contain EntrantResult from that session.

func NewRaceWeekendSession added in v1.5.0

func NewRaceWeekendSession() *RaceWeekendSession

NewRaceWeekendSession creates an empty RaceWeekendSession

func (*RaceWeekendSession) ClearRecurrenceRule added in v1.5.0

func (rws *RaceWeekendSession) ClearRecurrenceRule()

func (*RaceWeekendSession) Completed added in v1.5.0

func (rws *RaceWeekendSession) Completed() bool

Completed RaceWeekendSessions have a non-zero CompletedTime

func (*RaceWeekendSession) FinishingGrid added in v1.5.0

func (rws *RaceWeekendSession) FinishingGrid(raceWeekend *RaceWeekend) ([]*RaceWeekendSessionEntrant, error)

FinishingGrid returns the finishing grid of the session, if complete. Otherwise, it returns the EntryList of that session

func (*RaceWeekendSession) GetID added in v1.5.0

func (rws *RaceWeekendSession) GetID() uuid.UUID

func (*RaceWeekendSession) GetRaceSetup added in v1.5.0

func (rws *RaceWeekendSession) GetRaceSetup() CurrentRaceConfig

func (*RaceWeekendSession) GetRaceWeekendEntryList added in v1.5.0

func (rws *RaceWeekendSession) GetRaceWeekendEntryList(rw *RaceWeekend, overrideFilter *RaceWeekendSessionToSessionFilter, overrideFilterSessionID string) (RaceWeekendEntryList, error)

GetRaceWeekendEntryList returns the RaceWeekendEntryList for the given session, built from the parent session(s) results and applied filters.

func (*RaceWeekendSession) GetRecurrenceRule added in v1.5.0

func (rws *RaceWeekendSession) GetRecurrenceRule() (*rrule.RRule, error)

func (*RaceWeekendSession) GetScheduledTime added in v1.5.0

func (rws *RaceWeekendSession) GetScheduledTime() time.Time

func (*RaceWeekendSession) GetSummary added in v1.5.0

func (rws *RaceWeekendSession) GetSummary() string

func (*RaceWeekendSession) GetURL added in v1.5.0

func (rws *RaceWeekendSession) GetURL() string

func (*RaceWeekendSession) HasParent added in v1.5.0

func (rws *RaceWeekendSession) HasParent(id string) bool

HasParent determines if a RaceWeekendSession has a parent with id

func (*RaceWeekendSession) HasRecurrenceRule added in v1.5.0

func (rws *RaceWeekendSession) HasRecurrenceRule() bool

func (*RaceWeekendSession) HasSignUpForm added in v1.5.0

func (rws *RaceWeekendSession) HasSignUpForm() bool

func (*RaceWeekendSession) InProgress added in v1.5.0

func (rws *RaceWeekendSession) InProgress() bool

InProgress indicates whether a RaceWeekendSession has been started but not stopped

func (*RaceWeekendSession) IsBase added in v1.5.0

func (rws *RaceWeekendSession) IsBase() bool

IsBase indicates that a RaceWeekendSession has no parent

func (*RaceWeekendSession) Name added in v1.5.0

func (rws *RaceWeekendSession) Name() string

Name of the RaceWeekendSession

func (*RaceWeekendSession) ParentsDataAttr added in v1.5.0

func (rws *RaceWeekendSession) ParentsDataAttr(raceWeekend *RaceWeekend) template.HTMLAttr

ParentsDataAttr returns a html-safe data attribute for identifying parent sessions of a given RaceWeekendSession in the frontend

func (*RaceWeekendSession) ReadOnlyEntryList added in v1.5.0

func (rws *RaceWeekendSession) ReadOnlyEntryList() EntryList

func (*RaceWeekendSession) RemoveParent added in v1.5.0

func (rws *RaceWeekendSession) RemoveParent(parentID string)

RemoveParent removes a parent RaceWeekendSession from this session

func (*RaceWeekendSession) SessionInfo added in v1.5.0

func (rws *RaceWeekendSession) SessionInfo() *SessionConfig

SessionInfo returns the information about the Assetto Corsa Session (i.e. practice, qualifying, race)

func (*RaceWeekendSession) SessionType added in v1.5.0

func (rws *RaceWeekendSession) SessionType() SessionType

SessionType returns the type of the RaceWeekendSession (practice, qualifying, race)

func (*RaceWeekendSession) SetRecurrenceRule added in v1.5.0

func (rws *RaceWeekendSession) SetRecurrenceRule(input string) error

type RaceWeekendSessionEntrant added in v1.5.0

type RaceWeekendSessionEntrant struct {
	// SessionID is the last session the Entrant participated in
	SessionID uuid.UUID
	// EntrantResult is the result of the last session the Entrant participated in
	EntrantResult *SessionResult
	// Car is the car from the EntryList that matches the results of the last session the Entrant participated in
	Car *SessionCar
	// PitBox is used to determine the starting pitbox of the Entrant.
	PitBox int
	// SessionResults are the whole results for the session the entrant took part in
	SessionResults *SessionResults `json:"-"`

	IsPlaceholder bool `json:"-"`

	// OverrideSetupFile is a path to an overriden setup for a Race Weekend
	OverrideSetupFile string
}

A RaceWeekendSessionEntrant is someone who has entered at least one RaceWeekend event.

func NewRaceWeekendSessionEntrant added in v1.5.0

func NewRaceWeekendSessionEntrant(previousSessionID uuid.UUID, car *SessionCar, entrantResult *SessionResult, sessionResults *SessionResults) *RaceWeekendSessionEntrant

NewRaceWeekendSessionEntrant creates a RaceWeekendSessionEntrant

func (*RaceWeekendSessionEntrant) ChampionshipClass added in v1.5.0

func (se *RaceWeekendSessionEntrant) ChampionshipClass(raceWeekend *RaceWeekend) *ChampionshipClass

func (*RaceWeekendSessionEntrant) GetEntrant added in v1.5.0

func (se *RaceWeekendSessionEntrant) GetEntrant() *Entrant

GetEntrant returns the RaceWeekendSessionEntrant as an EntryList Entrant (used for building the final entry_list.ini)

type RaceWeekendSessionToSessionFilter added in v1.5.0

type RaceWeekendSessionToSessionFilter struct {
	IsPreview bool

	ResultStart int
	ResultEnd   int

	NumEntrantsToReverse int

	EntryListStart int

	SortType string

	ForceUseTyreFromFastestLap bool

	AvailableResultsForSorting []string
}

func (RaceWeekendSessionToSessionFilter) Filter added in v1.5.0

func (f RaceWeekendSessionToSessionFilter) Filter(raceWeekend *RaceWeekend, parentSession, childSession *RaceWeekendSession, parentSessionResults []*RaceWeekendSessionEntrant, childSessionEntryList *RaceWeekendEntryList) error

Filter takes a set of RaceWeekendSessionEntrants formed by the results of the parent session and filters them into a child session entry list.

type Renderer

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

Renderer is the template engine.

func NewRenderer

func NewRenderer(loader TemplateLoader, store Store, process ServerProcess, reload bool) (*Renderer, error)

func (*Renderer) LoadPartial added in v1.5.0

func (tr *Renderer) LoadPartial(w http.ResponseWriter, r *http.Request, partial string, vars TemplateVars) error

func (*Renderer) LoadTemplate

func (tr *Renderer) LoadTemplate(w http.ResponseWriter, r *http.Request, view string, vars TemplateVars) error

LoadTemplate reads a template from templates and renders it with data to the given io.Writer

func (*Renderer) MustLoadPartial added in v1.5.0

func (tr *Renderer) MustLoadPartial(w http.ResponseWriter, r *http.Request, partial string, vars TemplateVars)

func (*Renderer) MustLoadTemplate

func (tr *Renderer) MustLoadTemplate(w http.ResponseWriter, r *http.Request, view string, vars TemplateVars)

MustLoadTemplate asserts that a LoadTemplate call must succeed or be dealt with via the http.ResponseWriter

type Resolver added in v1.4.0

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

func NewResolver added in v1.4.0

func NewResolver(templateLoader TemplateLoader, reloadTemplates bool, store Store) (*Resolver, error)

func (*Resolver) ResolveRouter added in v1.4.0

func (r *Resolver) ResolveRouter(fs http.FileSystem) http.Handler

func (*Resolver) ResolveStore added in v1.4.0

func (r *Resolver) ResolveStore() Store

func (*Resolver) UDPCallback added in v1.4.0

func (r *Resolver) UDPCallback(message udp.Message)

type ResultsHandler added in v1.4.0

type ResultsHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewResultsHandler added in v1.4.0

func NewResultsHandler(baseHandler *BaseHandler, store Store) *ResultsHandler

type ScheduledEvent added in v1.2.1

type ScheduledEvent interface {
	GetID() uuid.UUID
	GetRaceSetup() CurrentRaceConfig
	GetScheduledTime() time.Time
	GetSummary() string
	GetURL() string
	HasSignUpForm() bool
	ReadOnlyEntryList() EntryList
	HasRecurrenceRule() bool
	GetRecurrenceRule() (*rrule.RRule, error)
	SetRecurrenceRule(input string) error
	ClearRecurrenceRule()
}

type ScheduledEventBase added in v1.5.1

type ScheduledEventBase struct {
	Scheduled         time.Time
	ScheduledInitial  time.Time
	Recurrence        string
	ScheduledServerID string
}

func (*ScheduledEventBase) ClearRecurrenceRule added in v1.5.1

func (seb *ScheduledEventBase) ClearRecurrenceRule()

func (*ScheduledEventBase) GetRecurrenceRule added in v1.5.1

func (seb *ScheduledEventBase) GetRecurrenceRule() (*rrule.RRule, error)

func (*ScheduledEventBase) GetScheduledTime added in v1.5.1

func (seb *ScheduledEventBase) GetScheduledTime() time.Time

func (*ScheduledEventBase) HasRecurrenceRule added in v1.5.1

func (seb *ScheduledEventBase) HasRecurrenceRule() bool

func (*ScheduledEventBase) SetRecurrenceRule added in v1.5.1

func (seb *ScheduledEventBase) SetRecurrenceRule(input string) error

type ScheduledRacesHandler added in v1.4.0

type ScheduledRacesHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewScheduledRacesHandler added in v1.4.0

func NewScheduledRacesHandler(baseHandler *BaseHandler, scheduledRacesManager *ScheduledRacesManager) *ScheduledRacesHandler

type ScheduledRacesManager added in v1.5.0

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

func NewScheduledRacesManager added in v1.5.0

func NewScheduledRacesManager(store Store) *ScheduledRacesManager

type ServerAccountOptions added in v1.2.0

type ServerAccountOptions struct {
	IsOpen bool
}

type ServerAdministrationHandler added in v1.4.0

type ServerAdministrationHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewServerAdministrationHandler added in v1.4.0

func NewServerAdministrationHandler(
	baseHandler *BaseHandler,
	store Store,
	raceManager *RaceManager,
	championshipManager *ChampionshipManager,
	raceWeekendManager *RaceWeekendManager,
	process ServerProcess,
) *ServerAdministrationHandler

type ServerConfig

type ServerConfig struct {
	GlobalServerConfig GlobalServerConfig `ini:"SERVER"`
	CurrentRaceConfig  CurrentRaceConfig  `ini:"SERVER"`
}

func ConfigIniDefault

func ConfigIniDefault() ServerConfig

ConfigIniDefault is the default server config (ish) as supplied via the assetto corsa server.

func (ServerConfig) Write

func (sc ServerConfig) Write() error

type ServerExtraConfig added in v1.1.2

type ServerExtraConfig struct {
	Plugins                     []*CommandPlugin `yaml:"plugins"`
	AuditLogging                bool             `yaml:"audit_logging"`
	PerformanceMode             bool             `yaml:"performance_mode"`
	DisableWindowsBrowserOpen   bool             `yaml:"dont_open_browser"`
	ScanContentFolderForChanges bool             `yaml:"scan_content_folder_for_changes"`

	// Deprecated; use Plugins instead
	RunOnStart []string `yaml:"run_on_start"`
}

type ServerProcess

type ServerProcess interface {
	Logs() string
	Start(cfg ServerConfig, entryList EntryList, forwardingAddress string, forwardListenPort int, event RaceEvent) error
	Stop() error
	Restart() error
	IsRunning() bool
	Event() RaceEvent
	UDPCallback(message udp.Message)
	SendUDPMessage(message udp.Message) error
	GetServerConfig() ServerConfig

	Done() <-chan struct{}
}

type SessionCar

type SessionCar struct {
	BallastKG  int           `json:"BallastKG"`
	CarID      int           `json:"CarId"`
	Driver     SessionDriver `json:"Driver"`
	Model      string        `json:"Model"`
	Restrictor int           `json:"Restrictor"`
	Skin       string        `json:"Skin"`
}

func (*SessionCar) GetCar added in v1.3.0

func (c *SessionCar) GetCar() string

func (*SessionCar) GetGUID added in v1.3.0

func (c *SessionCar) GetGUID() string

func (*SessionCar) GetName added in v1.3.0

func (c *SessionCar) GetName() string

func (*SessionCar) GetSkin added in v1.3.0

func (c *SessionCar) GetSkin() string

func (*SessionCar) GetTeam added in v1.3.0

func (c *SessionCar) GetTeam() string

type SessionConfig

type SessionConfig struct {
	Name     string `ini:"NAME" show:"quick"`
	Time     int    `ini:"TIME" show:"quick" help:"session length in minutes"`
	Laps     int    `ini:"LAPS" show:"quick" help:"number of laps in the race"`
	IsOpen   int    `ini:"IS_OPEN" input:"checkbox" help:"0 = no join, 1 = free join, 2 = free join until 20 seconds to the green light"`
	WaitTime int    `ini:"WAIT_TIME" help:"seconds before the start of the session"`
}

type SessionDriver

type SessionDriver struct {
	GUID      string    `json:"Guid"`
	GuidsList []string  `json:"GuidsList"`
	Name      string    `json:"Name"`
	Nation    string    `json:"Nation"`
	Team      string    `json:"Team"`
	ClassID   uuid.UUID `json:"ClassID"`
}

func (*SessionDriver) AssignEntrant added in v1.2.0

func (sd *SessionDriver) AssignEntrant(entrant *Entrant, classID uuid.UUID)

type SessionEvent

type SessionEvent struct {
	CarID         int            `json:"CarId"`
	Driver        *SessionDriver `json:"Driver"`
	ImpactSpeed   float64        `json:"ImpactSpeed"`
	OtherCarID    int            `json:"OtherCarId"`
	OtherDriver   *SessionDriver `json:"OtherDriver"`
	RelPosition   *SessionPos    `json:"RelPosition"`
	Type          string         `json:"Type"`
	WorldPosition *SessionPos    `json:"WorldPosition"`
}

func (*SessionEvent) GetRelPosition

func (se *SessionEvent) GetRelPosition() string

func (*SessionEvent) GetWorldPosition

func (se *SessionEvent) GetWorldPosition() string

type SessionLap

type SessionLap struct {
	BallastKG  int       `json:"BallastKG"`
	CarID      int       `json:"CarId"`
	CarModel   string    `json:"CarModel"`
	Cuts       int       `json:"Cuts"`
	DriverGUID string    `json:"DriverGuid"`
	DriverName string    `json:"DriverName"`
	LapTime    int       `json:"LapTime"`
	Restrictor int       `json:"Restrictor"`
	Sectors    []int     `json:"Sectors"`
	Timestamp  int       `json:"Timestamp"`
	Tyre       string    `json:"Tyre"`
	ClassID    uuid.UUID `json:"ClassID"`
}

func (*SessionLap) DidCheat

func (sl *SessionLap) DidCheat(averageTime time.Duration) bool

func (*SessionLap) GetLapTime

func (sl *SessionLap) GetLapTime() time.Duration

func (*SessionLap) GetSector

func (sl *SessionLap) GetSector(x int) time.Duration

type SessionPos

type SessionPos struct {
	X float64 `json:"X"`
	Y float64 `json:"Y"`
	Z float64 `json:"Z"`
}

type SessionPreviewEntrant added in v1.5.0

type SessionPreviewEntrant struct {
	Name       string
	Session    string
	Class      string
	ClassColor string
}

type SessionResult

type SessionResult struct {
	BallastKG    int           `json:"BallastKG"`
	BestLap      int           `json:"BestLap"`
	CarID        int           `json:"CarId"`
	CarModel     string        `json:"CarModel"`
	DriverGUID   string        `json:"DriverGuid"`
	DriverName   string        `json:"DriverName"`
	Restrictor   int           `json:"Restrictor"`
	TotalTime    int           `json:"TotalTime"`
	HasPenalty   bool          `json:"HasPenalty"`
	PenaltyTime  time.Duration `json:"PenaltyTime"`
	LapPenalty   int           `json:"LapPenalty"`
	Disqualified bool          `json:"Disqualified"`
	ClassID      uuid.UUID     `json:"ClassID"`
}

func (*SessionResult) BestLapTyre added in v1.3.2

func (s *SessionResult) BestLapTyre(results *SessionResults) string

type SessionResults

type SessionResults struct {
	Cars           []*SessionCar    `json:"Cars"`
	Events         []*SessionEvent  `json:"Events"`
	Laps           []*SessionLap    `json:"Laps"`
	Result         []*SessionResult `json:"Result"`
	TrackConfig    string           `json:"TrackConfig"`
	TrackName      string           `json:"TrackName"`
	Type           SessionType      `json:"Type"`
	Date           time.Time        `json:"Date"`
	SessionFile    string           `json:"SessionFile"`
	ChampionshipID string           `json:"ChampionshipID"`
	RaceWeekendID  string           `json:"RaceWeekendID"`
}

func ListAllResults added in v1.2.0

func ListAllResults() ([]SessionResults, error)

func LoadResult

func LoadResult(fileName string) (*SessionResults, error)

func (*SessionResults) Anonymize added in v1.5.0

func (s *SessionResults) Anonymize()

func (*SessionResults) DriversHaveTeams added in v1.3.3

func (s *SessionResults) DriversHaveTeams() bool

func (*SessionResults) FallBackSort added in v1.4.0

func (s *SessionResults) FallBackSort()

func (*SessionResults) FastestLap

func (s *SessionResults) FastestLap() *SessionLap

func (*SessionResults) FastestLapInClass added in v1.4.2

func (s *SessionResults) FastestLapInClass(classID uuid.UUID) *SessionLap

func (*SessionResults) FindCarByGUIDAndModel added in v1.5.0

func (s *SessionResults) FindCarByGUIDAndModel(guid, model string) (*SessionCar, error)

func (*SessionResults) GetAverageLapTime

func (s *SessionResults) GetAverageLapTime(guid, model string) time.Duration

func (*SessionResults) GetConsistency added in v1.5.0

func (s *SessionResults) GetConsistency(guid, model string) float64

func (*SessionResults) GetCrashes

func (s *SessionResults) GetCrashes(guid string) int

func (*SessionResults) GetCrashesOfType added in v1.5.1

func (s *SessionResults) GetCrashesOfType(guid, collisionType string) int

func (*SessionResults) GetCuts

func (s *SessionResults) GetCuts(driverGuid, model string) int

func (*SessionResults) GetDate

func (s *SessionResults) GetDate() string

func (*SessionResults) GetDriverPosition added in v1.5.0

func (s *SessionResults) GetDriverPosition(driverGuid, model string) int

func (*SessionResults) GetDrivers

func (s *SessionResults) GetDrivers() string

func (*SessionResults) GetDriversFastestLap added in v1.5.0

func (s *SessionResults) GetDriversFastestLap(guid, model string) *SessionLap

func (*SessionResults) GetLastLapPos added in v1.4.0

func (s *SessionResults) GetLastLapPos(driverGuid, model string) int

func (*SessionResults) GetLastLapTime

func (s *SessionResults) GetLastLapTime(driverGuid, model string) time.Duration

func (*SessionResults) GetNumLaps added in v1.5.0

func (s *SessionResults) GetNumLaps(driverGUID, model string) int

func (*SessionResults) GetNumSectors

func (s *SessionResults) GetNumSectors() []int

func (*SessionResults) GetOverallAverageLapTime added in v1.5.0

func (s *SessionResults) GetOverallAverageLapTime() time.Duration

func (*SessionResults) GetPosForLap

func (s *SessionResults) GetPosForLap(guid, model string, lapNum int64) int

lapNum is the drivers current lap

func (*SessionResults) GetPotentialLap added in v1.6.0

func (s *SessionResults) GetPotentialLap(driverGUID, model string) time.Duration

func (*SessionResults) GetTeamName

func (s *SessionResults) GetTeamName(driverGUID string) string

func (*SessionResults) GetTime

func (s *SessionResults) GetTime(timeINT int, driverGUID, model string, penalty bool) time.Duration

func (*SessionResults) GetURL added in v1.3.0

func (s *SessionResults) GetURL() string

func (*SessionResults) HasHandicaps added in v1.6.0

func (s *SessionResults) HasHandicaps() bool

func (*SessionResults) IsDriversFastestLap

func (s *SessionResults) IsDriversFastestLap(guid, model string, time, cuts int) bool

func (*SessionResults) IsDriversFastestSector

func (s *SessionResults) IsDriversFastestSector(guid, model string, sector, time, cuts int) bool

func (*SessionResults) IsFastestLap

func (s *SessionResults) IsFastestLap(time, cuts int) bool

func (*SessionResults) IsFastestSector

func (s *SessionResults) IsFastestSector(sector, time, cuts int) bool

func (*SessionResults) MaskDriverNames added in v1.3.0

func (s *SessionResults) MaskDriverNames()

func (*SessionResults) RenameDriver added in v1.4.2

func (s *SessionResults) RenameDriver(guid, newName string)

type SessionType

type SessionType string
const (
	SessionTypeBooking    SessionType = "BOOK"
	SessionTypePractice   SessionType = "PRACTICE"
	SessionTypeQualifying SessionType = "QUALIFY"
	SessionTypeRace       SessionType = "RACE"

	// SessionTypeSecondRace is a convenience const to allow for checking of
	// reversed grid positions signifying a second race.
	SessionTypeSecondRace SessionType = "RACEx2"
)

func (SessionType) OriginalString added in v1.5.0

func (s SessionType) OriginalString() string

func (SessionType) String

func (s SessionType) String() string

type Sessions added in v1.2.1

type Sessions map[SessionType]*SessionConfig

func (Sessions) AsSlice added in v1.2.1

func (s Sessions) AsSlice() []*SessionConfig

type ShouldBeAnInt added in v1.4.0

type ShouldBeAnInt int

ShouldBeAnInt can be used in JSON struct definitions in places where the value provided should be an int, but isn't.

func (*ShouldBeAnInt) UnmarshalJSON added in v1.4.0

func (i *ShouldBeAnInt) UnmarshalJSON(b []byte) error

type SteamConfig

type SteamConfig struct {
	Username       string `yaml:"username"`
	Password       string `yaml:"password"`
	InstallPath    string `yaml:"install_path"`
	ForceUpdate    bool   `yaml:"force_update"`
	ExecutablePath string `yaml:"executable_path"`
}

type SteamLoginHandler added in v1.5.1

type SteamLoginHandler struct{}

type Store added in v1.2.0

type Store interface {
	// Custom Races
	UpsertCustomRace(race *CustomRace) error
	FindCustomRaceByID(uuid string) (*CustomRace, error)
	ListCustomRaces() ([]*CustomRace, error)
	DeleteCustomRace(race *CustomRace) error

	// Entrants
	UpsertEntrant(entrant Entrant) error
	ListEntrants() ([]*Entrant, error)
	DeleteEntrant(id string) error

	// Server Options
	UpsertServerOptions(so *GlobalServerConfig) error
	LoadServerOptions() (*GlobalServerConfig, error)

	// Championships
	UpsertChampionship(c *Championship) error
	ListChampionships() ([]*Championship, error)
	LoadChampionship(id string) (*Championship, error)
	DeleteChampionship(id string) error

	// Live Timings
	UpsertLiveTimingsData(*LiveTimingsPersistedData) error
	LoadLiveTimingsData() (*LiveTimingsPersistedData, error)
	UpsertLastRaceEvent(r RaceEvent) error
	LoadLastRaceEvent() (RaceEvent, error)
	ClearLastRaceEvent() error

	UpsertLiveFrames([]string) error
	ListPrevFrames() ([]string, error)

	// Meta
	SetMeta(key string, value interface{}) error
	GetMeta(key string, out interface{}) error

	// Accounts
	ListAccounts() ([]*Account, error)
	UpsertAccount(a *Account) error
	FindAccountByName(name string) (*Account, error)
	FindAccountByID(id string) (*Account, error)
	DeleteAccount(id string) error

	// Audit Log
	GetAuditEntries() ([]*AuditEntry, error)
	AddAuditEntry(entry *AuditEntry) error

	// Race Weekend
	ListRaceWeekends() ([]*RaceWeekend, error)
	UpsertRaceWeekend(rw *RaceWeekend) error
	LoadRaceWeekend(id string) (*RaceWeekend, error)
	DeleteRaceWeekend(id string) error

	// Stracker Options
	UpsertStrackerOptions(sto *StrackerConfiguration) error
	LoadStrackerOptions() (*StrackerConfiguration, error)
}

func NewBoltStore added in v1.2.0

func NewBoltStore(db *bbolt.DB) Store

func NewJSONStore added in v1.2.0

func NewJSONStore(dir string, sharedDir string) Store

type StoreConfig

type StoreConfig struct {
	Type       string `yaml:"type"`
	Path       string `yaml:"path"`
	SharedPath string `yaml:"shared_data_path"`
}

func (*StoreConfig) BuildStore

func (s *StoreConfig) BuildStore() (Store, error)

type StrackerACPlugin added in v1.5.1

type StrackerACPlugin struct {
	AssettoCorsaPlugin FormHeading `ini:"-" show:"open" input:"heading"`

	ReceivePort int `` /* 126-byte string literal not displayed */
	SendPort    int `ini:"sendPort" show:"open" help:"UDP port the plugins sends to. -1 means to use the AC servers setting UDP_PLUGIN_LOCAL_PORT"`

	ProxyPluginLocalPort int `` /* 189-byte string literal not displayed */
	ProxyPluginPort      int `` /* 181-byte string literal not displayed */
}

type StrackerConfiguration added in v1.5.1

type StrackerConfiguration struct {
	EnableStracker bool `ini:"-" help:"Turn Stracker on or off"`

	InstanceConfiguration StrackerInstanceConfiguration `ini:"STRACKER_CONFIG"`
	SwearFilter           StrackerSwearFilter           `ini:"SWEAR_FILTER"`
	SessionManagement     StrackerSessionManagement     `ini:"SESSION_MANAGEMENT"`
	Messages              StrackerMessages              `ini:"MESSAGES"`
	Database              StrackerDatabase              `ini:"DATABASE"`
	DatabaseCompression   StrackerDatabaseCompression   `ini:"DB_COMPRESSION"`
	HTTPConfiguration     StrackerHTTPConfiguration     `ini:"HTTP_CONFIG"`
	WelcomeMessage        StrackerWelcomeMessage        `ini:"WELCOME_MSG"`
	ACPlugin              StrackerACPlugin              `ini:"ACPLUGIN"`
	LapValidChecks        StrackerLapValidChecks        `ini:"LAP_VALID_CHECKS"`
}

func DefaultStrackerIni added in v1.5.1

func DefaultStrackerIni() *StrackerConfiguration

func (*StrackerConfiguration) Write added in v1.5.1

func (stc *StrackerConfiguration) Write() error

type StrackerDatabase added in v1.5.1

type StrackerDatabase struct {
	Database FormHeading `ini:"-" show:"open" input:"heading"`

	DatabaseFile         string `` /* 182-byte string literal not displayed */
	DatabaseType         string `ini:"database_type" show:"open" help:"Valid values are 'sqlite3' and 'postgres'. Selects the database to be used."`
	PerformBackups       bool   `` /* 222-byte string literal not displayed */
	PostgresDatabaseName string `ini:"postgres_db" show:"open" help:"The name of the postgres database"`
	PostgresHostname     string `ini:"postgres_host" show:"open" help:"Name of the host running the postgresql server."`
	PostgresUsername     string `ini:"postgres_user" show:"open" help:"Name of the postgresql user"`
	PostgresPassword     string `ini:"postgres_pwd" show:"open" help:"Postgresql user password"`
}

type StrackerDatabaseCompression added in v1.5.1

type StrackerDatabaseCompression struct {
	DatabaseCompression FormHeading `ini:"-" show:"open" input:"heading"`

	Interval         int    `ini:"interval" show:"open" help:"Interval of database compression in minutes"`
	Mode             string `` /* 246-byte string literal not displayed */
	NeedsEmptyServer int    `` /* 139-byte string literal not displayed */
}

type StrackerHTTPConfiguration added in v1.5.1

type StrackerHTTPConfiguration struct {
	HTTPConfiguration FormHeading `ini:"-" input:"heading"`

	Enabled       bool   `ini:"enabled" show:"open"`
	ListenAddress string `` /* 199-byte string literal not displayed */
	ListenPort    int    `ini:"listen_port" show:"open" help:"TCP listening port of the http server"`
	AdminUsername string `ini:"admin_username" help:"Username for the stracker admin pages. Leaving empty results in disabled admin pages"`
	AdminPassword string `` /* 129-byte string literal not displayed */

	TemperatureUnit string `ini:"temperature_unit" help:"Valid values are 'degc' or 'degf'"`
	VelocityUnit    string `ini:"velocity_unit" help:"Valid values are 'kmh' or 'mph'"`

	AuthBanAnonymisedPlayers bool   `ini:"auth_ban_anonymized_players" help:"Add anonymized players to blacklist."`
	AuthLogFile              string `` /* 171-byte string literal not displayed */
	Banner                   string `ini:"banner" help:"Icon to be used in webpages (leave empty for default Assetto Corsa icon)"`
	EnableSVGGeneration      bool   `` /* 129-byte string literal not displayed */
	InverseNavbar            bool   `ini:"inverse_navbar" help:"Set to true to get the navbar inverted (i.e., dark instead of bright)"`
	ItemsPerPage             int    `ini:"items_per_page" help:"Number of items displayed per page"`

	LapTimesAddColumns      string `` /* 306-byte string literal not displayed */
	LogRequests             bool   `` /* 128-byte string literal not displayed */
	MaximumStreamingClients int    `` /* 241-byte string literal not displayed */

	SSL            bool   `` /* 209-byte string literal not displayed */
	SSLCertificate string `` /* 221-byte string literal not displayed */
	SSLPrivateKey  string `` /* 181-byte string literal not displayed */
}

type StrackerHandler added in v1.5.1

type StrackerHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewStrackerHandler added in v1.5.1

func NewStrackerHandler(baseHandler *BaseHandler, store Store) *StrackerHandler

type StrackerInstanceConfiguration added in v1.5.1

type StrackerInstanceConfiguration struct {
	InstanceConfiguration FormHeading `ini:"-" show:"open" input:"heading"`

	ACServerAddress              string `` /* 145-byte string literal not displayed */
	ACServerConfigIni            string `` /* 166-byte string literal not displayed */
	ACServerWorkingDir           string `` /* 233-byte string literal not displayed */
	AppendLogFile                bool   `` /* 175-byte string literal not displayed */
	IDBasedOnDriverNames         bool   `` /* 201-byte string literal not displayed */
	KeepAlivePtrackerConnections bool   `` /* 146-byte string literal not displayed */
	ListeningPort                int    `` /* 310-byte string literal not displayed */
	LogFile                      string `ini:"log_file" show:"open" help:"Name of the stracker log file (utf-8 encoded), all messages go into there"`
	LogLevel                     string `` /* 145-byte string literal not displayed */
	LogTimestamps                bool   `ini:"log_timestamps" show:"open" help:"Set to ON if you want the log messages to be prefixed with a timestamp"`
	LowerPriority                bool   `` /* 149-byte string literal not displayed */
	PerformChecksumComparisons   bool   `ini:"perform_checksum_comparisons" show:"open" help:"Set to ON if you want stracker to compare the players checksums."`
	PtrackerConnectionMode       string `` /* 156-byte string literal not displayed */
	ServerName                   string `` /* 190-byte string literal not displayed */
	TeeToStdout                  bool   `ini:"tee_to_stdout" show:"open" help:"Set to ON if you want the messages appear on stdout (in Server Manager's plugin logs)"`
}

type StrackerLapValidChecks added in v1.5.1

type StrackerLapValidChecks struct {
	LapValidChecks FormHeading `ini:"-" input:"heading"`

	InvalidateOnCarCollisions         bool `ini:"invalidateOnCarCollisions" help:"If ON, collisions with other cars will invalidate laps"`
	InvalidateOnEnvironmentCollisions bool `ini:"invalidateOnEnvCollisions" help:"If ON, collisions with environment objects will invalidate laps"`
	PtrackerAllowedTyresOut           int  `` /* 143-byte string literal not displayed */
}

type StrackerMessages added in v1.5.1

type StrackerMessages struct {
	Messages FormHeading `ini:"-" input:"heading"`

	BestLapTimeBroadcastThreshold int    `` /* 208-byte string literal not displayed */
	CarToCarCollisionMessage      bool   `ini:"car_to_car_collision_msg" help:"Set to ON to enable car to car private messages."`
	MessageTypesToSendOverChat    string `` /* 202-byte string literal not displayed */
}

type StrackerSessionManagement added in v1.5.1

type StrackerSessionManagement struct {
	SessionManagement FormHeading `ini:"-" input:"heading"`

	RaceOverStrategy      string `` /* 134-byte string literal not displayed */
	WaitSecondsBeforeSkip int    `` /* 137-byte string literal not displayed */
}

type StrackerSwearFilter added in v1.5.1

type StrackerSwearFilter struct {
	SwearFilter FormHeading `ini:"-" input:"heading"`

	Action           string `ini:"action" help:"Valid values are 'none', 'kick' and 'ban'"`
	BanDuration      int    `ini:"ban_duration" help:"The number of days to ban a player for (if the Action is 'ban')"`
	NumberOfWarnings int    `ini:"num_warnings" help:"The number of warnings issued before the player is kicked"`
	SwearFile        string `ini:"swear_file" help:"A file with bad words to be used for filtering" show:"open"`
	Warning          string `ini:"warning" help:"The message sent to a player after swear detection"`
}

type StrackerWelcomeMessage added in v1.5.1

type StrackerWelcomeMessage struct {
	WelcomeMessage FormHeading `ini:"-" input:"heading"`

	Line1 string `ini:"line1"`
	Line2 string `ini:"line2"`
	Line3 string `ini:"line3"`
	Line4 string `ini:"line4"`
	Line5 string `ini:"line5"`
	Line6 string `ini:"line6"`
}

type TeamStanding

type TeamStanding struct {
	Team   string
	Points float64
}

TeamStanding is the current number of Points a Team has.

type TemplateLoader

type TemplateLoader interface {
	Init() error
	Templates(funcs template.FuncMap) (map[string]*template.Template, error)
}

func NewFilesystemTemplateLoader

func NewFilesystemTemplateLoader(dir string) TemplateLoader

type TemplateVars added in v1.5.0

type TemplateVars interface {
	Get() *BaseTemplateVars
}

type Theme added in v1.5.0

type Theme string

type ThemeDetails added in v1.5.0

type ThemeDetails struct {
	Theme Theme
	Name  string
}

type Track

type Track struct {
	Name    string
	Layouts []string

	MetaData TrackMetaData
}

func (Track) GetImagePath added in v1.5.1

func (t Track) GetImagePath() string

func (Track) IsMod added in v1.5.2

func (t Track) IsMod() bool

func (Track) IsPaidDLC added in v1.5.2

func (t Track) IsPaidDLC() bool

func (*Track) LayoutsCSV

func (t *Track) LayoutsCSV() string

func (*Track) LoadMetaData added in v1.5.1

func (t *Track) LoadMetaData() error

func (Track) PrettyName

func (t Track) PrettyName() string

type TrackDataGateway added in v1.3.3

type TrackDataGateway interface {
	TrackInfo(name, layout string) (*TrackInfo, error)
	TrackMap(name, layout string) (*TrackMapData, error)
}

type TrackInfo

type TrackInfo struct {
	Name        string      `json:"name"`
	City        string      `json:"city"`
	Country     string      `json:"country"`
	Description string      `json:"description"`
	Geotags     []string    `json:"geotags"`
	Length      string      `json:"length"`
	Pitboxes    json.Number `json:"pitboxes"`
	Run         string      `json:"run"`
	Tags        []string    `json:"tags"`
	Width       string      `json:"width"`
}

func GetTrackInfo

func GetTrackInfo(name, layout string) (*TrackInfo, error)

type TrackManager added in v1.5.1

type TrackManager struct {
}

func NewTrackManager added in v1.5.1

func NewTrackManager() *TrackManager

func (*TrackManager) GetTrackFromName added in v1.5.1

func (tm *TrackManager) GetTrackFromName(name string) (*Track, error)

func (*TrackManager) ListTracks added in v1.5.1

func (tm *TrackManager) ListTracks() ([]Track, error)

func (*TrackManager) LoadTrackDetailsForTemplate added in v1.5.1

func (tm *TrackManager) LoadTrackDetailsForTemplate(trackName string) (*trackDetailsTemplateVars, error)

func (*TrackManager) ResultsForLayout added in v1.5.1

func (tm *TrackManager) ResultsForLayout(trackName, layout string) ([]SessionResults, error)

func (*TrackManager) UpdateTrackMetadata added in v1.5.1

func (tm *TrackManager) UpdateTrackMetadata(name string, r *http.Request) error

type TrackMapData added in v1.1.0

type TrackMapData struct {
	Width       float64 `ini:"WIDTH" json:"width"`
	Height      float64 `ini:"HEIGHT" json:"height"`
	Margin      float64 `ini:"MARGIN" json:"margin"`
	ScaleFactor float64 `ini:"SCALE_FACTOR" json:"scale_factor"`
	OffsetX     float64 `ini:"X_OFFSET" json:"offset_x"`
	OffsetZ     float64 `ini:"Z_OFFSET" json:"offset_y"`
	DrawingSize float64 `ini:"DRAWING_SIZE" json:"drawing_size"`
}

func LoadTrackMapData added in v1.1.0

func LoadTrackMapData(track, trackLayout string) (*TrackMapData, error)

type TrackMetaData added in v1.5.1

type TrackMetaData struct {
	DownloadURL string `json:"downloadURL"`
	Notes       string `json:"notes"`
}

func LoadTrackMetaDataFromName added in v1.5.3

func LoadTrackMetaDataFromName(name string) (*TrackMetaData, error)

func (*TrackMetaData) Save added in v1.5.1

func (tmd *TrackMetaData) Save(name string) error

type TrackSurfacePreset

type TrackSurfacePreset struct {
	Name            string
	Description     string
	SessionStart    int
	SessionTransfer int
	Randomness      int
	LapGain         int
}

type TracksHandler added in v1.4.0

type TracksHandler struct {
	*BaseHandler
	// contains filtered or unexported fields
}

func NewTracksHandler added in v1.4.0

func NewTracksHandler(baseHandler *BaseHandler, trackManager *TrackManager) *TracksHandler

type Tyres

type Tyres map[string]map[string]string

func ListTyres

func ListTyres() (Tyres, error)

ListTyres reads tyres from the TyreFiles and returns them as a map of car => tyre short name => tyre long name

func (Tyres) Name

func (t Tyres) Name(search string, cars []string) string

type ValidationError added in v1.3.0

type ValidationError string

func (ValidationError) Error added in v1.3.0

func (e ValidationError) Error() string

type Weather

type Weather map[string]string

func ListWeather

func ListWeather() (Weather, error)

type WeatherConfig

type WeatherConfig struct {
	Graphics               string `ini:"GRAPHICS" help:"exactly one of the folder names that you find in the 'content\\weather'' directory"`
	BaseTemperatureAmbient int    `ini:"BASE_TEMPERATURE_AMBIENT" help:"ambient temperature"` // 0-36
	BaseTemperatureRoad    int    ``                                                          // 0-36
	/* 215-byte string literal not displayed */
	VariationAmbient int `` /* 130-byte string literal not displayed */
	VariationRoad    int `ini:"VARIATION_ROAD" help:"variation of the road's temperature. Like the ambient one"`

	CMGraphics          string `ini:"__CM_GRAPHICS" help:"Graphics folder name"`
	CMWFXType           int    `ini:"__CM_WFX_TYPE" help:"Weather ini file number, inside weather.ini"`
	CMWFXUseCustomTime  int    `ini:"__CM_WFX_USE_CUSTOM_TIME" help:"If Sol is active then this should be too"`
	CMWFXTime           int    `ini:"__CM_WFX_TIME" help:"Seconds after 12 noon, usually leave at 0 and use unix timestamp instead"`
	CMWFXTimeMulti      int    `ini:"__CM_WFX_TIME_MULT" help:"Time speed multiplier, default to 1x"`
	CMWFXUseCustomDate  int    `ini:"__CM_WFX_USE_CUSTOM_DATE" help:"If Sol is active then this should be too"`
	CMWFXDate           int    `ini:"__CM_WFX_DATE" help:"Unix timestamp (UTC + 10)"`
	CMWFXDateUnModified int    `ini:"__CM_WFX_DATE_UNMODIFIED" help:"Unix timestamp (UTC + 10), without multiplier correction"`
}

func (WeatherConfig) TrimName

func (w WeatherConfig) TrimName(name string) string

func (WeatherConfig) UnixToTime

func (w WeatherConfig) UnixToTime(unix int) time.Time

type WeatherHandler added in v1.4.0

type WeatherHandler struct {
	*BaseHandler
}

func NewWeatherHandler added in v1.4.0

func NewWeatherHandler(baseHandler *BaseHandler) *WeatherHandler

Notes

Bugs

  • splitting commands on spaces breaks child processes that have a space in their path name

Directories

Path Synopsis
cmd
fixtures
internal
pkg
acd
This code would not have been possible without the two following projects: * AcTools (and Content Manager) - https://github.com/gro-ove/actools - Licensed under the Microsoft Public License (Ms-PL) * Luigi Auriemma's QuickBMS, specifically the "Assetto Corsa ACD" script.
This code would not have been possible without the two following projects: * AcTools (and Content Manager) - https://github.com/gro-ove/actools - Licensed under the Microsoft Public License (Ms-PL) * Luigi Auriemma's QuickBMS, specifically the "Assetto Corsa ACD" script.
udp

Jump to

Keyboard shortcuts

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