1.0.1 • Published 1 year ago
connectivity-check v1.0.1
connectivity-check
Check if the internet connection is online, with proxy support
npm i connectivity-checkUsage
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_FAILEDGeneric errorCONNECTIVITY_CHECK_OFFLINENo network connectionCONNECTIVITY_CHECK_TIMEOUTRequest timed outCONNECTIVITY_CHECK_PAYMENT_REQUIREDProxy service demands paymentCONNECTIVITY_CHECK_AUTH_REQUIREDInvalid credentials
License
MIT