-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdomain.go
114 lines (102 loc) · 4.54 KB
/
domain.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package main
import (
"context"
"errors"
"time"
)
var (
errGetLaunchOptions = errors.New("failed to load users launch options")
errFetchSummaries = errors.New("failed to fetch summaries")
errFetchBans = errors.New("failed to fetch bans")
errAPIKey = errors.New("failed to set steam api key")
errCreateRequest = errors.New("failed to create request")
errPerformRequest = errors.New("failed to perform request")
errDecodeResponse = errors.New("failed to decode response")
errReadResponse = errors.New("failed to read response")
errCacheSetup = errors.New("failed to setup cache dirs")
errCreateCacheDir = errors.New("failed to make output cache dir")
errOpenCacheFile = errors.New("failed to open output cache file")
errWriteCacheFile = errors.New("failed to write output file")
errReadCacheFile = errors.New("failed to read cache file content")
errSteamUserData = errors.New("failed to read steam userdata root folder")
errSteamUserDataGuess = errors.New("could not determine userdata folder")
errSteamLocalConfig = errors.New("failed to locate localconfig.vdf")
errSteamLaunchArgs = errors.New("failed to get existing launch options")
errLogTailCreate = errors.New("could not create tail reader")
errDuration = errors.New("failed to parse connected duration")
errDataSourceAPIAddr = errors.New("api data source url invalid")
errPlayerListOpen = errors.New("failed to open player list")
errPathNotExist = errors.New("path does not exist")
errCreatePlayer = errors.New("failed to create new player")
errGetPlayer = errors.New("failed to load player record")
errSavePlayer = errors.New("failed to save player to database")
errRCONConnect = errors.New("failed to connect to game client RCON")
errRCONStatus = errors.New("failed to get status result")
errRCONG15 = errors.New("failed to get g15 result")
errRCONExec = errors.New("failed to exec rcon command")
errRCONRead = errors.New("failed to read rcon response")
errG15Parse = errors.New("failed to parse g15 result")
errInvalidChatType = errors.New("invalid chat destination type")
errNotMarked = errors.New("mark does not exist")
errGameStopped = errors.New("game is not running")
errDiscordActivity = errors.New("failed to set discord activity")
errParseTimestamp = errors.New("failed to parse timestamp")
errReaderG15 = errors.New("failed to read from g15 reader")
errFetchPlayerList = errors.New("failed to fetch player list")
errSettingDirectoryCreate = errors.New("failed to initialize userSettings directory")
errSettingAddress = errors.New("invalid address, cannot parse")
errSettingsAPIKeyMissing = errors.New("must set steam api key when not using bdapi")
errSettingAPIKeyInvalid = errors.New("invalid Steam API Key")
errSettingsOpen = errors.New("failed to open settings file")
errSettingsDecode = errors.New("failed to decode settings")
errSettingsOpenOutput = errors.New("failed to open userSettings file for writing")
errSettingsEncode = errors.New("failed to encode settings")
errHTTPRoutes = errors.New("failed to setup static routes")
errSettingsBDAPIAddr = errors.New("bd-api address invalid")
errResolveAddr = errors.New("failed to resolve address")
)
const (
DurationStatusUpdateTimer = time.Second * 2
DurationCheckTimer = time.Second * 3
DurationUpdateTimer = time.Second * 1
DurationAnnounceMatchTimeout = time.Minute * 5
DurationCacheTimeout = time.Hour * 12
DurationWebRequestTimeout = time.Second * 5
DurationRCONRequestTimeout = time.Second * 2
DurationProcessTimeout = time.Second * 3
)
type EventType int
const (
EvtAny = iota - 1
EvtKill
EvtMsg
EvtConnect
EvtDisconnect
EvtStatusID
EvtHostname
EvtMap
EvtTags
EvtAddress
EvtLobby
)
type KickReason string
const (
KickReasonIdle KickReason = "idle"
KickReasonScamming KickReason = "scamming"
KickReasonCheating KickReason = "cheating"
KickReasonOther KickReason = "other"
)
type ChatDest string
const (
ChatDestAll ChatDest = "all"
ChatDestTeam ChatDest = "team"
ChatDestParty ChatDest = "party"
)
type Version struct {
Version string
Commit string
Date string
}
type backgroundService interface {
start(ctx context.Context)
}