Skip to content

nomilous/ouroboros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusCoverage Status

ouroboros

Network peer membership discovery and dissemination.

Introduction

Installation

Not yet published to npm, point package.json directly to github repo.

{
  "dependencies": {
    "ouroboros": "nomilous/ouroboros"
  }
}

Usage

const Ouroboros = require('ouroboros');
const ouroboros = new Ouroboros(config);

ouroboros.on('member-join', member => {});
ouroboros.on('member-leave', member => {});

ouroboros.start(joinList, meta, seed)
  .then(...

constructor(config)

config = {
  host: '0.0.0.0'
  port: 65533
  keyFile:
  certFile: 
  secret: 'secret'
}
host and port

optional, default shown above

The listening host and port of this service. The defaults shown above.

keyFile and certFile

optional, no default

If present the service listens with a TLS server. Must point to valid key and cert file. No Default.

secret

optional, default shown above

Set the shared secret that all hosts in the network should know. Use with TLS.

.start(joinList, meta, seed)

returns Promise of connected network membership

joinList

required

Array of addresses of the other network nodes to use in the join attempt.

eg

joinList = ['10.0.0.45:65533', '10.0.0.46:65533', '10.0.0.47:65533']
meta

optional, default {}

Object containing meta information about this member that is shared with all outher members.

seed

optional, default false

If true then if this member's attempt to join the cluster failed, this becomes the first member in a new cluster.

About

Network peer membership discovery and dissemination.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published