Skip to content

logocomune/maclookup-go

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

A Go library for interacting with MACLookup's API v2

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages