/
types.go
42 lines (36 loc) · 924 Bytes
/
types.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
package guard
import (
"net"
"sync"
"time"
"github.com/gomodule/redigo/redis"
"golang.zx2c4.com/wireguard/wgctrl"
"github.com/bob620/bakaguard/config"
)
type Guard struct {
config config.Config
wg *wgctrl.Client
redisConn redis.Conn
redisRead sync.Mutex
redisWrite sync.Mutex
}
type RedisPeer struct {
Uuid string
Group string
Name string
Description string
PublicKey string
Storage map[string]string
}
type Peer struct {
Uuid string `json:"uuid"`
Group string `json:"group"`
Name string `json:"name"`
Description string `json:"description"`
PublicKey string
AllowedIPs []net.IPNet `json:"allowedIPs"`
KeepAlive time.Duration `json:"keepAlive"`
LastHandshake time.Time `json:"lastSeen"`
LastEndpoint string `json:"lastExternalIp"`
Storage map[string]string `json:"storage"`
}