update report types with config changes

This commit is contained in:
Callan Bryant 2020-03-03 21:06:36 +00:00
parent c2aac62f27
commit ca310b18ec
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA

View File

@ -3,36 +3,43 @@ package dsnet
import ( import (
"net" "net"
"time" "time"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
) )
type DsnetReport struct { type DsnetReport struct {
Name string // domain to append to hostnames. Relies on separate DNS server for
PrivateKey wgtypes.Key // resolution. Informational only.
PublicKey wgtypes.Key ExternalIP net.IP `validate:"required,cidr"`
ListenPort int ListenPort int `validate:"gte=1024,lte=65535"`
Peers []PeerReport Domain string `validate:"required,gte=1,lte=255"`
// IP network from which to allocate automatic sequential addresses
// Network is chosen randomly when not specified
Network JSONIPNet `validate:"required"`
IP net.IP `validate:"required,cidr"`
DNS net.IP `validate:"required,cidr"`
Peers []PeerReport
} }
type PeerReport struct { type PeerReport struct {
// username of person running this host/router
Owner string
// Used to update DNS // Used to update DNS
Hostname string Hostname string `validate:"required,gte=1,lte=255"`
// username of person running this host/router
Owner string `validate:"required,gte=1,lte=255"`
// Description of what the host is and/or does // Description of what the host is and/or does
Description string Description string `validate:"required,gte=1,lte=255"`
// Internal VPN IP address. Added to AllowedIPs in server config as a /32
IP net.IP `validate:"required,ip`
PublicKey JSONKey `validate:"required,len=44"`
PrivateKey JSONKey `json:"-"` // omitted from config!
PresharedKey JSONKey `validate:"required,len=44"`
// whether last heartbeat/rxdata was received (50% margin) // whether last heartbeat/rxdata was received (50% margin)
Online bool Online bool
// if no data for x days, consider revoking access // if no data for x days, consider revoking access
Expired bool Expired bool
// TODO ExternalIP support (Endpoint)
PublicKey wgtypes.Key //ExternalIP net.UDPAddr `validate:"required,udp4_addr"`
PresharedKey wgtypes.Key // TODO support routing additional networks (AllowedIPs)
// TODO peer endpoint support Networks []JSONIPNet `validate:"dive,cidr"`
//Endpoint *net.UDPAddr
LastHandshakeTime time.Time LastHandshakeTime time.Time
ReceiveBytes int64 ReceiveBytes int64
TransmitBytes int64 TransmitBytes int64
AllowedIPs []net.IPNet
} }