arp

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

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 3 Imported by: 0

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