33 lines
		
	
	
		
			911 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			911 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package discovery
 | |
| 
 | |
| import (
 | |
| 	"sync"
 | |
| 
 | |
| 	"git.loafle.net/overflow/model/meta"
 | |
| 	"git.loafle.net/overflow/model/util"
 | |
| )
 | |
| 
 | |
| type Zone struct {
 | |
| 	MetaIPType *meta.MetaIPType `json:"metaIPType,omitempty"`
 | |
| 	Network    string           `json:"network,omitempty"`
 | |
| 	Iface      string           `json:"iface,omitempty"`
 | |
| 	Address    string           `json:"address,omitempty"`
 | |
| 	Mac        string           `json:"mac,omitempty"`
 | |
| 
 | |
| 	Meta           map[string]map[string]string `json:"meta,omitempty"`
 | |
| 	DiscoveredBy   []string                     `json:"discoveredBy,omitempty"`
 | |
| 	DiscoveredDate *util.Timestamp              `json:"discoveredDate,omitempty"`
 | |
| 
 | |
| 	mtx sync.RWMutex `json:"-"`
 | |
| }
 | |
| 
 | |
| func NewZone(iface string, mac string, metaIPType *meta.MetaIPType, network string, address string) *Zone {
 | |
| 	return &Zone{
 | |
| 		Iface:      iface,
 | |
| 		Mac:        mac,
 | |
| 		MetaIPType: metaIPType,
 | |
| 		Network:    network,
 | |
| 		Address:    address,
 | |
| 	}
 | |
| }
 |