-
Notifications
You must be signed in to change notification settings - Fork 90
/
Config.go
176 lines (161 loc) · 7.92 KB
/
Config.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package models
// A struct which contains the global, local and merged config.
type Configuration struct {
Name string
Port string
Config Config
CustomConfig Config
GlobalConfig Config
}
// Config is the highlevel struct which contains all the configuration of
// your Kerberos Open Source instance.
type Config struct {
Type string `json:"type"`
Key string `json:"key"`
Name string `json:"name"`
FriendlyName string `json:"friendly_name"`
Time string `json:"time" bson:"time"`
Offline string `json:"offline"`
AutoClean string `json:"auto_clean"`
RemoveAfterUpload string `json:"remove_after_upload"`
MaxDirectorySize int64 `json:"max_directory_size"`
Timezone string `json:"timezone"`
Capture Capture `json:"capture"`
Timetable []*Timetable `json:"timetable"`
Region *Region `json:"region"`
Cloud string `json:"cloud" bson:"cloud"`
S3 *S3 `json:"s3,omitempty" bson:"s3,omitempty"`
KStorage *KStorage `json:"kstorage,omitempty" bson:"kstorage,omitempty"`
Dropbox *Dropbox `json:"dropbox,omitempty" bson:"dropbox,omitempty"`
MQTTURI string `json:"mqtturi" bson:"mqtturi,omitempty"`
MQTTUsername string `json:"mqtt_username" bson:"mqtt_username"`
MQTTPassword string `json:"mqtt_password" bson:"mqtt_password"`
STUNURI string `json:"stunuri" bson:"stunuri"`
ForceTurn string `json:"turn_force" bson:"turn_force"`
TURNURI string `json:"turnuri" bson:"turnuri"`
TURNUsername string `json:"turn_username" bson:"turn_username"`
TURNPassword string `json:"turn_password" bson:"turn_password"`
HeartbeatURI string `json:"heartbeaturi" bson:"heartbeaturi"` /*obsolete*/
HubEncryption string `json:"hub_encryption" bson:"hub_encryption"`
HubURI string `json:"hub_uri" bson:"hub_uri"`
HubKey string `json:"hub_key" bson:"hub_key"`
HubPrivateKey string `json:"hub_private_key" bson:"hub_private_key"`
HubSite string `json:"hub_site" bson:"hub_site"`
ConditionURI string `json:"condition_uri" bson:"condition_uri"`
Encryption *Encryption `json:"encryption,omitempty" bson:"encryption,omitempty"`
RealtimeProcessing string `json:"realtimeprocessing,omitempty" bson:"realtimeprocessing,omitempty"`
RealtimeProcessingTopic string `json:"realtimeprocessing_topic" bson:"realtimeprocessing_topic"`
}
// Capture defines which camera type (Id) you are using (IP, USB or Raspberry Pi camera),
// and also contains recording specific parameters.
type Capture struct {
Name string `json:"name"`
IPCamera IPCamera `json:"ipcamera"`
USBCamera USBCamera `json:"usbcamera"`
RaspiCamera RaspiCamera `json:"raspicamera"`
Recording string `json:"recording,omitempty"`
Snapshots string `json:"snapshots,omitempty"`
Motion string `json:"motion,omitempty"`
Liveview string `json:"liveview,omitempty"`
Continuous string `json:"continuous,omitempty"`
PostRecording int64 `json:"postrecording"`
PreRecording int64 `json:"prerecording"`
MaxLengthRecording int64 `json:"maxlengthrecording"`
TranscodingWebRTC string `json:"transcodingwebrtc"`
TranscodingResolution int64 `json:"transcodingresolution"`
ForwardWebRTC string `json:"forwardwebrtc"`
Fragmented string `json:"fragmented,omitempty" bson:"fragmented,omitempty"`
FragmentedDuration int64 `json:"fragmentedduration,omitempty" bson:"fragmentedduration,omitempty"`
PixelChangeThreshold int `json:"pixelChangeThreshold,omitempty"`
}
// IPCamera configuration, such as the RTSP url of the IPCamera and the FPS.
// Also includes ONVIF integration
type IPCamera struct {
RTSP string `json:"rtsp"`
Width int `json:"width"`
Height int `json:"height"`
FPS string `json:"fps"`
SubRTSP string `json:"sub_rtsp"`
SubWidth int `json:"sub_width"`
SubHeight int `json:"sub_height"`
SubFPS string `json:"sub_fps"`
ONVIF string `json:"onvif,omitempty" bson:"onvif"`
ONVIFXAddr string `json:"onvif_xaddr" bson:"onvif_xaddr"`
ONVIFUsername string `json:"onvif_username" bson:"onvif_username"`
ONVIFPassword string `json:"onvif_password" bson:"onvif_password"`
}
// USBCamera configuration, such as the device path (/dev/video*)
type USBCamera struct {
Device string `json:"device"`
}
// RaspiCamera configuration, such as the device path (/dev/video*)
type RaspiCamera struct {
Device string `json:"device"`
}
// Region specifies the type (Id) of Region Of Interest (ROI), you
// would like to use.
type Region struct {
Name string `json:"name"`
Rectangle Rectangle `json:"rectangle"`
Polygon []Polygon `json:"polygon"`
}
// Rectangle is defined by a starting point, left top (x1,y1) and end point (x2,y2).
type Rectangle struct {
X1 int `json:"x1"`
Y1 int `json:"y1"`
X2 int `json:"x2"`
Y2 int `json:"y2"`
}
// Polygon is a sequence of coordinates (x,y). The ID specifies an unique identifier,
// as multiple polygons can be defined.
type Polygon struct {
ID string `json:"id"`
Coordinates []Coordinate `json:"coordinates"`
}
// Coordinate belongs to a Polygon.
type Coordinate struct {
X float64 `json:"x"`
Y float64 `json:"y"`
}
// Timetable allows you to set a Time Of Intterest (TOI), which limits recording or
// detection to a predefined time interval. Two tracks can be set, which allows you
// to give some flexibility.
type Timetable struct {
Start1 int `json:"start1"`
End1 int `json:"end1"`
Start2 int `json:"start2"`
End2 int `json:"end2"`
}
// S3 integration
type S3 struct {
Proxy string `json:"proxy,omitempty" bson:"proxy,omitempty"`
ProxyURI string `json:"proxyuri,omitempty" bson:"proxyuri,omitempty"`
Bucket string `json:"bucket,omitempty" bson:"bucket,omitempty"`
Region string `json:"region,omitempty" bson:"region,omitempty"`
Username string `json:"username,omitempty" bson:"username,omitempty"`
Publickey string `json:"publickey,omitempty" bson:"publickey,omitempty"`
Secretkey string `json:"secretkey,omitempty" bson:"secretkey,omitempty"`
}
// KStorage contains the credentials of the Kerberos Storage/Kerberos Cloud instance.
// By defining KStorage you can make your recordings available in the cloud, at a centrel place.
type KStorage struct {
URI string `json:"uri,omitempty" bson:"uri,omitempty"`
CloudKey string `json:"cloud_key,omitempty" bson:"cloud_key,omitempty"` /* old way, remove this */
AccessKey string `json:"access_key,omitempty" bson:"access_key,omitempty"`
SecretAccessKey string `json:"secret_access_key,omitempty" bson:"secret_access_key,omitempty"`
Provider string `json:"provider,omitempty" bson:"provider,omitempty"`
Directory string `json:"directory,omitempty" bson:"directory,omitempty"`
}
// Dropbox integration
type Dropbox struct {
AccessToken string `json:"access_token,omitempty" bson:"access_token,omitempty"`
Directory string `json:"directory,omitempty" bson:"directory,omitempty"`
}
// Encryption
type Encryption struct {
Enabled string `json:"enabled" bson:"enabled"`
Recordings string `json:"recordings" bson:"recordings"`
Fingerprint string `json:"fingerprint" bson:"fingerprint"`
PrivateKey string `json:"private_key" bson:"private_key"`
SymmetricKey string `json:"symmetric_key" bson:"symmetric_key"`
}