-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathstructs.go
137 lines (122 loc) · 4.62 KB
/
structs.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package main
import (
"time"
)
// Capmsg defines all the options that define a pcap capture request
type Capmsg struct {
Node string `json:"node,omitempty"`
Nodere string `json:"nodere,omitempty"`
Interface []string `json:"interface,omitempty"`
Alias []string `json:"alias,omitempty"`
AliasMatched string `json:"aliasmatched,omitempty"`
Tags string `json:"tags,omitempty"`
Bpf string `json:"bpf,omitempty"`
Customer string `json:"customer,omitempty"`
Snap int `json:"snap"`
Packets int `json:"packets"`
Alertid int `json:"alertid,omitempty"`
Alertstr int `json:"alertstr,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Duration time.Duration `json:"duration,omitempty"`
Bytes int `json:"bytes,omitempty"`
PacketDebug bool `json:"packetdebug,omitempty"`
LogRequest bool `json:"logrequest,omitempty"`
Folder string `json:"folder,omitempty"`
Bucket string `json:"bucket,omitempty"`
ACL string `json:"acl,omitempty"`
Region string `json:"region,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Encryption bool `json:"encryption,omitempty"`
}
// Capmsgs is simply an array of Capmsg
type Capmsgs []Capmsg
type tomlConfig struct {
Gen General `toml:"general"`
Aws S3 `toml:"s3"`
AwsSqs Sqs `toml:"sqs"`
Cs Cloudshark `toml:"cloudshark"`
R Redis `toml:"redis"`
K Kafka `toml:"kafka"`
Ifmap InterfaceAliases `toml:"interface"`
Log Syslog `toml:"syslog"`
}
// General defines the top level "general" section of the the pcapdaemon config file
type General struct {
Maxpackets int `toml:"maxpackets"`
Maxbytes int `toml:"maxbytes"`
Maxtimeout time.Duration `toml:"maxtimeout"`
Maxduration time.Duration `toml:"maxduration"`
Deftimeout time.Duration `toml:"defaulttimeout"`
Writelocal bool `toml:"writelocal"`
Localdir string `toml:"localdir"`
Snap int `toml:"snaplength"`
PacketDebug bool `toml:"packetdebug"`
LogRequests bool `toml:"logrequests"`
}
// Cloudshark definese the cloudshark section of the config file
type Cloudshark struct {
Host string `toml:"host"`
Port int `toml:"port"`
Scheme string `toml:"scheme"`
Timeout int `toml:"timeout"`
Token string `toml:"token"`
Upload bool `toml:"upload"`
}
// InterfaceAlias defines an alias array that maps to a physical interface
type InterfaceAlias struct {
Name string `toml:"name"`
Alias []string `toml:"alias"`
}
// InterfaceAliases defines an array of InterfaceAlias
type InterfaceAliases []InterfaceAlias
// Redis defines the redis section of the config file
type Redis struct {
Host string `toml:"host"`
Port int `toml:"port"`
Channel string `toml:"channel"`
Auth string `toml:"auth"`
Listen bool `toml:"listen"`
}
// Kafka defines the kafka section of the config file
type Kafka struct {
Server []string `toml:"server"`
Topic string `toml:"topic"`
Listen bool `toml:"listen"`
}
// Syslog defines the syslog section of the config file options
type Syslog struct {
Priority int `toml:"priority"`
Tag string `toml:"tag"`
}
// S3 defines the options necessary to use an S3 bucket as a destination for the pcap file
type S3 struct {
AccessID *string `toml:"accessid"`
AccessKey *string `toml:"accesskey"`
Endpoint *string `toml:"endpoint"`
Region *string `toml:"region"`
Bucket *string `toml:"bucket"`
Folder *string `toml:"pcaps"`
Upload bool `toml:"upload"`
ACL *string `toml:"acl"`
Encryption *bool `toml:"encryption"`
}
// Sqs defines a struct that describes the options necessary to pull Capmsgs off of an Amazon SQS queue
type Sqs struct {
AccessID *string `toml:"accessid"`
AccessKey *string `toml:"accesskey"`
Region *string `toml:"region"`
URL *string `toml:"url"`
Waitseconds *int64 `toml:"waitseconds"`
Chunksize *int64 `toml:"chunksize"`
Listen bool `toml:"listen"`
}
// CsSuccess defines the object that is returned when a pcap is succuessfully posted to Cloudshark
type CsSuccess struct {
Filename string `json:"filename,omitempty"`
ID string `json:"id,omitempty"`
}
// CsFail defines the object that is returned when an object fails to post to Cloudshark
type CsFail struct {
Status int `json:"status,omitempty"`
Exceptions []string `json:"exceptions,omitempty"`
}