Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 1.89 KB

README.md

File metadata and controls

72 lines (49 loc) · 1.89 KB

maclookup-go

CircleCI Go Report Card codecov CodeFactor

A Go library for interacting with MACLookup's API v2. This library allows you to:

  • Get full info (MAC prefix, company name, address and country) of a MAC address
  • Get Company name by MAC

Installation

You need a working Go environment.

 go get github.com/logocomune/maclookup-go

##Getting Started

package main

import (
	"log"

	"github.com/logocomune/maclookup-go"
)

func main() {
	client := maclookup.New()
    
	r, err := client.CompanyName("000000")

	if err != nil {
		log.Fatal(err)
	}

	log.Println("MAC found in database:", r.Found)
	log.Println("MAC is private (no company name):", r.IsPrivate)
	log.Println("Company name:", r.Company)
	log.Println("Api response in: ", r.RespTime)
	log.Println("Rate limits - remaining request for current time window:", r.RateLimit.Remaining)
	log.Println("Rate limits - next reset", r.RateLimit.Reset)

}

Use custom timout

    client := maclookup.New()
    client.WithTimeout(10*time.Second) 

API Key

Get an API Key here

    client := maclookup.New()
	client.WithAPIKey("an_api_key")

Example