sindresorhus / public-ip

Get your public IP address - very fast!
MIT License
1.02k stars 65 forks source link

Use named exports and allow getting either IPv4 or IPv6 #63

Closed Richienb closed 2 years ago

Richienb commented 2 years ago
import publicIp, {publicIpv4, publicIpv6} from 'public-ip';

console.log(await publicIpv4());
//=> '46.5.21.123'

console.log(await publicIpv6());
//=> 'fe80::200:f8ff:fe21:67cf'

console.log(await publicIp()); // Falls back to IPv4
//=> 'fe80::200:f8ff:fe21:67cf'

Fixes #45, Fixes #59

Richienb commented 2 years ago

@sindresorhus