Documentation
¶
Overview ¶
Package core provides core networking information retrieval functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARPEntry ¶
type ARPEntry struct {
IPAddress string `json:"ipAddress"`
MACAddress string `json:"macAddress"`
Device string `json:"device"`
State string `json:"state"`
}
ARPEntry represents a single entry in the ARP table (IP to MAC mapping)
func GetARPTable ¶
GetARPTable retrieves the current ARP table using the modern 'ip neigh show' command instead of the legacy 'arp -a' command
type Connection ¶
type Connection struct {
Status string `json:"status"` // "connected", "disconnected", "limited"
Uptime int64 `json:"uptime"` // in seconds
LatencyMS float64 `json:"latencyMs"`
PacketLoss float64 `json:"packetLoss"` // percentage
SignalStrength int `json:"signalStrength,omitempty"` // for wireless, in dBm
}
Connection represents connection status and metrics
type DHCPInfo ¶
type DHCPInfo struct {
Enabled bool `json:"enabled"`
LeaseObtained time.Time `json:"leaseObtained,omitempty"`
LeaseExpires time.Time `json:"leaseExpires,omitempty"`
DHCPServer string `json:"dhcpServer,omitempty"`
}
DHCPInfo represents DHCP configuration
type EthernetInfo ¶
type EthernetInfo struct {
InterfaceName string `json:"interfaceName"`
MACAddress string `json:"macAddress"`
Speed string `json:"speed"`
Duplex string `json:"duplex"`
}
EthernetInfo represents ethernet connection details
type NetworkInfo ¶
type NetworkInfo struct {
IPv4Address string `json:"ipv4Address"`
IPv6Address string `json:"ipv6Address"`
SubnetMask string `json:"subnetMask"`
Gateway string `json:"gateway"`
SSID string `json:"ssid,omitempty"`
EthernetInfo EthernetInfo `json:"ethernetInfo,omitempty"`
DNSServers []string `json:"dnsServers"`
DHCPInfo DHCPInfo `json:"dhcpInfo"`
VLANInfo VLANInfo `json:"vlanInfo,omitempty"`
Connection Connection `json:"connection"`
Traffic Traffic `json:"traffic"`
ARPEntries []ARPEntry `json:"arpEntries"`
ServiceLatency ServiceLatency `json:"serviceLatency"`
Timestamp time.Time `json:"timestamp"`
}
NetworkInfo represents the network information for the device
func GetNetworkInfo ¶
func GetNetworkInfo() (*NetworkInfo, error)
GetNetworkInfo retrieves the current network information
type ServiceLatency ¶
type ServiceLatency struct {
Google float64 `json:"google"` // Google latency in ms
Amazon float64 `json:"amazon"` // Amazon latency in ms
Cloudflare float64 `json:"cloudflare"` // Cloudflare latency in ms
Microsoft float64 `json:"microsoft"` // Microsoft latency in ms
DNS float64 `json:"dns"` // DNS latency in ms
HTTP float64 `json:"http"` // HTTP latency in ms
}
ServiceLatency represents latency measurements to various major services
type Traffic ¶
type Traffic struct {
BytesReceived int64 `json:"bytesReceived"`
BytesSent int64 `json:"bytesSent"`
PacketsReceived int64 `json:"packetsReceived"`
PacketsSent int64 `json:"packetsSent"`
CurrentBandwidth float64 `json:"currentBandwidth"` // in Mbps
}
Traffic represents network traffic statistics