1.0.0 • Published 9 years ago

ip-hash v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

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.