npm.io
1.0.0 • Published 11 years ago

ip-hash

Licence
MIT
Version
1.0.0
Deps
1
Vulns
0
Weekly
0
Stars
6

ip-hash Circle CI

Implementation of ip-hash balancing algorithm, based on round-robin.

Installation

$ npm install ip-hash --save

Usage

const iphash = require('ip-hash');

let servers = [
	'server-1',
	'server-2',
	'server-3'
];

let assign = iphash(servers);

assign('192.168.0.1'); // => 'server-1'
assign('192.168.0.2'); // => 'server-2'
assign('192.168.0.3'); // => 'server-3'

assign('192.168.0.1'); // => 'server-1'
Tests

Circle CI

$ make test
License

ip-hash is released under the MIT license.