-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig_api.go
More file actions
52 lines (47 loc) · 872 Bytes
/
config_api.go
File metadata and controls
52 lines (47 loc) · 872 Bytes
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
package patrol
import (
"encoding/json"
)
type ConfigHTTP struct {
Listen string `json:"listen,omitempty"`
// Extra Unstructured Data
X json.RawMessage `json:"x,omitempty"`
// TODO: https?
}
func (self *ConfigHTTP) IsValid() bool {
if self == nil {
return false
}
return true
}
func (self *ConfigHTTP) Clone() *ConfigHTTP {
if self == nil {
return nil
}
config := &ConfigHTTP{
Listen: self.Listen,
X: dereference(self.X),
}
return config
}
type ConfigUDP struct {
Listen string `json:"listen,omitempty"`
// Extra Unstructured Data
X json.RawMessage `json:"x,omitempty"`
}
func (self *ConfigUDP) IsValid() bool {
if self == nil {
return false
}
return true
}
func (self *ConfigUDP) Clone() *ConfigUDP {
if self == nil {
return nil
}
config := &ConfigUDP{
Listen: self.Listen,
X: dereference(self.X),
}
return config
}