Documentation
¶
Index ¶
- Constants
- func AvatarUrl(hash string) string
- type ChatDest
- type ChatFunc
- type Event
- type EventType
- type GetPlayer
- type GetPlayerOffline
- type KickFunc
- type KickReason
- type LaunchFunc
- type LinkConfig
- type LinkConfigCollection
- type ListConfig
- type ListConfigCollection
- type ListType
- type LogEvent
- type MarkFunc
- type NoteFunc
- type Player
- type PlayerCollection
- type ProfileVisibility
- type QueryNamesFunc
- type QueryUserMessagesFunc
- type RCONConfig
- type RCONConfigProvider
- type SavePlayer
- type SearchOpts
- type SearchPlayers
- type Server
- type Settings
- func (s *Settings) AddList(config *ListConfig) error
- func (s *Settings) ConfigRoot() string
- func (s *Settings) DBPath() string
- func (s *Settings) GetAPIKey() string
- func (s *Settings) GetAutoCloseOnGameExit() bool
- func (s *Settings) GetAutoLaunchGame() bool
- func (s *Settings) GetConfigPath() string
- func (s *Settings) GetDebugLogEnabled() bool
- func (s *Settings) GetDiscordPresenceEnabled() bool
- func (s *Settings) GetKickTags() []string
- func (s *Settings) GetKickerEnabled() bool
- func (s *Settings) GetLinks() LinkConfigCollection
- func (s *Settings) GetLists() ListConfigCollection
- func (s *Settings) GetPartyWarningsEnabled() bool
- func (s *Settings) GetRCONStatic() bool
- func (s *Settings) GetRcon() RCONConfigProvider
- func (s *Settings) GetSteamDir() string
- func (s *Settings) GetSteamId() steamid.SID64
- func (s *Settings) GetTF2Dir() string
- func (s *Settings) GetVoiceBansEnabled() bool
- func (s *Settings) ListRoot() string
- func (s *Settings) LocalPlayerListPath() string
- func (s *Settings) LocalRulesListPath() string
- func (s *Settings) LogFilePath() string
- func (s *Settings) Read(inputFile io.Reader) error
- func (s *Settings) ReadDefaultOrCreate() error
- func (s *Settings) ReadFilePath(filePath string) error
- func (s *Settings) Save() error
- func (s *Settings) SetAPIKey(key string)
- func (s *Settings) SetAutoCloseOnGameExit(autoClose bool)
- func (s *Settings) SetAutoLaunchGame(autoLaunch bool)
- func (s *Settings) SetChatWarningsEnabled(enabled bool)
- func (s *Settings) SetDebugLogEnabled(enabled bool)
- func (s *Settings) SetDiscordPresenceEnabled(enabled bool)
- func (s *Settings) SetKickTags(tags []string)
- func (s *Settings) SetKickerEnabled(enabled bool)
- func (s *Settings) SetLinks(links []*LinkConfig)
- func (s *Settings) SetLists(lists ListConfigCollection)
- func (s *Settings) SetPartyWarningsEnabled(enabled bool)
- func (s *Settings) SetRconStatic(static bool)
- func (s *Settings) SetSteamDir(dir string)
- func (s *Settings) SetSteamID(steamID string)
- func (s *Settings) SetTF2Dir(dir string)
- func (s *Settings) SetVoiceBansEnabled(enabled bool)
- func (s *Settings) Write(outputFile io.Writer) error
- func (s *Settings) WriteFilePath(filePath string) error
- type SteamIDErrFunc
- type SteamIDFunc
- type SteamIdFormat
- type Team
- type UserInterface
- type UserMessage
- type UserMessageCollection
- type UserNameHistory
- type UserNameHistoryCollection
- type Version
Constants ¶
View Source
const ( DurationStatusUpdateTimer = time.Second * 2 DurationDisconnected = DurationStatusUpdateTimer * 3 DurationPlayerExpired = DurationStatusUpdateTimer * 10 DurationCheckTimer = time.Second * 3 DurationUpdateTimer = time.Second * 1 DurationAnnounceMatchTimeout = time.Minute * 5 DurationCacheTimeout = time.Hour * 12 DurationWebRequestTimeout = time.Second * 5 DurationRCONRequestTimeout = time.Second DurationProcessTimeout = time.Second * 3 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GetPlayerOffline ¶
type KickFunc ¶
type KickFunc func(userId int64, reason KickReason) error
type KickReason ¶
type KickReason string
const ( KickReasonIdle KickReason = "idle" KickReasonScamming KickReason = "scamming" KickReasonCheating KickReason = "cheating" KickReasonOther KickReason = "other" )
type LaunchFunc ¶
type LaunchFunc func()
type LinkConfig ¶
type LinkConfigCollection ¶ added in v0.0.7
type LinkConfigCollection []*LinkConfig
func (LinkConfigCollection) AsAny ¶ added in v0.0.7
func (list LinkConfigCollection) AsAny() []any
type ListConfig ¶
type ListConfigCollection ¶
type ListConfigCollection []*ListConfig
func (ListConfigCollection) AsAny ¶
func (list ListConfigCollection) AsAny() []any
type LogEvent ¶
type LogEvent struct {
Type EventType
Player string
PlayerPing int
PlayerConnected time.Duration
Team Team
UserId int64
PlayerSID steamid.SID64
Victim string
VictimSID steamid.SID64
Message string
Timestamp time.Time
MetaData string
Dead bool
TeamOnly bool
}
func (*LogEvent) ApplyTimestamp ¶
type Player ¶
type Player struct {
sync.RWMutex
// SteamId is the 64bit steamid of the user
SteamId steamid.SID64
// Name is the current in-game name of the player. This can be different from their name via steam api when
// using changer/stealers
Name string
// CreatedOn is the first time we have seen the player
CreatedOn time.Time
// UpdatedOn is the last time we have received a status update from rcon
// This is used to calculate when we consider the player disconnected and also when
// they are expired and should be removed from the player pool entirely.
UpdatedOn time.Time
ProfileUpdatedOn time.Time
// The users kill count vs this player
KillsOn int
RageQuits int
DeathsBy int
Notes string
Whitelisted bool
// PlayerSummary
RealName string
NamePrevious string
AccountCreatedOn time.Time
Visibility ProfileVisibility
AvatarHash string
// PlayerBanState
CommunityBanned bool
NumberOfVACBans int
LastVACBanOn *time.Time
NumberOfGameBans int
EconomyBan bool
// tf_lobby_debug
Team Team
// status
// Connected is how long the user has been in the server
Connected time.Duration
// In game user id
UserId int64
Ping int
// Parsed stats from logs
Kills int
Deaths int
// Incremented on each kick attempt. Used to cycle through and not attempt the same bot
KickAttemptCount int
// Tracks the duration between announces to chat
AnnouncedPartyLast time.Time
AnnouncedGeneralLast time.Time
// Dangling will be true when the user is new and doesn't have a physical entry in the database yet.
Dangling bool
OurFriend bool
// Dirty indicates that state which has database backed fields has been changed and need to be saved
Dirty bool
Match *rules.MatchResult
}
func (*Player) GetAvatarHash ¶
func (*Player) GetSteamID ¶
func (*Player) IsDisconnected ¶
type PlayerCollection ¶
type PlayerCollection []*Player
func (PlayerCollection) AsAny ¶
func (players PlayerCollection) AsAny() []any
type ProfileVisibility ¶
type ProfileVisibility int
ProfileVisibility represents whether the profile is visible or not, and if it is visible, why you are allowed to see it. Note that because this WebAPI does not use authentication, there are only two possible values returned: 1 - the profile is not visible to you (Private, Friends Only, etc), 3 - the profile is "Public", and the data is visible. Mike Blaszczak's post on Steam forums says, "The community visibility state this API returns is different than the privacy state. It's the effective visibility state from the account making the request to the account being viewed given the requesting account's relationship to the viewed account."
const ( ProfileVisibilityPrivate ProfileVisibility = iota + 1 ProfileVisibilityFriendsOnly ProfileVisibilityPublic )
type QueryNamesFunc ¶
type QueryUserMessagesFunc ¶
type RCONConfig ¶
type RCONConfig struct {
// contains filtered or unexported fields
}
func (RCONConfig) Host ¶
func (cfg RCONConfig) Host() string
func (RCONConfig) Password ¶
func (cfg RCONConfig) Password() string
func (RCONConfig) Port ¶
func (cfg RCONConfig) Port() uint16
func (RCONConfig) String ¶
func (cfg RCONConfig) String() string
type RCONConfigProvider ¶
func NewRconConfig ¶
func NewRconConfig(static bool) RCONConfigProvider
type SearchOpts ¶
type SearchOpts struct {
Query string
}
type SearchPlayers ¶
type SearchPlayers func(ctx context.Context, opts SearchOpts) (PlayerCollection, error)
type Settings ¶
type Settings struct {
*sync.RWMutex `yaml:"-"`
// Path to config used when reading Settings
ConfigPath string `yaml:"-"`
SteamID string `yaml:"steam_id"`
// Path to directory with steam.dll (C:\Program Files (x86)\Steam)
// eg: -> ~/.local/share/Steam/userdata/123456789/config/localconfig.vdf
SteamDir string `yaml:"steam_dir"`
// Path to tf2 mod (C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf)
TF2Dir string `yaml:"tf2_dir"`
AutoLaunchGame bool `yaml:"auto_launch_game_auto"`
AutoCloseOnGameExit bool `yaml:"auto_close_on_game_exit"`
APIKey string `yaml:"api_key"`
DisconnectedTimeout string `yaml:"disconnected_timeout"`
DiscordPresenceEnabled bool `yaml:"discord_presence_enabled"`
KickerEnabled bool `yaml:"kicker_enabled"`
ChatWarningsEnabled bool `yaml:"chat_warnings_enabled"`
PartyWarningsEnabled bool `yaml:"party_warnings_enabled"`
KickTags []string `yaml:"kick_tags"`
VoiceBansEnabled bool `yaml:"voice_bans_enabled"`
DebugLogEnabled bool `yaml:"debug_log_enabled"`
Lists ListConfigCollection `yaml:"lists"`
Links []*LinkConfig `yaml:"links"`
RCONStatic bool `yaml:"rcon_static"`
// contains filtered or unexported fields
}
func NewSettings ¶
func (*Settings) AddList ¶
func (s *Settings) AddList(config *ListConfig) error
func (*Settings) ConfigRoot ¶
func (*Settings) GetAutoCloseOnGameExit ¶ added in v0.0.7
func (*Settings) GetAutoLaunchGame ¶ added in v0.0.7
func (*Settings) GetConfigPath ¶ added in v0.0.7
func (*Settings) GetDebugLogEnabled ¶ added in v0.0.8
func (*Settings) GetDiscordPresenceEnabled ¶ added in v0.0.7
func (*Settings) GetKickTags ¶ added in v0.0.7
func (*Settings) GetKickerEnabled ¶ added in v0.0.7
func (*Settings) GetLinks ¶
func (s *Settings) GetLinks() LinkConfigCollection
func (*Settings) GetLists ¶ added in v0.0.7
func (s *Settings) GetLists() ListConfigCollection
func (*Settings) GetPartyWarningsEnabled ¶ added in v0.0.7
func (*Settings) GetRCONStatic ¶ added in v0.0.7
func (*Settings) GetRcon ¶ added in v0.0.7
func (s *Settings) GetRcon() RCONConfigProvider
func (*Settings) GetSteamDir ¶ added in v0.0.7
func (*Settings) GetSteamId ¶
func (*Settings) GetVoiceBansEnabled ¶ added in v0.0.8
func (*Settings) LocalPlayerListPath ¶
func (*Settings) LocalRulesListPath ¶
func (*Settings) LogFilePath ¶ added in v0.0.8
func (*Settings) ReadDefaultOrCreate ¶
func (*Settings) ReadFilePath ¶
func (*Settings) SetAutoCloseOnGameExit ¶ added in v0.0.7
func (*Settings) SetAutoLaunchGame ¶ added in v0.0.7
func (*Settings) SetChatWarningsEnabled ¶ added in v0.0.7
func (*Settings) SetDebugLogEnabled ¶ added in v0.0.8
func (*Settings) SetDiscordPresenceEnabled ¶ added in v0.0.10
func (*Settings) SetKickTags ¶ added in v0.0.7
func (*Settings) SetKickerEnabled ¶ added in v0.0.7
func (*Settings) SetLinks ¶ added in v0.0.7
func (s *Settings) SetLinks(links []*LinkConfig)
func (*Settings) SetLists ¶ added in v0.0.7
func (s *Settings) SetLists(lists ListConfigCollection)
func (*Settings) SetPartyWarningsEnabled ¶ added in v0.0.7
func (*Settings) SetRconStatic ¶ added in v0.0.7
func (*Settings) SetSteamDir ¶ added in v0.0.7
func (*Settings) SetSteamID ¶ added in v0.0.7
func (*Settings) SetVoiceBansEnabled ¶ added in v0.0.8
func (*Settings) WriteFilePath ¶
type SteamIDErrFunc ¶
type SteamIDFunc ¶
type SteamIdFormat ¶
type SteamIdFormat string
TODO add to steamid pkg
const ( Steam64 SteamIdFormat = "steam64" Steam3 SteamIdFormat = "steam3" Steam32 SteamIdFormat = "steam32" Steam SteamIdFormat = "steam" )
type UserInterface ¶
type UserInterface interface {
Refresh()
Start(ctx context.Context)
Quit()
UpdateServerState(state Server)
UpdatePlayerState(collection PlayerCollection)
AddUserMessage(message UserMessage)
UpdateAttributes([]string)
SetAvatar(sid64 steamid.SID64, avatar []byte)
}
type UserMessage ¶
type UserMessage struct {
MessageId int64
Team Team
Player string
PlayerSID steamid.SID64
UserId int64
Message string
Created time.Time
Dead bool
TeamOnly bool
}
func (UserMessage) Formatted ¶
func (um UserMessage) Formatted() string
type UserMessageCollection ¶
type UserMessageCollection []UserMessage
func (UserMessageCollection) AsAny ¶
func (messages UserMessageCollection) AsAny() []any
type UserNameHistoryCollection ¶
type UserNameHistoryCollection []UserNameHistory
func (UserNameHistoryCollection) AsAny ¶
func (names UserNameHistoryCollection) AsAny() []any
Click to show internal directories.
Click to hide internal directories.