Giter Site home page Giter Site logo

wsoui's Introduction

wsoui: The OUI database for Go Build Status

English version

説明

wsoui はMACアドレスからベンダー名を検索するGo製のライブラリです。

MACアドレスの先頭三桁はOUI (Organizationally Unique Identifier) と呼ばれ、IEEEがベンダーに切り売りしています。逆に言うと、MACアドレスの先頭三桁を見ればどこのベンダーが作ったNICか(もしくはBlueToothデバイスか)を知ることができます。

本ライブラリではOUIのデータをGoのmapとして持ち、検索用の関数から利用しています。

OUIの元データとしては、WireSharkが加工して配布しているWireshark manufacturer databaseを利用しています。

特徴

  • 省バイナリサイズ・省メモリ
    • 本ライブラリは低スペックマシンでも動作するよう実装されています。実際、私はこのライブラリを使ったプログラムを64MBメモリ・32MBストレージのLinuxマシン上で動かしています。
  • 最新のOUIデータが反映されている
    • 元データからの反映はTravis CIで週に1回自動的に行われるので、常に最新のOUIデータが利用できます。

利用方法

func LookUp(mac string) (string, error)

この関数は引数としてMACアドレス mac を取り、対応するベンダー名の略称("Cisco" のような表記、最大8文字)を返します。

mac は先頭3オクテット分のみを利用しますので、文字列全体がMACアドレスのフォーマットに従っている必要はありません。オクテットの区切り文字は - または : である必要があります。もしくは区切り文字無しでも構いません。

与えられた mac に対応するベンダー名が見つからなかった場合は空文字列と非nil値のerrorを返します。

サンプル

package main

import (
	"fmt"
	"github.com/hnw/wsoui"
)

func main() {
	abbr, _ := wsoui.LookUp("cc-20-e8")
	fmt.Print(abbr) // Apple
}

ライセンス

ouidata.go のみGPLとします。元ファイルのWireshark manufacturer databaseがGPLに従うと考えられるためです。

ouidata.go以外のファイルはMITとします。

したがって、本ライブラリをリンクした実行バイナリはGPLに従います。

wsoui's People

Contributors

hnw avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.