thediveo / netdb Goto Github PK
View Code? Open in Web Editor NEWProtocol, service, and ethertype netdb data for pure Go.
License: Apache License 2.0
Protocol, service, and ethertype netdb data for pure Go.
License: Apache License 2.0
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.