-
-
Notifications
You must be signed in to change notification settings - Fork 274
/
module.go
44 lines (33 loc) · 866 Bytes
/
module.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
package crew
import (
"time"
"github.com/safing/portbase/modules"
"github.com/safing/portmaster/spn/terminal"
)
var module *modules.Module
func init() {
module = modules.Register("crew", nil, start, stop, "terminal", "docks", "navigator", "intel", "cabin")
}
func start() error {
module.NewTask("sticky cleaner", cleanStickyHubs).
Repeat(10 * time.Minute)
return registerMetrics()
}
func stop() error {
clearStickyHubs()
terminal.StopScheduler()
return nil
}
var connectErrors = make(chan *terminal.Error, 10)
func reportConnectError(tErr *terminal.Error) {
select {
case connectErrors <- tErr:
default:
}
}
// ConnectErrors returns errors of connect operations.
// It only has a small and shared buffer and may only be used for indications,
// not for full monitoring.
func ConnectErrors() <-chan *terminal.Error {
return connectErrors
}