new: added new Meta field to Endpoint objects (closes #66)

This commit is contained in:
evilsocket 2018-02-22 18:41:04 +01:00
commit 02d414107e
3 changed files with 48 additions and 3 deletions

View file

@ -28,6 +28,7 @@ type Endpoint struct {
ResolvedCallback OnHostResolvedCallback `json:"-"`
FirstSeen time.Time `json:"first_seen"`
LastSeen time.Time `json:"last_seen"`
Meta *Meta `json:"meta"`
}
func ip2int(ip net.IP) uint32 {
@ -56,6 +57,7 @@ func NewEndpointNoResolve(ip, mac, name string, bits uint32) *Endpoint {
ResolvedCallback: nil,
FirstSeen: now,
LastSeen: now,
Meta: NewMeta(),
}
_, netw, _ := net.ParseCIDR(e.CIDR())
@ -66,7 +68,6 @@ func NewEndpointNoResolve(ip, mac, name string, bits uint32) *Endpoint {
func NewEndpoint(ip, mac string) *Endpoint {
e := NewEndpointNoResolve(ip, mac, "", 0)
// start resolver goroutine
go func() {
if names, err := net.LookupAddr(e.IpAddress); err == nil && len(names) > 0 {