package main import "time" type Challenge struct { 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 } // 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"` } 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, Description: c.Description, Category: c.Category, FoundFlag: c.FoundFlag.Unix(), FlagTries: c.FlagTries, ContainsLaunchable: c.Container != "", IPAddress: getAddressForChallengeContainer(c.Container), } } func stripChallengeForStatistics(c Challenge) (StatsStrippedChallenge) { return StatsStrippedChallenge{ Name: c.Name, FoundFlag: c.FoundFlag.Unix(), FlagTries: c.FlagTries, } }