diff options
author | maride <maride@darknebu.la> | 2019-10-06 16:02:47 +0200 |
---|---|---|
committer | maride <maride@darknebu.la> | 2019-10-06 16:02:47 +0200 |
commit | aa9d6793abf64d0762904b043243222a6db03c4b (patch) | |
tree | e23bbf7b2a4a58e303a22d1daec19c9c0f326cb7 /src/challenge.go | |
parent | e4637ddf366231de52c05d0092ff8ea8583a1601 (diff) |
Add non-protected handler for statistics, /api/getStats
Diffstat (limited to 'src/challenge.go')
-rw-r--r-- | src/challenge.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/challenge.go b/src/challenge.go index 0203378..1d0a210 100644 --- a/src/challenge.go +++ b/src/challenge.go @@ -23,6 +23,12 @@ type StrippedChallenge struct { IPAddress string `json:"IPAddress"` } +type StatsStrippedChallenge struct { + Name string `json:"name"` + FoundFlag int64 `json:"foundFlag"` + FlagTries uint `json:"flagTries"` +} + func stripChallenge(c Challenge) (StrippedChallenge) { return StrippedChallenge{ Name: c.Name, @@ -34,3 +40,11 @@ func stripChallenge(c Challenge) (StrippedChallenge) { IPAddress: getAddressForChallengeContainer(c.Container), } } + +func stripChallengeForStatistics(c Challenge) (StatsStrippedChallenge) { + return StatsStrippedChallenge{ + Name: c.Name, + FoundFlag: c.FoundFlag.Unix(), + FlagTries: c.FlagTries, + } +} |