Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteMatch(matchDel *ent.Match, db *ent.Client) error
- func GetNewShareCodesForPlayer(player *ent.Player, apiKey string, rl *rate.Limiter) ([]string, error)
- func GetWinLossTieForPlayer(dbPlayer *ent.Player) (wins int, looses int, ties int, err error)
- func IsAuthCodeValid(player *ent.Player, apiKey string, shareCode string, authCode string, ...) (bool, error)
- func Player(db *ent.Client, id interface{}, apiKey string, rl *rate.Limiter) (*ent.Player, error)
- func PlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string, rl *rate.Limiter) ([]*ent.Player, error)
- func PlayerFromSteamID64(db *ent.Client, steamID uint64, apiKey string, rl *rate.Limiter) (*ent.Player, error)
- func PlayerFromVanityURL(db *ent.Client, id string, apiKey string, rl *rate.Limiter) (*ent.Player, error)
- func RealIP(header *http.Header, fallback string) string
- func TranslateWithDeepL(text string, language string, baseURL string, apiKey string, timeout int) (translated string, detectedLanguage string, err error)
- type AuthcodeRateLimitError
- type AuthcodeUnauthorizedError
- type ChatResponse
- type CommunityXML
- type Conf
- type Damage
- type DeepLResponse
- type Flash
- type MatchResponse
- type MatchStats
- type MateResponse
- type MetaStatsResponse
- type MultiKills
- type PlayerResponse
- type Rank
- type SelfTeamEnemy
- type ShareCodeResponse
- type SharecodeNoMatchError
- type StatsResponse
- type WeaponDmg
Constants ¶
View Source
const ( CachePrefix = "csgowtfd_" SideMetaCacheKey = CachePrefix + "side_meta_%d" MatchChatCacheKey = CachePrefix + "chat_%d_%s" )
Variables ¶
View Source
var ( SteamId64RegEx = regexp.MustCompile(`^\d{17}$`) AuthCodeRegEx = regexp.MustCompile(`^[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{5}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}$`) )
Functions ¶
func GetNewShareCodesForPlayer ¶
func GetWinLossTieForPlayer ¶
func IsAuthCodeValid ¶
func Player ¶
func PlayerFromSteam ¶
func PlayerFromSteamID64 ¶
func PlayerFromVanityURL ¶
Types ¶
type AuthcodeRateLimitError ¶
type AuthcodeRateLimitError struct {
// contains filtered or unexported fields
}
type AuthcodeUnauthorizedError ¶
type AuthcodeUnauthorizedError struct {
// contains filtered or unexported fields
}
type ChatResponse ¶
type CommunityXML ¶
type Conf ¶
type Conf struct { Logging struct { Level string } Db struct { Driver string ConnectTo string `yaml:"connect_to"` } Parser struct { Worker int } Steam struct { Username string Password string AuthCode string `yaml:"auth_code"` APIKey string `yaml:"api_key"` RatePerSecond float64 `yaml:"rate_per_sec"` Sentry string LoginKey string `yaml:"login_key"` MaxRetryWait int `yaml:"max_retry_wait"` } Redis struct { Address string Password string } Httpd struct { CORSAllowDomains []string `yaml:"cors_allow_domains"` Listen []struct { Socket string Host string Port int } } Csgowtfd struct { ProfileUpdate string `yaml:"profile_update"` SharecodeUpdate string `yaml:"sharecode_update"` DemosExpire int `yaml:"demos_expire"` SprayTimeout int `yaml:"spray_timeout"` Timeout struct { Read int Write int Idle int } } DeepL struct { BaseURL string `yaml:"base_url"` APIKey string `yaml:"api_key"` Timeout int `yaml:"timeout"` } `yaml:"deepl"` }
type Damage ¶
type DeepLResponse ¶
type Flash ¶
type Flash struct { Duration *SelfTeamEnemy `json:"duration,omitempty"` Total *SelfTeamEnemy `json:"total,omitempty"` }
type MatchResponse ¶
type MatchResponse struct { MatchId uint64 `json:"match_id,string"` Map string `json:"map"` Date int64 `json:"date"` Score [2]int `json:"score"` Duration int `json:"duration"` MatchResult int `json:"match_result"` MaxRounds int `json:"max_rounds,omitempty"` Parsed bool `json:"parsed"` ReplayURL string `json:"replay_url,omitempty"` VAC bool `json:"vac"` GameBan bool `json:"game_ban"` Stats interface{} `json:"stats,omitempty"` AvgRank float64 `json:"avg_rank,omitempty"` TickRate float64 `json:"tick_rate,omitempty"` }
type MatchStats ¶
type MateResponse ¶
type MateResponse struct { Player *PlayerResponse `json:"player"` WinRate float32 `json:"win_rate,omitempty"` TieRate float32 `json:"tie_rate,omitempty"` Total int `json:"total,omitempty"` }
type MetaStatsResponse ¶
type MetaStatsResponse struct { Player *PlayerResponse `json:"player"` BestMates []*MateResponse `json:"best_mates,omitempty"` MostMates []*MateResponse `json:"most_mates,omitempty"` EqMap map[int]string `json:"eq_map,omitempty"` WeaponDmg []*WeaponDmg `json:"weapon_dmg,omitempty"` WinMaps map[string]float32 `json:"win_maps,omitempty"` TieMaps map[string]float32 `json:"tie_maps,omitempty"` TotalMaps map[string]int `json:"total_maps,omitempty"` }
func GetMetaStats ¶
func GetMetaStats(dbPlayer *ent.Player) (*MetaStatsResponse, error)
type MultiKills ¶
type PlayerResponse ¶
type PlayerResponse struct { SteamID64 uint64 `json:"steamid64,string"` Name string `json:"name,omitempty"` Avatar string `json:"avatar,omitempty"` VAC bool `json:"vac"` VACDate int64 `json:"vac_date,omitempty"` GameBan bool `json:"game_ban"` GameBanDate int64 `json:"game_ban_date,omitempty"` Tracked bool `json:"tracked"` VanityURL string `json:"vanity_url,omitempty"` MatchStats *MatchStats `json:"match_stats,omitempty"` Matches []*MatchResponse `json:"matches,omitempty"` }
type SelfTeamEnemy ¶
type SelfTeamEnemy struct { Self interface{} `json:"self,omitempty"` Team interface{} `json:"team,omitempty"` Enemy interface{} `json:"enemy,omitempty"` }
type ShareCodeResponse ¶
type ShareCodeResponse struct { string `json:"nextcode"` } `json:"result"` }Code
type SharecodeNoMatchError ¶
type SharecodeNoMatchError struct {
// contains filtered or unexported fields
}
type StatsResponse ¶
type StatsResponse struct { TeamID int `json:"team_id"` Kills int `json:"kills"` Deaths int `json:"deaths"` Assists int `json:"assists"` Headshot int `json:"headshot"` MVP uint `json:"mvp"` Score int `json:"score"` Player interface{} `json:"player,omitempty"` Rank *Rank `json:"rank,omitempty"` MultiKills *MultiKills `json:"multi_kills,omitempty"` Dmg *Damage `json:"dmg,omitempty"` Flash *Flash `json:"flash,omitempty"` Crosshair string `json:"crosshair,omitempty"` Color string `json:"color,omitempty"` KAST int `json:"kast,omitempty"` }
Click to show internal directories.
Click to hide internal directories.