-
Notifications
You must be signed in to change notification settings - Fork 0
/
target.go
41 lines (32 loc) · 946 Bytes
/
target.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
package target
import (
"time"
"gopkg.in/mgo.v2/bson"
"github.com/bearded-web/bearded/models/issue"
"github.com/bearded-web/bearded/pkg/pagination"
)
type SummaryReport struct {
Issues map[issue.Severity]int `json:"issues"`
}
type Target struct {
Id bson.ObjectId `json:"id,omitempty" bson:"_id"`
Type TargetType `json:"type" description:"one of [web|mobile]"`
Web *WebTarget `json:"web,omitempty" description:"information about web target"`
Project bson.ObjectId `json:"project"`
Created time.Time `json:"created,omitempty"`
Updated time.Time `json:"updated,omitempty"`
SummaryReport *SummaryReport `json:"summaryReport,omitempty" bson:"-"`
}
type WebTarget struct {
Domain string `json:"domain"`
}
type TargetList struct {
pagination.Meta `json:",inline"`
Results []*Target `json:"results"`
}
func (t *Target) Addr() string {
if t.Type == "web" {
return t.Web.Domain
}
return ""
}