MCPcopy
hub / github.com/bettercap/bettercap / AddIfNew

Method AddIfNew

modules/net_recon/net_recon_test.go:45–58  ·  view source on GitHub ↗
(ip, mac string)

Source from the content-addressed store, hash-verified

43}
44
45func (m *MockLAN) AddIfNew(ip, mac string) {
46 m.Lock()
47 defer m.Unlock()
48
49 if _, exists := m.hosts[mac]; !exists {
50 m.hosts[mac] = &network.Endpoint{
51 IpAddress: ip,
52 HwAddress: mac,
53 FirstSeen: time.Now(),
54 LastSeen: time.Now(),
55 }
56 m.addedHosts = append(m.addedHosts, mac)
57 }
58}
59
60func (m *MockLAN) Remove(ip, mac string) {
61 m.Lock()

Callers 15

runDiffMethod · 0.45
TestRunDiffFunction · 0.45
TestDoSelectionFunction · 0.45
TestHandlersFunction · 0.45
BenchmarkRunDiffFunction · 0.45
ParseMethod · 0.45
ParseMethod · 0.45
setupMockSessionFunction · 0.45
TestArpSpooferConfigureFunction · 0.45
TestArpSpooferStartStopFunction · 0.45
TestArpSpooferBanModeFunction · 0.45
TestArpSpooferFullDuplexFunction · 0.45

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected