diff options
-rw-r--r-- | src/challenge.go | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/challenge.go b/src/challenge.go index 3fb26d7..547a5c8 100644 --- a/src/challenge.go +++ b/src/challenge.go @@ -3,53 +3,53 @@ package main import "time" type Challenge struct { - Name string + Name string Description string - Flag string // this should never leave the server - FoundFlag time.Time - FlagTries uint - Container string // this could, but is not required as well - Category string - Points int + Flag string // this should never leave the server + FoundFlag time.Time + FlagTries uint + Container string // this could, but is not required as well + Category string + Points int } // TODO: The name "Stripped" is a bit inaccurate now. Rename. type StrippedChallenge struct { - Name string `json:"name"` - Description string `json:"description"` - Category string `json:"category"` - FoundFlag int64 `json:"foundFlag"` - FlagTries uint `json:"flagTries"` - ContainsLaunchable bool `json:"ContainsLaunchable"` - IPAddress string `json:"IPAddress"` - Points int `json:"points"` + Name string `json:"name"` + Description string `json:"description"` + Category string `json:"category"` + FoundFlag int64 `json:"foundFlag"` + FlagTries uint `json:"flagTries"` + ContainsLaunchable bool `json:"ContainsLaunchable"` + IPAddress string `json:"IPAddress"` + Points int `json:"points"` } type StatsStrippedChallenge struct { - Name string `json:"name"` - FoundFlag int64 `json:"foundFlag"` - FlagTries uint `json:"flagTries"` - Points int `json:"points"` + Name string `json:"name"` + FoundFlag int64 `json:"foundFlag"` + FlagTries uint `json:"flagTries"` + Points int `json:"points"` } -func stripChallenge(c Challenge) (StrippedChallenge) { +func stripChallenge(c Challenge) StrippedChallenge { return StrippedChallenge{ - Name: c.Name, - Description: c.Description, - Category: c.Category, - FoundFlag: c.FoundFlag.Unix(), - FlagTries: c.FlagTries, + Name: c.Name, + Description: c.Description, + Category: c.Category, + FoundFlag: c.FoundFlag.Unix(), + FlagTries: c.FlagTries, ContainsLaunchable: c.Container != "", - IPAddress: getAddressForChallengeContainer(c.Container), - Points: c.Points, + IPAddress: getAddressForChallengeContainer(c.Container), + Points: c.Points, } } -func stripChallengeForStatistics(c Challenge) (StatsStrippedChallenge) { +func stripChallengeForStatistics(c Challenge) StatsStrippedChallenge { return StatsStrippedChallenge{ - Name: c.Name, + Name: c.Name, FoundFlag: c.FoundFlag.Unix(), FlagTries: c.FlagTries, - Points: c.Points, + Points: c.Points, } } |