-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.go
618 lines (545 loc) · 23.7 KB
/
content.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
package connect
import "encoding/json"
type AttachmentAction string
const (
Block AttachmentAction = "Block"
Accept AttachmentAction = "Accept"
)
type AttachmentType string
const (
FileName AttachmentType = "FileName"
MimeType AttachmentType = "MimeType"
)
// AttachmentItem - Attachment filter rule item
type AttachmentItem struct {
Id KId `json:"id"`
Enabled bool `json:"enabled"` // the rule is in use
Type AttachmentType `json:"type"` // type of the rule
Content string `json:"content"` // *,? wildcards are supported
Action AttachmentAction `json:"action"` // what to do if the rule maches
Description string `json:"description"` //
}
type AttachmentItemList []AttachmentItem
// AttachmentSetting - Attachment filter settings
type AttachmentSetting struct {
Enabled bool `json:"enabled"` // attachment filter is on/off
WarnSender bool `json:"warnSender"` // sender will (not) obtain warning message
ForwardOriginal OptionalString `json:"forwardOriginal"` // where to forward original message
ForwardFiltered OptionalString `json:"forwardFiltered"` // where to forward filtered message
EnableZipContentFilter bool `json:"enableZipContentFilter"` // checks zip content for prohibited extennsions
}
// AntivirusOption - Note: fields name and content must be assigned if used in set methods
type AntivirusOption struct {
Name string `json:"name"`
Content string `json:"content"`
DefaultValue string `json:"defaultValue"` // read only value
}
type AntivirusOptionList []AntivirusOption
// AntivirusPlugin - Note: field id must be assigned if used in set methods
type AntivirusPlugin struct {
Id string `json:"id"` // example: avir_avg
Description string `json:"description"` // example: AVG Email Server Edition
AreOptionsAvailable bool `json:"areOptionsAvailable"`
Options AntivirusOptionList `json:"options"`
}
type AntivirusPluginList []AntivirusPlugin
type IntegratedEngine struct {
CheckForUpdates bool `json:"checkForUpdates"` // should we periodically ask for a new version?
UpdatePeriod int `json:"updatePeriod"` // update checking period in hours
DatabaseAge DistanceOrNull `json:"databaseAge"` // how old is virus database
LastUpdateCheck DistanceOrNull `json:"lastUpdateCheck"` // how long is since last database update check
DatabaseVersion string `json:"databaseVersion"` // virus database version
EngineVersion string `json:"engineVersion"` // scanning engine version
IsPluginAvailable bool `json:"isPluginAvailable"` // says if plugins dll is on hardrive
IsLiveProtectionEnabled bool `json:"isLiveProtectionEnabled"`
}
// ReactionOnVirus - What to do with an infected file
type ReactionOnVirus string
const (
DiscardMessage ReactionOnVirus = "DiscardMessage" // completely dicard the message
RemoveVirus ReactionOnVirus = "RemoveVirus" // deliver the message but remove malicious code
)
// ReactionOnNotScanned - What to do with a corrupted or encrypted file
type ReactionOnNotScanned string
const (
DeliverWithWarning ReactionOnNotScanned = "DeliverWithWarning" // deliver original message with prepended warning
SameAsVirus ReactionOnNotScanned = "SameAsVirus" // the same reaction as for ReactionOnVirus
)
// AntivirusStatus - Are all possible states covered
type AntivirusStatus string
const (
AntivirusOk AntivirusStatus = "AntivirusOk" // no message is needed
NoAntivirus AntivirusStatus = "NoAntivirus" // neither internal nor external antivirus is active
InternalFailure AntivirusStatus = "InternalFailure" // problem with internal intivirus
ExternalFailure AntivirusStatus = "ExternalFailure" // problem with external intivirus
DoubleFailer AntivirusStatus = "DoubleFailer" // both internal and external antivirus has failed
)
type FoundVirusBehavior struct {
Reaction ReactionOnVirus `json:"reaction"`
ForwardOriginal OptionalString `json:"forwardOriginal"` // should be original message forwarded?
ForwardFiltered OptionalString `json:"forwardFiltered"` // should be filtered message forwarded?
}
type AntivirusSetting struct {
UseIntegrated bool `json:"useIntegrated"` // integrated antivirus is used?
UseExternal bool `json:"useExternal"` // an external antivirus is used? note: both internal and extenal can be used together
Status AntivirusStatus `json:"status"` // status of antivirus to be used for informative massage
Plugins AntivirusPluginList `json:"plugins"` // list of available antivirus plugins
SelectedId string `json:"selectedId"` // identifier of currently selected antivirus plugin
Engine IntegratedEngine `json:"engine"` // integrated engine settings
VirusReaction FoundVirusBehavior `json:"virusReaction"` // found virus reaction setting
NotScannedReaction ReactionOnNotScanned `json:"notScannedReaction"` // found corruption or encryption reaction type
}
type UpdateStatus string
const (
UpdateStarted UpdateStatus = "UpdateStarted"
UpdateFinished UpdateStatus = "UpdateFinished"
UpdateError UpdateStatus = "UpdateError"
UpdateDownloadIni UpdateStatus = "UpdateDownloadIni"
UpdateDownloadData UpdateStatus = "UpdateDownloadData"
UpdateUpToDate UpdateStatus = "UpdateUpToDate"
)
type IntegratedAvirUpdateStatus struct {
Status UpdateStatus `json:"status"` // state of update process
Percent int `json:"percent"` // percent of downloaded data
}
type BlockOrScore string
const (
BlockMessage BlockOrScore = "BlockMessage" // block the message
ScoreMessage BlockOrScore = "ScoreMessage" // add SPAM score to the message
)
// BlackListSetting - Custom setting of blacklist spammer IP addresses
type BlackListSetting struct {
Enabled bool `json:"enabled"`
Id KId `json:"id"` // global identifier
Name string `json:"name"`
Action BlockOrScore `json:"action"`
Score int `json:"score"`
}
type SpamAction string
const (
LogToSecurity SpamAction = "LogToSecurity" // only log to security log
BlockAction SpamAction = "BlockAction" // block the meassage
ScoreAction SpamAction = "ScoreAction" // increase spam score
)
type CallerId struct {
Enabled bool `json:"enabled"`
Action SpamAction `json:"action"`
Score int `json:"score"`
ApplyOnTesting bool `json:"applyOnTesting"`
ExceptionIpGroup OptionalEntity `json:"exceptionIpGroup"` // switchable custom white list IP group
}
type Spf struct {
Enabled bool `json:"enabled"`
Action SpamAction `json:"action"`
Score int `json:"score"`
ExceptionIpGroup OptionalEntity `json:"exceptionIpGroup"` // switchable custom white list IP group
}
type Repellent struct {
Enabled bool `json:"enabled"`
Delay int `json:"delay"`
CustomWhiteList OptionalEntity `json:"customWhiteList"` // switchable custom white list IP group
ReportToSecurity bool `json:"reportToSecurity"` // do (not) report a spam attack to security log
}
type BayesState string
const (
Disabled BayesState = "Disabled" // Bayes database statistics are not provided
Learning BayesState = "Learning"
Active BayesState = "Active"
)
// GreylistingStatus - State of the Greylisting client.
type GreylistingStatus string
const (
GreylistingOff GreylistingStatus = "GreylistingOff"
GreylistingOn GreylistingStatus = "GreylistingOn"
GreylistingError GreylistingStatus = "GreylistingError" // Greylisting encountered an error. Call Content.testGreylistConnection() for a more detailed error description.
)
type Greylisting struct {
Enabled bool `json:"enabled"` // is greylisting enabled?
/// When enabled is set to true, the setAntiSpamSetting method attempts to connect to the greylisting service asynchronously.
/// When enabled is set to false, connection to the greylisting service is closed.
CustomWhiteList OptionalEntity `json:"customWhiteList"` // switchable custom whitelist IP group
Status GreylistingStatus `json:"status"` // read only: current status
MessagesAccepted string `json:"messagesAccepted"` // read only: messages accepted
MessagesDelayed string `json:"messagesDelayed"` // read only: messages temoprarily rejected
MessagesSkipped string `json:"messagesSkipped"` // read only: messages skipped
}
type IntegratedAntiSpamStatus string
const (
AntiSpamReady IntegratedAntiSpamStatus = "AntiSpamReady"
AntiSpamDisabled IntegratedAntiSpamStatus = "AntiSpamDisabled"
AntiSpamNotLicenced IntegratedAntiSpamStatus = "AntiSpamNotLicenced"
AntiSpamNotInitialized IntegratedAntiSpamStatus = "AntiSpamNotInitialized"
AntiSpamNotConnected IntegratedAntiSpamStatus = "AntiSpamNotConnected"
)
type IntegratedAntiSpamEngine struct {
Enabled bool `json:"enabled"`
Score int `json:"score"` // Spam score(default 10)
NegativeScore int `json:"negativeScore"` // Score for legit messages (default 0)
SubmitSpam bool `json:"submitSpam"` // Submit spam samples(default on)
SubmitLegit bool `json:"submitLegit"` // Submit legit samples(default on)
Status IntegratedAntiSpamStatus `json:"status"` // [READ-ONLY]
IsLicensed bool `json:"isLicensed"` // [READ-ONLY] Is license valid and not expired? If false engine is not running no matter on value in enabled.
}
type AntiSpamSetting struct {
IsRatingEnabled bool `json:"isRatingEnabled"` // is spam filter rating enabled?
IsRatingRelayEnabled bool `json:"isRatingRelayEnabled"` // is rating of messages sent from trustworthy relay agents enabled?
TagScore int `json:"tagScore"`
BlockScore int `json:"blockScore"`
SubjectPrefix OptionalString `json:"subjectPrefix"` // SPAM is marked with this prefix
SendBounce bool `json:"sendBounce"` // send bounce message to the sender of SPAM?
QuarantineAddress OptionalString `json:"quarantineAddress"` // forward SPAM to a Quarantine address?
CustomWhiteList OptionalEntity `json:"customWhiteList"` // switchable custom white list IP group
CustomBlackList BlackListSetting `json:"customBlackList"` // switchable custom blacklist list IP group
SendBounceCustom bool `json:"sendBounceCustom"` // send bounce message to the sender if rejection was done by custom rule(s)?
QuarantineAddressCustom OptionalString `json:"quarantineAddressCustom"` // forward custom rules identified SPAM to a Quarantine address?
UseSurbl bool `json:"useSurbl"` // use Spam URI Realtime Block List database?
FilterStatus BayesState `json:"filterStatus"` // read only: Bayesian filter status
LearnedAsSpam int `json:"learnedAsSpam"` // read only: number of messages that Bayesian filter learned as Spam
LearnedAsNotSpam int `json:"learnedAsNotSpam"` // read only: number of messages that Bayesian filter learned as NOT a Spam
IsCustomSigningKey bool `json:"isCustomSigningKey"` // Custom signing key is used for DKIM validation
CallerSetting CallerId `json:"callerSetting"` // Caller ID setting
CallerUrl string `json:"callerUrl"` // read only: Caller ID URL with detailed info
SpfSetting Spf `json:"spfSetting"` // Sender Policy Framework setting
RepellentSetting Repellent `json:"repellentSetting"`
GreylistingStatus Greylisting `json:"greylistingStatus"`
UseCustomRulesInSmtp bool `json:"useCustomRulesInSmtp"` //
IntegratedAntiSpamSetting IntegratedAntiSpamEngine `json:"integratedAntiSpamSetting"` // Kerio Anti-Spam
}
type BlackList struct {
Id KId `json:"id"` // global identifier
Enabled bool `json:"enabled"`
DnsSuffix string `json:"dnsSuffix"`
Description string `json:"description"`
Action BlockOrScore `json:"action"` // what to do if IP address is found on blacklist
Score int `json:"score"`
AskDirectly bool `json:"askDirectly"`
}
type BlackListList []BlackList
type CustomRuleKind string
const (
Header CustomRuleKind = "Header"
Body CustomRuleKind = "Body"
)
type CustomRuleType string
const (
IsEmpty CustomRuleType = "IsEmpty"
IsMissing CustomRuleType = "IsMissing"
ContainsAddress CustomRuleType = "ContainsAddress"
ContainsDomain CustomRuleType = "ContainsDomain"
ContainsSubstring CustomRuleType = "ContainsSubstring"
ContainsBinary CustomRuleType = "ContainsBinary"
)
type CustomRuleAction string
const (
TreatAsSpam CustomRuleAction = "TreatAsSpam"
TreatAsNotSpam CustomRuleAction = "TreatAsNotSpam"
IncreaseSpamScore CustomRuleAction = "IncreaseSpamScore"
)
type CustomRule struct {
Id KId `json:"id"` // global identifier
Enabled bool `json:"enabled"`
Kind CustomRuleKind `json:"kind"`
Header string `json:"header"`
Content string `json:"content"`
Description string `json:"description"`
Type CustomRuleType `json:"type"`
Action CustomRuleAction `json:"action"`
Score int `json:"score"`
LastUsed DistanceOrNull `json:"lastUsed"`
}
type CustomRuleList []CustomRule
type HourOrDay string
const (
Hour HourOrDay = "Hour"
Day HourOrDay = "Day"
)
// ContentAddBlackLists - Add a blacklist item.
// items - array of new items
// Return
// errors - error message list
func (s *ServerConnection) ContentAddBlackLists(items BlackListList) (ErrorList, error) {
params := struct {
Items BlackListList `json:"items"`
}{items}
data, err := s.CallRaw("Content.addBlackLists", params)
if err != nil {
return nil, err
}
errors := struct {
Result struct {
Errors ErrorList `json:"errors"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &errors)
return errors.Result.Errors, err
}
// ContentGetAntiSpamSetting - Get antiSPAM settings.
// Return
// setting - new antivirus filter settings
func (s *ServerConnection) ContentGetAntiSpamSetting() (*AntiSpamSetting, error) {
data, err := s.CallRaw("Content.getAntiSpamSetting", nil)
if err != nil {
return nil, err
}
setting := struct {
Result struct {
Setting AntiSpamSetting `json:"setting"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &setting)
return &setting.Result.Setting, err
}
// ContentGetAntivirusSetting - Get antivirus filter settings.
// Return
// setting - new antivirus filter settings
func (s *ServerConnection) ContentGetAntivirusSetting() (*AntivirusSetting, error) {
data, err := s.CallRaw("Content.getAntivirusSetting", nil)
if err != nil {
return nil, err
}
setting := struct {
Result struct {
Setting AntivirusSetting `json:"setting"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &setting)
return &setting.Result.Setting, err
}
// ContentGetAttachmentRules - Get a list of attachment filter rules.
// Return
// filterRules - attachment filter rules
func (s *ServerConnection) ContentGetAttachmentRules() (AttachmentItemList, error) {
data, err := s.CallRaw("Content.getAttachmentRules", nil)
if err != nil {
return nil, err
}
filterRules := struct {
Result struct {
FilterRules AttachmentItemList `json:"filterRules"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &filterRules)
return filterRules.Result.FilterRules, err
}
// ContentGetAttachmentSetting - Obtain attachment filter settings.
// Return
// setting - current attachment filter settings
func (s *ServerConnection) ContentGetAttachmentSetting() (*AttachmentSetting, error) {
data, err := s.CallRaw("Content.getAttachmentSetting", nil)
if err != nil {
return nil, err
}
setting := struct {
Result struct {
Setting AttachmentSetting `json:"setting"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &setting)
return &setting.Result.Setting, err
}
// ContentGetAvailableAttachments - When adding a new attachment rule this can be used to find out available values.
// Return
// fileNames - list of available file names
// mimeTypes - list of available MIME types
func (s *ServerConnection) ContentGetAvailableAttachments() (StringList, StringList, error) {
data, err := s.CallRaw("Content.getAvailableAttachments", nil)
if err != nil {
return nil, nil, err
}
fileNames := struct {
Result struct {
FileNames StringList `json:"fileNames"`
MimeTypes StringList `json:"mimeTypes"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &fileNames)
return fileNames.Result.FileNames, fileNames.Result.MimeTypes, err
}
// ContentGetBlackListList - Obtain all blacklist items.
// Return
// list - blacklist items
func (s *ServerConnection) ContentGetBlackListList() (BlackListList, error) {
data, err := s.CallRaw("Content.getBlackListList", nil)
if err != nil {
return nil, err
}
list := struct {
Result struct {
List BlackListList `json:"list"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &list)
return list.Result.List, err
}
// ContentGetCustomRuleList - Obtain all custom rules.
// query - condition and limit definition (orderBy is ignored)
// Return
// list - custom rules
// totalItems - amount of rules for given search condition, useful when a limit is defined in search query
func (s *ServerConnection) ContentGetCustomRuleList(query SearchQuery) (CustomRuleList, int, error) {
query = addMissedParametersToSearchQuery(query)
params := struct {
Query SearchQuery `json:"query"`
}{query}
data, err := s.CallRaw("Content.getCustomRuleList", params)
if err != nil {
return nil, 0, err
}
list := struct {
Result struct {
List CustomRuleList `json:"list"`
TotalItems int `json:"totalItems"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &list)
return list.Result.List, list.Result.TotalItems, err
}
// ContentRemoveBlackLists - Remove blacklist items.
// ids - identifier list of blacklists to be deleted
// Return
// errors - error message list
func (s *ServerConnection) ContentRemoveBlackLists(ids KIdList) (ErrorList, error) {
params := struct {
Ids KIdList `json:"ids"`
}{ids}
data, err := s.CallRaw("Content.removeBlackLists", params)
if err != nil {
return nil, err
}
errors := struct {
Result struct {
Errors ErrorList `json:"errors"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &errors)
return errors.Result.Errors, err
}
// ContentRemoveUnusedCustomRules - Remove custom rules which are not used for a specified time.
// number - how many hours/days is the rule unused
// unit - which unit is used to measure
func (s *ServerConnection) ContentRemoveUnusedCustomRules(number int, unit HourOrDay) error {
params := struct {
Number int `json:"number"`
Unit HourOrDay `json:"unit"`
}{number, unit}
_, err := s.CallRaw("Content.removeUnusedCustomRules", params)
return err
}
// ContentSetAntiSpamSetting - Set antiSPAM filter settings.
// setting - new antivirus filter settings
func (s *ServerConnection) ContentSetAntiSpamSetting(setting AntiSpamSetting) error {
params := struct {
Setting AntiSpamSetting `json:"setting"`
}{setting}
_, err := s.CallRaw("Content.setAntiSpamSetting", params)
return err
}
// ContentSetAntivirusSetting - Set antivirus filter settings.
// setting - new antivirus filter settingss
// Return
// errors - error message; Value of inputIndex means type of antivirus (integrated = 0 and external = 1).
func (s *ServerConnection) ContentSetAntivirusSetting(setting AntivirusSetting) (ErrorList, error) {
params := struct {
Setting AntivirusSetting `json:"setting"`
}{setting}
data, err := s.CallRaw("Content.setAntivirusSetting", params)
if err != nil {
return nil, err
}
errors := struct {
Result struct {
Errors ErrorList `json:"errors"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &errors)
return errors.Result.Errors, err
}
// ContentSetAttachmentRules - Set list of attachment filter rules.
// filterRules - attachment filter rules
func (s *ServerConnection) ContentSetAttachmentRules(filterRules AttachmentItemList) error {
params := struct {
FilterRules AttachmentItemList `json:"filterRules"`
}{filterRules}
_, err := s.CallRaw("Content.setAttachmentRules", params)
return err
}
// ContentSetAttachmentSetting - Set attachment filter settings.
// setting - new attachment filter settings
func (s *ServerConnection) ContentSetAttachmentSetting(setting AttachmentSetting) error {
params := struct {
Setting AttachmentSetting `json:"setting"`
}{setting}
_, err := s.CallRaw("Content.setAttachmentSetting", params)
return err
}
// ContentSetBlackLists - Set blacklist item.
// ids - list of blacklist global identifier(s)
// pattern - pattern to use for new values
// Return
// errors - error message list
func (s *ServerConnection) ContentSetBlackLists(ids KIdList, pattern BlackList) (ErrorList, error) {
params := struct {
Ids KIdList `json:"ids"`
Pattern BlackList `json:"pattern"`
}{ids, pattern}
data, err := s.CallRaw("Content.setBlackLists", params)
if err != nil {
return nil, err
}
errors := struct {
Result struct {
Errors ErrorList `json:"errors"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &errors)
return errors.Result.Errors, err
}
// ContentSetCustomRuleList - Set custom rules.
// list - custom rule records
func (s *ServerConnection) ContentSetCustomRuleList(list CustomRuleList) error {
params := struct {
List CustomRuleList `json:"list"`
}{list}
_, err := s.CallRaw("Content.setCustomRuleList", params)
return err
}
// ContentTestGreylistConnection - Test connection to the greylisting service. Returns nothing if successful.
func (s *ServerConnection) ContentTestGreylistConnection() error {
_, err := s.CallRaw("Content.testGreylistConnection", nil)
return err
}
// ContentTestIntegratedAntiSpamEngine - Test connection to the anti-spam service. Returns nothing if successful.
func (s *ServerConnection) ContentTestIntegratedAntiSpamEngine() (*IntegratedAntiSpamStatus, error) {
data, err := s.CallRaw("Content.testIntegratedAntiSpamEngine", nil)
if err != nil {
return nil, err
}
status := struct {
Result struct {
Status IntegratedAntiSpamStatus `json:"status"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &status)
return &status.Result.Status, err
}
// ContentUpdateAntivirusStatus - Get progress of antivirus updating.
// Return
// status - status of the update process
func (s *ServerConnection) ContentUpdateAntivirusStatus() (*IntegratedAvirUpdateStatus, error) {
data, err := s.CallRaw("Content.updateAntivirusStatus", nil)
if err != nil {
return nil, err
}
status := struct {
Result struct {
Status IntegratedAvirUpdateStatus `json:"status"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &status)
return &status.Result.Status, err
}
// ContentUpdateIntegratedAntivirus - Force update of the integrated antivirus.
func (s *ServerConnection) ContentUpdateIntegratedAntivirus() error {
_, err := s.CallRaw("Content.updateIntegratedAntivirus", nil)
return err
}