Skip to content

holesail/holesail-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

holesail-server

Join our Discord Support Server

Create and announce your server on the HyperDHT P2P protocol.

Installation

npm i holesail-server 

Usage

Require as a module

const HolesailServer = require('holesail-server')

Create instance of the holesailServer class

const server =  new HolesailServer();

Start server and get the public key

server.serve({port:5000, address:"127.0.0.1"}, () => {
    console.log('Server started');
    console.log(server.getPublicKey());
    setTimeout(() => {
      server1.destroy();
      console.log('Server destroyed');
  }, 6000);
})

Optionally you can also set a buffSeed to generate the same connection key every time

server.serve({port:5000, address:"127.0.0.1",buffSeed:"4917816487c1822049939ff1abbf515663275105d01361bbc84fe2000e594539"}, () => {
    console.log('Server started');
    console.log(server.getPublicKey());
    setTimeout(() => {
      server1.destroy();
      console.log('Server destroyed');
  }, 6000);
})
//buffSeed needs to be of 64 char long

Destroy the DHT server

server.destroy();

Syntax:

server.serve(options,callback())

Options:

  • port: The port to listen on (required)
  • address: The local address, use 0.0.0.0 if you want to listen on all (required)
  • buffSeed: A 64 character long string, will be used as a buffer of the connector. Pass it if you want to use same connector everytime (Optional)

About

Server module for holesail to create and announce local server on the DHT

Resources

Stars

Watchers

Forks

Packages

No packages published