Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
public-ip
Advanced tools
Readme
Get your public IP address - very fast!
In Node.js, it queries the DNS records of OpenDNS, Google DNS, and HTTPS services to determine your IP address. In browsers, it uses the excellent icanhaz and ipify services through HTTPS.
npm install public-ip
import {publicIp, publicIpv4, publicIpv6} from 'public-ip';
console.log(await publicIp()); // Falls back to IPv4
//=> 'fe80::200:f8ff:fe21:67cf'
console.log(await publicIpv6());
//=> 'fe80::200:f8ff:fe21:67cf'
console.log(await publicIpv4());
//=> '46.5.21.123'
Returns a Promise<string>
with your public IPv4 or IPv6 address. Rejects on error or timeout.
A .cancel()
method is available on the promise, which can be used to cancel the request.
Returns a Promise<string>
with your public IPv6 address. Rejects on error or timeout.
A .cancel()
method is available on the promise, which can be used to cancel the request.
Returns a Promise<string>
with your public IPv4 address. Rejects on error or timeout.
A .cancel()
method is available on the promise, which can be used to cancel the request.
Type: object
Type: boolean
Default: false
Use a HTTPS check using the icanhazip.com service instead of the DNS query. ipify.org is used as a fallback if icanhazip.com
fails. This check is much more secure and tamper-proof, but also a lot slower. This option is only available in the Node.js version. The default behaviour is to check against DNS before using HTTPS fallback. If set to true
, it will only check against HTTPS.
Type: string[]
Default: []
Add your own custom HTTPS endpoints to get the public IP from. They will only be used if everything else fails. Any service used as fallback must return the IP as a plain string.
import {publicIpv6} from 'public-ip';
await publicIpv6({
fallbackUrls: [
'https://ifconfig.co/ip'
]
});
Type: number
Default: 5000
The time in milliseconds until a request is considered timed out.
Error thrown when the public IP address could not be found.
Error thrown when the operation was canceled.
FAQs
Get your public IP address — very fast!
The npm package public-ip receives a total of 126,898 weekly downloads. As such, public-ip popularity was classified as popular.
We found that public-ip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.