arp

package module
v0.0.0-...-0770731 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 3 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-arp

go reference

Parse ARP file from /proc/net/arp

Install

go get -u github.com/ItsJimi/go-arp

Example

GetEntries
package main

import (
  "fmt"
  "github.com/ItsJimi/go-arp"
)

func main() {
  list, err := arp.GetEntries()
  if err != nil {
    fmt.Println(err)
    return
   }

  fmt.Println(list[0].IPAddress)
}
GetEntryFromMAC
package main

import (
  "fmt"
  "github.com/ItsJimi/go-arp"
)

func main() {
  entry, err := arp.GetEntryFromMAC("00:00:00:00:00:00")
  if err != nil {
    fmt.Println(err)
    return
   }

  fmt.Println(entry.IPAddress)
}

Contribute

Feel free to fork and make pull requests

License

MIT

Documentation

Overview

Package arp parse ARP file from /proc/net/arp

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	IPAddress string
	HWType    string
	Flags     string
	HWAddress string
	Mask      string
	Device    string
}

Entry define the list available in /proc/net/arp

func GetEntries

func GetEntries() ([]Entry, error)

GetEntries list ARP entries in /proc/net/arp

func GetEntryFromMAC

func GetEntryFromMAC(mac string) (Entry, error)

GetEntryFromMAC get an entry by searching with MAC address

Jump to

Keyboard shortcuts

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