Documentation ¶
Overview ¶
Package model defines common model structures used in many places throughout the application.
Index ¶
- type Appeal
- type AppealState
- type BDIds
- type Ban
- type BanASN
- type BanNet
- type BanType
- type BannedPerson
- type ChatLog
- type DemoFile
- type Filter
- type IPRecord
- type LogQueryOpts
- type Origin
- type Person
- type PersonIPRecord
- type PlayerInfo
- type Privilege
- type RawLogEvent
- type Reason
- type Server
- type ServerEvent
- type ServerState
- type ServerStateCollection
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Appeal ¶
type Appeal struct { AppealID int `db:"appeal_id" json:"appeal_id"` BanID uint64 `db:"ban_id" json:"ban_id"` AppealText string `db:"appeal_text" json:"appeal_text"` AppealState AppealState `db:"appeal_state" json:"appeal_state"` Email string `db:"email" json:"email"` CreatedOn time.Time `db:"created_on" json:"created_on"` UpdatedOn time.Time `db:"updated_on" json:"updated_on"` }
type AppealState ¶
type AppealState int
AppealState is the current state of a users ban appeal, if any.
const ( // ASNew is a user has initiated an appeal ASNew AppealState = 0 // ASDenied the appeal was denied ASDenied AppealState = 1 )
type BDIds ¶ added in v0.1.8
type BDIds struct { FileInfo struct { Authors []string `json:"authors"` Description string `json:"description"` Title string `json:"title"` UpdateURL string `json:"update_url"` } `json:"file_info"` Schema string `json:"$schema"` Players []struct { Steamid int64 `json:"steamid"` Attributes []string `json:"attributes"` LastSeen struct { PlayerName string `json:"player_name"` Time int `json:"time"` } `json:"last_seen"` } `json:"players"` Version int `json:"version"` }
type Ban ¶
type Ban struct { BanID uint64 `db:"ban_id" json:"ban_id"` // SteamID is the steamID of the banned person SteamID steamid.SID64 `db:"steam_id" json:"steam_id"` AuthorID steamid.SID64 `db:"author_id" json:"author_id"` // Reason defines the overall ban classification BanType BanType `db:"ban_type" json:"ban_type"` // Reason defines the overall ban classification Reason Reason `db:"reason" json:"reason"` // ReasonText is returned to the client when kicked trying to join the server ReasonText string `db:"reason_text" json:"reason_text"` // Note is a supplementary note added by admins that is hidden from normal view Note string `db:"note" json:"note"` Source Origin `json:"ban_source" db:"ban_source"` // ValidUntil is when the ban will be no longer valid. 0 denotes forever ValidUntil time.Time `json:"valid_until" db:"valid_until"` CreatedOn time.Time `db:"created_on" json:"created_on"` UpdatedOn time.Time `db:"updated_on" json:"updated_on"` }
type BanASN ¶ added in v0.1.8
type BanNet ¶
type BanNet struct { NetID int64 `db:"net_id"` SteamID steamid.SID64 `db:"steam_id"` AuthorID steamid.SID64 `db:"author_id"` CIDR *net.IPNet `db:"cidr"` Source Origin `db:"source"` Reason string `db:"reason"` CreatedOn time.Time `db:"created_on" json:"created_on"` UpdatedOn time.Time `db:"updated_on" json:"updated_on"` ValidUntil time.Time `db:"valid_until"` }
type BanType ¶
type BanType int
BanType defines the state of the ban for a user, 0 being no ban
const ( // Unknown means the ban state could not be determined, failing-open to allowing players // to connect. Unknown BanType = -1 // OK Ban state is clean OK BanType = 0 // NoComm means the player cannot communicate while playing voice + chat NoComm BanType = 1 // Banned means the player cannot join the server at all Banned BanType = 2 )
type BannedPerson ¶
type BannedPerson struct { Ban Ban `json:"ban"` Person Person `json:"person"` HistoryChat []logparse.SayEvt `json:"history_chat" db:"-"` HistoryPersonaName []string `json:"history_personaname" db:"-"` HistoryConnections []string `json:"history_connections" db:"-"` HistoryIP []PersonIPRecord `json:"history_ip" db:"-"` }
func NewBannedPerson ¶
func NewBannedPerson() BannedPerson
type DemoFile ¶ added in v0.1.8
type LogQueryOpts ¶ added in v0.1.8
type LogQueryOpts struct { LogTypes []logparse.MsgType `json:"log_types"` Limit uint64 `json:"limit"` OrderDesc bool `json:"order_desc"` Query string `json:"query"` SourceID string `json:"source_id"` TargetID string `json:"target_id"` Servers []int `json:"servers"` }
func (*LogQueryOpts) ValidRecordType ¶ added in v0.1.8
func (lqo *LogQueryOpts) ValidRecordType(t logparse.MsgType) bool
type Person ¶
type Person struct { SteamID steamid.SID64 `db:"steam_id" json:"steam_id"` Name string `db:"name" json:"name"` CreatedOn time.Time `db:"created_on" json:"created_on"` UpdatedOn time.Time `db:"updated_on" json:"updated_on"` PermissionLevel Privilege `db:"permission_level" json:"permission_level"` IsNew bool `db:"-" json:"-"` DiscordID string `db:"discord_id" json:"discord_id"` IPAddr net.IP `db:"ip_addr" json:"ip_addr"` CommunityBanned bool VACBans int GameBans int EconomyBan string DaysSinceLastBan int *steamweb.PlayerSummary }
type PersonIPRecord ¶ added in v0.1.6
type PersonIPRecord struct { IP net.IP CreatedOn time.Time CityName string CountryName string CountryCode string ASName string ASNum int ISP string UsageType string Threat string DomainUsed string }
PersonIPRecord holds a composite result of the more relevant ip2location results
type PlayerInfo ¶ added in v0.1.6
type PlayerInfo struct { Player *extra.Player Server *Server SteamID steamid.SID64 InGame bool Valid bool }
func NewPlayerInfo ¶ added in v0.1.8
func NewPlayerInfo() PlayerInfo
type RawLogEvent ¶ added in v0.1.8
type RawLogEvent struct { LogID int64 `json:"log_id"` Type logparse.MsgType `json:"event_type"` Event map[string]string `json:"event"` Server Server `json:"server"` Player1 *Person `json:"player1"` Player2 *Person `json:"player2"` Assister *Person `json:"assister"` RawEvent string `json:"raw_event"` CreatedOn time.Time `json:"created_on"` }
RawLogEvent represents a full representation of a server log entry including all meta data attached to the log.
func (*RawLogEvent) Unmarshal ¶ added in v0.1.8
func (e *RawLogEvent) Unmarshal(output interface{}) error
Unmarshal is just a helper to
type Reason ¶
type Reason int
Reason defined a set of predefined ban reasons TODO make this fully dynamic?
type Server ¶
type Server struct { // Auto generated id ServerID int64 `db:"server_id" json:"server_id"` // ServerName is a short reference name for the server eg: us-1 ServerName string `db:"short_name" json:"server_name"` ServerNameLong string `db:"server_name_long" json:"server_name_long"` // Token is the current valid authentication token that the server uses to make authenticated requests Token string `db:"token" json:"token"` // Address is the ip of the server Address string `db:"address" json:"address"` // Port is the port of the server Port int `db:"port" json:"port"` // RCON is the RCON password for the server RCON string `db:"rcon" json:"-"` ReservedSlots int `db:"reserved_slots" json:"reserved_slots"` // Password is what the server uses to generate a token to make authenticated calls Password string `db:"password" json:"password"` IsEnabled bool `json:"is_enabled"` Deleted bool `json:"deleted"` Region string `json:"region"` CC string `json:"cc"` Location ip2location.LatLong `json:"location"` DefaultMap string `json:"default_map"` // TokenCreatedOn is set when changing the token TokenCreatedOn time.Time `db:"token_created_on" json:"token_created_on"` CreatedOn time.Time `db:"created_on" json:"created_on"` UpdatedOn time.Time `db:"updated_on" json:"updated_on"` }
type ServerEvent ¶ added in v0.1.8
type ServerEvent struct { LogID int64 `json:"log_id"` Server *Server `json:"server"` EventType logparse.MsgType `json:"event_type"` Source *Person `json:"source"` Target *Person `json:"target"` PlayerClass logparse.PlayerClass `json:"class"` Weapon logparse.Weapon `json:"weapon"` Damage int `json:"damage"` Item logparse.PickupItem `json:"item"` AttackerPOS logparse.Pos `json:"attacker_pos"` VictimPOS logparse.Pos `json:"victim_pos"` AssisterPOS logparse.Pos `json:"assister_pos"` Extra string `json:"extra"` CreatedOn time.Time `json:"created_on"` }
ServerEvent is a flat struct encapsulating a parsed log event Fields being present is event dependent, so do not assume everything will be available
type ServerState ¶ added in v0.1.8
type ServerStateCollection ¶ added in v0.1.8
type ServerStateCollection map[string]ServerState
TODO move findPlayerBy* methods to here
func (ServerStateCollection) ByName ¶ added in v0.1.8
func (c ServerStateCollection) ByName(name string, state *ServerState) bool
func (ServerStateCollection) ByRegion ¶ added in v0.1.8
func (c ServerStateCollection) ByRegion() map[string][]ServerState
type Stats ¶
type Stats struct { BansTotal int `json:"bans"` BansDay int `json:"bans_day"` BansWeek int `json:"bans_week"` BansMonth int `json:"bans_month"` Bans3Month int `json:"bans_3month"` Bans6Month int `json:"bans_6month"` BansYear int `json:"bans_year"` BansCIDRTotal int `json:"bans_cidr"` AppealsOpen int `json:"appeals_open"` AppealsClosed int `json:"appeals_closed"` FilteredWords int `json:"filtered_words"` ServersAlive int `json:"servers_alive"` ServersTotal int `json:"servers_total"` }