model/discovery/Zone.go

33 lines
911 B
Go
Raw Normal View History

2018-08-12 10:46:46 +00:00
package discovery
import (
"sync"
"git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow/model/util"
)
type Zone struct {
2018-09-12 01:55:35 +00:00
MetaIPType *meta.MetaIPType `json:"metaIPType,omitempty"`
2018-09-11 07:11:02 +00:00
Network string `json:"network,omitempty"`
Iface string `json:"iface,omitempty"`
Address string `json:"address,omitempty"`
Mac string `json:"mac,omitempty"`
2018-08-12 10:46:46 +00:00
2018-09-11 07:11:02 +00:00
Meta map[string]map[string]string `json:"meta,omitempty"`
DiscoveredBy []string `json:"discoveredBy,omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
2018-08-12 10:46:46 +00:00
mtx sync.RWMutex `json:"-"`
}
2018-09-12 01:55:35 +00:00
2018-09-12 02:02:42 +00:00
func NewZone(iface string, mac string, metaIPType *meta.MetaIPType, network string, address string) *Zone {
2018-09-12 01:55:35 +00:00
return &Zone{
2018-09-12 02:02:42 +00:00
Iface: iface,
Mac: mac,
2018-09-12 01:55:35 +00:00
MetaIPType: metaIPType,
Network: network,
Address: address,
}
}