initial config/actual types
This commit is contained in:
parent
33fbaa930b
commit
da7ea0796a
48
types.go
48
types.go
@ -5,10 +5,38 @@ import (
|
|||||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
"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
|
// see https://github.com/WireGuard/wgctrl-go/blob/master/wgtypes/types.go for definitions
|
||||||
type Peer struct {
|
type PeerConfig struct {
|
||||||
Name string
|
// 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
|
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
|
PublicKey wgtypes.Key
|
||||||
PresharedKey wgtypes.Key
|
PresharedKey wgtypes.Key
|
||||||
Endpoint *net.UDPAddr
|
Endpoint *net.UDPAddr
|
||||||
@ -17,3 +45,19 @@ type Peer struct {
|
|||||||
TransmitBytes int64
|
TransmitBytes int64
|
||||||
AllowedIPs []net.IPNet
|
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
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user