initial config/actual types

This commit is contained in:
Callan Bryant 2020-02-20 19:08:07 +00:00
parent 33fbaa930b
commit da7ea0796a
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA

View File

@ -5,10 +5,38 @@ import (
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
// keepalive for everything
const KeepaliveSeconds = 21;
const ExpiryDays = 28;
const DefaultListenPort = 51820;
// see https://github.com/WireGuard/wgctrl-go/blob/master/wgtypes/types.go for definitions
type Peer struct {
Name string
type PeerConfig struct {
// username of person running this host/router
Owner string
// Used to update DNS
Hostname string
// Description of what the host is and/or does
Description string
PublicKey wgtypes.Key
PresharedKey wgtypes.Key
Endpoint *net.UDPAddr
AllowedIPs []net.IPNet
}
type Peer struct {
// username of person running this host/router
Owner string
// Used to update DNS
Hostname string
// Description of what the host is and/or does
Description string
// whether last heartbeat/rxdata was received (50% margin)
Online bool
// if no data for x days, consider revoking access
Expired bool
PublicKey wgtypes.Key
PresharedKey wgtypes.Key
Endpoint *net.UDPAddr
@ -17,3 +45,19 @@ type Peer struct {
TransmitBytes int64
AllowedIPs []net.IPNet
}
type DsnetConfig struct {
PrivateKey *wgtypes.Key
ListenPort *int
FirewallMark *int
Peers []PeerConfig
}
type Dsnet struct {
Name string
Type DeviceType
PrivateKey Key
PublicKey Key
ListenPort int
Peers []Peer
}