ip-monitor
A node.js library to monitor your external ip for changes
Installation
npm install ip-monitor
Usage
basic
const IpMonitor = ;const ipMonitor = ; ipMonitor; ipMonitor; ipMonitorstart;
with custom configuration
const IpMonitor = ;const ipMonitor = pollingInterval: 36000 verbose: true externalIp: timeout: 1000 getIP: 'parallel' services: 'http://ifconfig.co/x-real-ip' 'http://icanhazip.com/' replace: true verbose: true ; ipMonitor; ipMonitor; ipMonitorstart;
Configuration
new IpMonitor([config])
accepts a configuration object with the following optional properties:
pollingInterval: <Integer>
: how often to poll for ip changes, default 1 dayexternalIp: <Object>
: configuration passed directly toexternal-ip
Methods
.start()
: start watching.stop()
: stop watching.poll()
: poll for ip manually
Events
change
: fired when the external ip has changed. it will also fire the first time.start()
or.poll()
are invoked.error
: typical error handling here
Test
Change your working directory to the project's root, npm install
to get the development dependencies and then npm test