Code Monkey home page Code Monkey logo

netdb's Introduction

badge-free profile

Go leak plumber. Namespace & incontinentainer explorer.

netdb's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

sapslaj

netdb's Issues

Feature Request: Add support for /etc/ethertypes

I'm working on replacing an ad-hoc implementation of protocol and service lookups in one of my projects, a NetFlow collection and metadata enrichment agent with this library. It was pretty simple to slot this library in place for protocols and services, but my project also supports adding some metadata about the Ethernet protocol type of the flow. Adding support for /etc/ethertypes to this project would be really helpful and I'd be able to get rid of the hard-coded mappings.

Some ideas for the API:

func main() {
	ipv4 := netdb.EtherTypeByNumber(0x0800)
	fmt.Println(ipv4.Name)
	// Output: IPv4
	fmt.Println(ipv4.Number)
	// Output: 2048
	fmt.Println(ipv4.Aliases)
	// Output: [ip ipv4]
	fmt.Println(ipv4.Comment)
	// Output: Internet IP (IPv4)
}
func main() {
	dot1q := netdb.EtherTypeByName("dot1q")
	fmt.Println(dot1q.Name)
	// Output: 802_1q
	fmt.Println(dot1q.Number)
	// Output: 33024
	fmt.Println(dot1q.Aliases)
	// Output: [8021q 1q 802.1q dot1q]
	fmt.Println(dot1q.Comment)
	// Output: 802.1Q Virtual LAN tagged frame
}

Not totally sure if the comment parsing is really necessary, but it does contain some useful info sometimes.

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.