connectivity-check
v1.0.1
Published
Check if the internet connection is online, with proxy support
Downloads
17
Readme
connectivity-check
Check if the internet connection is online, with proxy support
npm i connectivity-check
Usage
const connectivityCheck = require('connectivity-check')
const address = await connectivityCheck()
const proxyAddress = await connectivityCheck({ proxy: 'http://...' })
API
const address = await connectivityCheck([options])
Returns its public IP address.
Available options:
{
target: 'https://checkip.amazonaws.com',
agent: null, // Agent option has priority over proxy
proxy: null // Upstream URL
}
List of error codes:
CONNECTIVITY_CHECK_FAILED
Generic errorCONNECTIVITY_CHECK_OFFLINE
No network connectionCONNECTIVITY_CHECK_TIMEOUT
Request timed outCONNECTIVITY_CHECK_PAYMENT_REQUIRED
Proxy service demands paymentCONNECTIVITY_CHECK_AUTH_REQUIRED
Invalid credentials
License
MIT