TritonDataCenter / node-macaddr

Library for MAC address parsing and manipulation
3 stars 4 forks source link

Refactor to use ArrayBuffer and Buffer View #3

Open cableray opened 3 years ago

cableray commented 3 years ago

This looks like this hasn't been touched in a while, and as I'm using it for a couple networking projects, I was hoping to make some improvements. I'd love to contribute them to this project, instead of forking in a completely different direction.

One improvement I was considering was adapting the class to be compatible with (and based on) an array buffer data view, with a similar interface and access. A lot of the work I'm doing with MAC addresses is manipulating network packets, so a data view is natural choice. Not sure it would be needed much, but it would also easily allow setting fields directly, and would simplify some existing implementation, such as access to the fields in the toString method.

The main drawback is that this would limit compatibility, as the current version is very basic with it's feature requirements. Transpiling could help somewhat, but some features require language or library level support.

It might be tricky to implement some features, and may require a proxy for things like index access, but it seems doable. I'd love to contribute here, and I'll add some PR's if this isn't too major a change for this project. It would be a major version change for sure.

bahamat commented 3 years ago

We consider this library to be stable, and rock solid for us. The primary stipulation with accepting any changes is that things don't break for our use case. If there's a way to do it without a major version bump that would be better for us.

cableray commented 3 years ago

What are your node version requirements then? That might help.

bahamat commented 3 years ago

Currently node 6.17.0.

You can find all the places we use it here: https://hound.joyent.us/?q=%22macaddr%22%3A%20%22&i=nope&files=package.json&repos=

Within each repo, you can check the Makefile for NODE_PREBUILT_VERSION.