Coder Social home page Coder Social logo

Range / CIDR conversion utility about cli HOT 14 CLOSED

ipinfo avatar ipinfo commented on July 20, 2024
Range / CIDR conversion utility

from cli.

Comments (14)

UmanShahzad avatar UmanShahzad commented on July 20, 2024 2

Or two tools that do each separately:

  • cidr2range
  • range2cidr

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024 2

For reference, we had a chat and the answer is if we encounter input like:

1.1.1.0,1.1.1.2,other data

we'd output the 2 CIDR result as:

1.1.1.0/31,other data
1.1.1.2/32,other data

i.e. copying the surrounding data per CIDR.

from cli.

coderholic avatar coderholic commented on July 20, 2024 1

Yeah I like 2 tools named cidr2range and range2cidr

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024 1

Great, those names might also be easier to get & discover on distribution repos like homebrew/apt.

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024 1

I'll make PRs for getting these on the official homebrew tap tomorrow my time, yes. No point really adding them to the IPinfo tap at this point since it'll be replaced pretty quickly I reckon, given the good feedback we got from the homebrew guys on the previous stuff.

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024 1

Made PRs for Homebrew:

cidr2range: Homebrew/homebrew-core#78164
range2cidr: Homebrew/homebrew-core#78166

from cli.

yermulnik avatar yermulnik commented on July 20, 2024 1

Awesome 🥳 Thanks a lot!

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024

I think we have almost all the base code needed to do this already so that should be good!

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024

Any idea for the name of a tool like this? This would also be the subcommand.

Some ideas:

  • cidrconvert
  • cidrconv
  • cc

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024

@coderholic A question about ranges that don't combine nicely into a single CIDR:

What to do about a range like 1.1.1.0,1.1.1.2 which really requires 2 CIDRs 1.1.1.0/31 and 1.1.1.2/32? (Obviously the other way around is not a problem.)

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024

Just print both, and if so with a comma delimiter between them? Or skip these cases by default with a flag to force outputting multiple CIDRs if necessary?

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024

This'll be available in the v2 release fairly soon. Just wrapping it up.

from cli.

UmanShahzad avatar UmanShahzad commented on July 20, 2024

When it's released, if there are any other issues let's make new issues for it.

from cli.

yermulnik avatar yermulnik commented on July 20, 2024

Are there Hombrew tap issues to track progress on adding cidr2range and range2cidr? I can't see these in https://github.com/ipinfo/homebrew-tap so assumed you've gone with adding them to Homebrew tap at once.

from cli.

Related Issues (20)

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.