about summary refs log tree commit diff
path: root/src/challenge.go
blob: 991e4e5287c91953f918ab8c801afa7e51a1b2af (plain)
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
package main

type Challenge struct {
	Name string
	Description string
	Flag string // this should never leave the server
	FoundFlag bool
	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 bool `json:"foundFlag"`
	ContainsLaunchable bool `json:"ContainsLaunchable"`
	IPAddress string `json:"IPAddress"`
}

func stripChallenge(c Challenge) (StrippedChallenge) {
	return StrippedChallenge{
		Name: c.Name,
		Description: c.Description,
		Category: c.Category,
		FoundFlag: c.FoundFlag,
		ContainsLaunchable: c.Container != "",
		IPAddress: getAddressForChallengeContainer(c.Container),
	}
}