-
Notifications
You must be signed in to change notification settings - Fork 0
/
daemon.go
51 lines (39 loc) · 1.01 KB
/
daemon.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
package main
import (
"time"
"github.com/go-compile/localrelay"
"github.com/pkg/errors"
)
var (
// ErrIPCShutdownFail is returned when the daemon fails to shutdown when being
// requested via IPC
ErrIPCShutdownFail = errors.New("failed to shutdown daemon process via IPC")
// ErrIPCForkFail is returned when trying to re-fork the daemon process
ErrIPCForkFail = errors.New("ipc fork failed")
ipcTimeout = time.Second
// daemonStarted stores the time when the daemon was created
daemonStarted time.Time
)
type status struct {
Relays []localrelay.Relay
Pid int
Version string
// Metrics contains relay name as the index
Metrics map[string]metrics
// Started is a unix timestamp of when the daemon was created
Started int64
}
type metrics struct {
In, Out, Active, DialAvg int
TotalConns, TotalRequests uint64
}
type connection struct {
LocalAddr string
RemoteAddr string
Network string
RelayName string
RelayHost string
ForwardedAddr string
// Opened is a unix timestamp
Opened int64
}