status updates
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package model
|
||||
|
||||
type ServiceStatus string
|
||||
|
||||
const (
|
||||
StatusRunning ServiceStatus = "SERVICE_RUNNING\r\n"
|
||||
StatusStopped ServiceStatus = "SERVICE_STOPPED\r\n"
|
||||
StatusRestarting ServiceStatus = "SERVICE_RESTARTING\r\n"
|
||||
)
|
||||
|
||||
type ApiModel struct {
|
||||
Api string `json:"api"`
|
||||
}
|
||||
|
||||
// ServiceStatus represents a Windows service state
|
||||
type ServiceStatus struct {
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"` // "running", "stopped", "pending"
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ type Config struct {
|
||||
}
|
||||
|
||||
type Configurations struct {
|
||||
Configuration map[string]interface{} `json:"configuration"`
|
||||
Entrylist map[string]interface{} `json:"entrylist"`
|
||||
Event map[string]interface{} `json:"event"`
|
||||
EventRules map[string]interface{} `json:"eventRules"`
|
||||
Settings map[string]interface{} `json:"settings"`
|
||||
Configuration Configuration `json:"configuration"`
|
||||
AssistRules AssistRules `json:"assistRules"`
|
||||
Event EventConfig `json:"event"`
|
||||
EventRules EventRules `json:"eventRules"`
|
||||
Settings ServerSettings `json:"settings"`
|
||||
}
|
||||
|
||||
type ServerSettings struct {
|
||||
@@ -64,6 +64,18 @@ type Session struct {
|
||||
SessionDurationMinutes int `json:"sessionDurationMinutes"`
|
||||
}
|
||||
|
||||
type AssistRules struct {
|
||||
StabilityControlLevelMax int `json:"stabilityControlLevelMax"`
|
||||
DisableAutosteer int `json:"disableAutosteer"`
|
||||
DisableAutoLights int `json:"disableAutoLights"`
|
||||
DisableAutoWiper int `json:"disableAutoWiper"`
|
||||
DisableAutoEngineStart int `json:"disableAutoEngineStart"`
|
||||
DisableAutoPitLimiter int `json:"disableAutoPitLimiter"`
|
||||
DisableAutoGear int `json:"disableAutoGear"`
|
||||
DisableAutoClutch int `json:"disableAutoClutch"`
|
||||
DisableIdealLine int `json:"disableIdealLine"`
|
||||
}
|
||||
|
||||
type EventRules struct {
|
||||
QualifyStandingType int `json:"qualifyStandingType"`
|
||||
PitWindowLengthSec int `json:"pitWindowLengthSec"`
|
||||
@@ -77,3 +89,12 @@ type EventRules struct {
|
||||
IsMandatoryPitstopSwapDriverRequired bool `json:"isMandatoryPitstopSwapDriverRequired"`
|
||||
TyreSetCount int `json:"tyreSetCount"`
|
||||
}
|
||||
|
||||
type Configuration struct {
|
||||
UdpPort int `json:"udpPort"`
|
||||
TcpPort int `json:"tcpPort"`
|
||||
MaxConnections int `json:"maxConnections"`
|
||||
LanDiscovery int `json:"lanDiscovery"`
|
||||
RegisterToLobby int `json:"registerToLobby"`
|
||||
ConfigVersion int `json:"configVersion"`
|
||||
}
|
||||
|
||||
@@ -1,12 +1,42 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Server represents an ACC server instance
|
||||
type Server struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
Status string `json:"status"`
|
||||
Status ServiceStatus `json:"status"`
|
||||
IP string `gorm:"not null" json:"-"`
|
||||
Port int `gorm:"not null" json:"-"`
|
||||
ConfigPath string `gorm:"not null" json:"-"` // e.g. "/acc/servers/server1/"
|
||||
ServiceName string `gorm:"not null" json:"-"` // Windows service name
|
||||
BroadcastIP string `json:"-"`
|
||||
BroadcastPort int `json:"-"`
|
||||
BroadcastPassword string `json:"-"`
|
||||
}
|
||||
|
||||
type PlayerState struct {
|
||||
CarID int // Car ID in broadcast packets
|
||||
DriverName string // Optional: pulled from registration packet
|
||||
TeamName string
|
||||
CarModel string
|
||||
CurrentLap int
|
||||
LastLapTime int // in milliseconds
|
||||
BestLapTime int // in milliseconds
|
||||
Position int
|
||||
ConnectedAt time.Time
|
||||
DisconnectedAt *time.Time
|
||||
IsConnected bool
|
||||
}
|
||||
|
||||
type ServerState struct {
|
||||
sync.RWMutex
|
||||
Session string
|
||||
PlayerCount int
|
||||
Players map[int]*PlayerState
|
||||
// etc.
|
||||
}
|
||||
Reference in New Issue
Block a user