Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brh55/min-host-bits
:low_brightness: Calculate minimum host bits needed for desired number of hosts
https://github.com/brh55/min-host-bits
ipv4 networking subnet
Last synced: 30 days ago
JSON representation
:low_brightness: Calculate minimum host bits needed for desired number of hosts
- Host: GitHub
- URL: https://github.com/brh55/min-host-bits
- Owner: brh55
- Created: 2017-01-23T23:24:31.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-02T00:01:17.000Z (almost 8 years ago)
- Last Synced: 2024-09-14T09:25:36.228Z (about 2 months ago)
- Topics: ipv4, networking, subnet
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# min-host-bits [![Travis](https://img.shields.io/travis/brh55/min-host-bits.svg?style=flat-square)](https://travis-ci.org/brh55/min-host-bits) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square)](https://github.com/sindresorhus/xo)
> Calculate minimum host bits needed for desired number of hosts with account for network address and broadcast address
>
> **minHostBits(256)** // 9## Install
`$ npm install --save min-host-bits` **OR** `$ yarn add min-host-bits`
## Usage
```javascript
var desiredHosts = 3000;
var minimumHostBits = minHostBits(desiredHosts);
console.log(minimumHostBits) // 12
```## API
### minHostBits(n)
Returns the minimum number of host bits accounting for the network address and broadcast address#### n
*n* number of desired hosts## Related
[min-prefix-length](https://github.com/brh55/min-prefix-length) - :1234: Calculate the minimum prefix length for an IPv4 subnet based on a desired number of host[ip-class](https://github.com/brh55/ip-class) - :capital_abcd: Return the classful network class (A, B, C, D, E) of an IPv4 address
## License
MIT