Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Get an available TCP or UDP port for the given IP address.
$ npm install pick-port
import { pickPort } from 'pick-port';
Get a random UDP port in IP 0.0.0.0:
const port = await pickPort({ type: 'udp' });
Get a TCP port in a specific IP and port range:
const port = await pickPort({
type: 'tcp',
ip: '192.168.10.111',
minPort: 8000,
maxPort: 9000,
});
Resolves with an available port or rejects with an error otherwise.
Option | Type | Description | Required | Default |
---|---|---|---|---|
type | String | 'udp' or 'tcp'. | Yes | |
ip | String | IPv4 or IPv6 address for which a free port is requested. | No | '0.0.0.0' |
minPort | Number | Minimum port. | No | 10000 |
maxPort | Number | Maximum port. | No | 20000 |
reserveTimeout | Number | Timeout in seconds during which a returned port will be internally reserved and prevented of being returned on a future call before the timeout has elapsed. | No | 5 |
@returns
{Number} A free port.The reserveTimeout
option provides the application with the required time to bind the free port before it is given again on a future call to this library.
FAQs
Get a free TCP or UDP port for the given IP address
The npm package pick-port receives a total of 3,287 weekly downloads. As such, pick-port popularity was classified as popular.
We found that pick-port demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.