
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Turdus is a client side HTTP Round-robin and Weighted round-robin load balancing library.
It provides following features:
For simple Round-robin, it is basically array loop.
For weighted round robin algorithm, on each peer selection we increase current_weight of each eligible peer by its weight, select peer with greatest current_weight and reduce its current_weight by total number of weight points distributed among peers.
see also: nginx implementation
[Deprecated] For weighted round robin algorithm (gcd version):
install turdus by npm.
npm install turdus
Provide or fetch your callee apps' IP/domain from written configs
or subscribe event by eureka client and fetchRegistry from Eureka
const Turdus = require('turdus');
// initialize multiple app
const trudus = Turdus({
bird: ['127.0.0.1', '127.0.0.2', '127.0.0.3'],
kitten: ['192.168.0.1', '192.168.0.2', '192.168.0.3'],
});
async function touchServer() {
await turdus.request('bird', {
method: 'GET',
uri: '/cat-books',
});
}
touchServer();
touchServer();
touchServer();
// ...
// will touch known resources one by one.
//
// curl http://127.0.0.1/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.3/cat-books
// curl http://127.0.0.1/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.3/cat-books
// ...
const Turdus = require('turdus');
const turdus = Turdus({ bird: [
{ server: '127.0.0.1', weight: 5 },
{ server: '127.0.0.2', weight: 10 },
{ server: '127.0.0.3', weight: 4 },
]});
async function touchServer() {
await turdus.request('bird', {
method: 'GET',
uri: '/cat-books',
});
}
touchServer();
touchServer();
touchServer();
// ...
// will touch known resources by their weight.
//
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.1/cat-books
// curl http://127.0.0.3/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.1/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.3/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.1/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.3/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.1/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.2/cat-books
// curl http://127.0.0.3/cat-books
// curl http://127.0.0.1/cat-books
// curl http://127.0.0.2/cat-books
// ...
const turdus = Turdus({ bird: [ '127.0.0.1', '127.0.0.2' ] });
turdus.fakePositiveRes('bird', {
'/cat-birds': 'though some error appeared',
'/cat-books': [ 'The Fountainhead', 'Poor Charlie's Almanack:The Wit and Wisdom of Charles T. Munger', 'The Little Prince' ],
});
turdus.request('bird', {
uri: '/cat-birds',
method: 'POST',
body: { yy: 6 },
json: true,
})
.then((result) => {
// though enpoints is not touchable
// we can get positive response due to preset method.
// result.statusCode: 200
// result.body: 'though some error appeared',
});
const endpoints = {
kitten: [
{ server: '127.0.0.1', weight: 0 },
{ server: '127.0.0.2', weight: 0 },
],
doggy: [
{ server: '192.168.0.1', weight: 0 },
{ server: '192.168.0.2', weight: 0 },
],
};
const turdus = Turdus(endpoints);
turdus.upsertEndpoints({
doggy: [
{ server: '192.168.0.1', weight: 3 },
{ server: '192.168.0.2', weight: 3 },
{ server: '192.168.0.3', weight: 1 },
{ server: '192.168.0.4', weight: 1 },
],
});
// the doggy application's endpoints will be changed.
// also it's balance type got changed from raw to weighted.
NOTE: this function may reset related applications' current polling order to original status.
MIT
FAQs
weighted round robin client-side HTTP load balancing
The npm package turdus receives a total of 3 weekly downloads. As such, turdus popularity was classified as not popular.
We found that turdus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.