ing
This commit is contained in:
@@ -10,10 +10,15 @@ type DiscoveryHost struct {
|
||||
FirstScanRange string `json:"firstScanRange"`
|
||||
LastScanRange string `json:"lastScanRange"`
|
||||
ExcludeHosts []string `json:"excludeHosts"`
|
||||
IncludeHosts []string `json:"includeHosts"`
|
||||
|
||||
DiscoveryPort *DiscoveryPort `json:"discoveryPort"`
|
||||
}
|
||||
|
||||
func (dh *DiscoveryHost) Contains(ip string) bool {
|
||||
|
||||
}
|
||||
|
||||
type DiscoveryPort struct {
|
||||
FirstScanRange int `json:"firstScanRange"`
|
||||
LastScanRange int `json:"lastScanRange"`
|
||||
|
||||
@@ -1,9 +1,33 @@
|
||||
package model
|
||||
|
||||
import "sync"
|
||||
|
||||
type Zone struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Network string `json:"network"`
|
||||
IP string `json:"ip"`
|
||||
Iface string `json:"iface"`
|
||||
Mac string `json:"mac"`
|
||||
|
||||
hosts map[string]*Host
|
||||
mtx sync.RWMutex
|
||||
}
|
||||
|
||||
func (z *Zone) AddHost(h *Host) {
|
||||
z.mtx.Lock()
|
||||
defer z.mtx.Unlock()
|
||||
if nil == z.hosts {
|
||||
z.hosts = make(map[string]*Host)
|
||||
}
|
||||
z.hosts[h.IP] = h
|
||||
}
|
||||
|
||||
func (z *Zone) GetHost(ip string) *Host {
|
||||
z.mtx.RLock()
|
||||
defer z.mtx.RUnlock()
|
||||
|
||||
if nil == z.hosts {
|
||||
return nil
|
||||
}
|
||||
return z.hosts[ip]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user