scanner

package
v0.0.0-...-b371c3e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Up   = DeviceStatus("up")
	Down = DeviceStatus("down")
)
View Source
const (
	ClientName = "ground-control"
	Version    = "2"
)
View Source
const DefaultVendor = "Unknown"
View Source
const VendorNameEndPoint = "https://macvendors.co/api/vendorname/%s"

Variables

This section is empty.

Functions

func ArpScan

func ArpScan(iface *net.Interface, interval time.Duration, vendor *VendorFinder, result chan<- Device, ctx context.Context) error

ArpScan scans an individual interface's local network for machines using ARP requests/replies. scan loops forever, sending packets out regularly.

func GetAllIpAddressesWithinNet

func GetAllIpAddressesWithinNet(ipNetwork *net.IPNet) []net.IP

GetAllIpAddressesWithinNet computes all IPv4 addresses contained in net.IPNet

Types

type ArpScanService

type ArpScanService struct {
	// contains filtered or unexported fields
}

func NewArpScanService

func NewArpScanService(devices DeviceMap, lenience time.Duration, interval time.Duration) *ArpScanService

func (*ArpScanService) Name

func (s *ArpScanService) Name() string

func (*ArpScanService) Run

func (s *ArpScanService) Run(ctx context.Context) error

type Device

type Device struct {
	Ip       string
	Mac      string
	Vendor   string
	LastSeen time.Time
	Status   DeviceStatus
}

type DeviceMap

type DeviceMap map[string]Device

func NewDeviceMap

func NewDeviceMap() DeviceMap

func (DeviceMap) AddDevices

func (dm DeviceMap) AddDevices(newDevice <-chan Device, ctx context.Context)

func (DeviceMap) AsList

func (dm DeviceMap) AsList() []Device

func (DeviceMap) SetDownAfter

func (dm DeviceMap) SetDownAfter(leniency time.Duration, ctx context.Context)

type DeviceStatus

type DeviceStatus string

type SpeedTestResult

type SpeedTestResult struct {
	Download float64
	Upload   float64
	Latency  float64
}

func SpeedTest

func SpeedTest(ctx context.Context, client *ndt7.Client) (SpeedTestResult, error)

SpeedTest perform speed-test

type SpeedTestService

type SpeedTestService struct {
	// contains filtered or unexported fields
}

func NewSpeedTestService

func NewSpeedTestService(interval time.Duration) *SpeedTestService

func (*SpeedTestService) Name

func (s *SpeedTestService) Name() string

func (*SpeedTestService) Run

func (s *SpeedTestService) Run(ctx context.Context) error

type VendorFinder

type VendorFinder struct {
	// contains filtered or unexported fields
}

func NewVendorFinder

func NewVendorFinder() *VendorFinder

func (*VendorFinder) Find

func (f *VendorFinder) Find(hwAddress string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL