diff --git a/add.go b/add.go index 81290fd..fcf8cb8 100644 --- a/add.go +++ b/add.go @@ -36,6 +36,7 @@ func Add() { Owner: owner, Hostname: hostname, Description: description, + Added: time.Now(), PublicKey: publicKey, PrivateKey: privateKey, // omitted from server config JSON! PresharedKey: GenerateJSONKey(), diff --git a/configtypes.go b/configtypes.go index 31b8672..e1f16f3 100644 --- a/configtypes.go +++ b/configtypes.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "net" "os" + "time" "github.com/go-playground/validator/v10" "golang.zx2c4.com/wireguard/wgctrl/wgtypes" @@ -20,6 +21,7 @@ type PeerConfig struct { 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` + Added time.Time `validate:"required"` // TODO ExternalIP support (Endpoint) //ExternalIP net.UDPAddr `validate:"required,udp4_addr"` // TODO support routing additional networks (AllowedIPs) diff --git a/reporttypes.go b/reporttypes.go index c0f44ac..ddfd087 100644 --- a/reporttypes.go +++ b/reporttypes.go @@ -107,6 +107,7 @@ func GenerateReport(dev *wgtypes.Device, conf *DsnetConfig, oldReport *DsnetRepo Hostname: peer.Hostname, Owner: peer.Owner, Description: peer.Description, + Added: peer.Added, IP: peer.IP, ExternalIP: externalIP, Status: status, @@ -167,6 +168,8 @@ type PeerReport struct { Owner string // Description of what the host is and/or does Description string + // date peer was added to dsnet config + Added time.Time // Internal VPN IP address. Added to AllowedIPs in server config as a /32 IP net.IP // Last known external IP