This commit is contained in:
crusader
2017-11-22 14:55:40 +09:00
parent 3f730e1fe4
commit 2e81139374
35 changed files with 117 additions and 1567 deletions

View File

@@ -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"`

View File

@@ -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]
}