New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

holesail

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

holesail - npm Package Compare versions

Comparing version 1.4.13 to 1.5.0

5

CHANGELOG.txt

@@ -0,1 +1,6 @@

v1.5.0
-- Optimise code
-- Write better help command
-- UI improvements
-- Add warning messages for connector/keys
v1.4.10

@@ -2,0 +7,0 @@ -- Start maintaining changelog

60

includes/help.js
module.exports = {
helpMessage: 'Usage: The command below will expose your local port to the network\nholesail --live port [--host host] [--connector connector]\nCommand to connect to a holesail-server:\nholesail --connect <seed> --port <portno> [--host host]\nAdditional options:\n--help: displays this help message\n--live: starts the server to expose local port to the network\n--connect: connects to a holesail-server with the provided seed\n--port: specifies the port number for the server or client connection (default is 8989)\n--host: specifies the host address for the server or client connection (default is "127.0.0.1")\n--connector: provides the connector for the server or client connection (default is null or automatically generated)\n',
helpMessage: `
Holesail Help
Description:
Holesail is a tool that allows you to expose your local server over P2P network or connect to a Holesail server.
Usage:
- Start a Holesail server:
holesail --live <port> [--host <host>] [--connector <connector>]
- Connect to a Holesail server:
holesail --connect <key|connector> [--port <port>] [--host <host>]
Options:
- --help
Displays this help message and exits.
- --version
Displays the version of the Holesail package and exits.
- --live <port>
Starts a Holesail server on the specified <port>.
- --connect <key|connector>
Connects to a Holesail server using the specified <key> or <connector>.
- --port <port>
Specifies the port number for the server or client connection.
Default: 8989.
- --host <host>
Specifies the host address for the server or client connection.
Default: 127.0.0.1.
- --connector <connector>
Provides a custom connector for the server or client connection.
If the connector length is 64, it is treated as a key. Otherwise, a key is created from the connector.
Examples:
- Start a Holesail server on port 3000 with default host and no connector:
holesail --live 3000
- Start a Holesail server on port 3000 with a custom host and connector:
holesail --live 3000 --host 192.168.1.1 --connector myCustomConnector
- Connect to a Holesail server with a specified key and default port:
holesail 651daf65e3892d9ca8caa3237194612f460843f522e9b505975e9c840d2158a2
- Connect to a Holesail server with a specified connector and custom port:
holesail myCustomConnector --port 8080
Notes:
- Treat connectors like SSH keys. Do not share them with anyone you do not trust.
- Public keys should be treated like domain names on public servers. If there is any private information, it is your responsibility to protect it using passwords or connectors.
`,
printHelp: function(helpMessage) {

@@ -5,0 +63,0 @@ console.log(helpMessage);

154

index.js

@@ -6,11 +6,11 @@ #!/usr/bin/env node

const HyperDHT = require('hyperdht')
const argv = require('minimist')(process.argv.slice(2)) //required to parse cli arguments
const b4a = require('b4a')
const {createHash} = require('node:crypto'); //for connectors
const pkg = require('./package.json'); //holds info about current package
const {
createHash
} = require('node:crypto'); //for connectors
const boxConsole = require('cli-box');
var colors = require('colors/safe');
//version info
const version = "1.4.13";

@@ -21,3 +21,2 @@ //splitting into files

//setting up the command hierarchy
//display help and exit

@@ -31,3 +30,3 @@ if (argv.help) {

if (argv.version) {
console.log(version);
console.log(pkg.version);
process.exit(-1);

@@ -63,21 +62,56 @@ }

if (isConnectorSet) {
console.log(`Your connector is: ${argv.connector}`);
var box = boxConsole("100x10", {
text: colors.cyan.underline.bold("Holesail Server Started") + " ⛵️" + "\n" +
colors.magenta("Connection Mode: ") + colors.cyan("Super Secret connector") + "\n" +
colors.magenta(`Holesail is now listening on `) + `${host}:` + argv.live + "\n" +
"Connect with connector: " + colors.white(`${argv.connector}`) + "\n" +
colors.gray(`Public key is: ${localServer.getPublicKey()}`) + "\n" +
colors.gray(` NOTE: TREAT CONNECTORS HOW YOU WOULD TREAT SSH KEY, DO NOT SHARE IT WITH ANYONE YOU DO NOT TRUST `),
autoEOL: true,
vAlign: "middle",
hAlign: "middle",
stretch: true
}
);
console.log(box)
} else {
console.log("Notice: There is no connector set. \n");
var box = boxConsole("100x10", {
text: colors.cyan.underline.bold("Holesail Server Started") + " ⛵️" + "\n" +
colors.magenta("Connection Mode: ") + colors.yellow("Publicly Sharable Key \n") +
colors.magenta(`Holesail is now listening on `) + `${host}:` + argv.live + "\n" +
"Connect with key: " + colors.white(`${localServer.getPublicKey()}`) + "\n" +
colors.gray(` NOTICE: TREAT PUBLIC KEYS LIKE YOU WOULD TREAT A DOMAIN NAME ON PUBLIC SERVER, IF THERE IS ANYTHING PRIVATE ON IT, IT IS YOUR RESPONSIBILITY TO PASSWORD PROTECT IT OR USE CONNECTORS \n`),
autoEOL: true,
vAlign: "middle",
hAlign: "middle",
stretch: true
}
);
console.log(box)
}
console.log(`Server started, Now listening on ${host}:` + argv.live);
console.log('Server public key:', localServer.getPublicKey());
});
} else if (argv.connect) {
} else if (argv.connect || argv['_'][0]) {
//logic for holesail --connect key|seed
//key has priority over seed
if (argv.connect.length === 64) {
connector = argv.connect;
//logic for holesail --connect key|connector and holesail key|connector
//key has priority over connector
let keyInput;
if (argv.connect) {
keyInput = argv.connect;
} else {
keyInput = argv['_'][0];
}
//64 char long is treated as key, avoid 64 char long connectors
if (keyInput.length === 64) {
connector = keyInput;
isConnectorSet = false;
} else {
connector = createHash('sha256').update(argv.connect.toString()).digest('hex');
connector = createHash('sha256').update(keyInput.toString()).digest('hex');
const seed = Buffer.from(connector, 'hex');

@@ -104,70 +138,46 @@ //the keypair here is not a reference to the function above

if (isConnectorSet) {
console.log(1)
pubClient = new holesailClient(connector, "secure");
console.log(2)
pubClient = new holesailClient(connector, "secure");
} else {
pubClient = new holesailClient(connector);
pubClient = new holesailClient(connector);
}
console.log(3)
pubClient.connect({port: port, address: host}, () => {
console.log(`Client setup, access on http://${host}:${port}/`);
if (isConnectorSet) {
console.log(`Your connector is: ${argv.connect}`);
} else {
console.log("Notice: There is no connector set.\n");
}
console.log('Connected to public key:', connector);
}
)
} else if (argv['_'][0]) {
var box = boxConsole("100x10", {
text: colors.cyan.underline.bold("Holesail Client Started") + " ⛵️" + "\n" +
colors.magenta("Connection Mode: ") + colors.green("Super Secret Connector") + "\n" +
colors.magenta(`Access application on http://${host}:${port}/`) + "\n" +
"Connected to Secret Connector: " + colors.white(keyInput) + "\n" +
colors.gray(`Public key: ${connector}`) + "\n" +
colors.gray(` NOTE: TREAT CONNECTORS HOW YOU WOULD TREAT SSH KEY, DO NOT SHARE IT WITH ANYONE YOU DO NOT TRUST `),
autoEOL: true,
vAlign: "middle",
hAlign: "middle",
stretch: true
}
);
console.log(box)
//logic for holesail key|connector
} else {
if (argv['_'][0].length === 64) {
connector = argv['_'][0];
isConnectorSet = false;
} else {
connector = createHash('sha256').update(argv['_'][0].toString()).digest('hex');
const seed = Buffer.from(connector, 'hex');
//the keypair here is not a reference to the function above
connector = b4a.toString(seed, 'hex');
isConnectorSet = true;
}
var box = boxConsole("100x10", {
text: colors.cyan.underline.bold("Holesail Client Started") + " ⛵️" + "\n" +
colors.magenta("Connection Mode: ") + colors.yellow("Publicly Sharable Key") + "\n" +
colors.magenta(`Access application on http://${host}:${port}/`) + "\n" +
colors.gray(`Public key: ${connector}`) + "\n" +
colors.gray(` NOTICE: TREAT PUBLIC KEYS LIKE YOU WOULD TREAT A DOMAIN NAME ON PUBLIC SERVER, IF THERE IS ANYTHING PRIVATE ON IT, IT IS YOUR RESPONSIBILITY TO PASSWORD PROTECT IT OR USE CONNECTORS `),
autoEOL: true,
vAlign: "middle",
hAlign: "middle",
stretch: true
}
);
console.log(box)
if (!argv.port) {
port = 8989
} else {
port = argv.port
}
//--host
if (argv.host) {
host = argv.host
} else {
host = '127.0.0.1'
}
}
const holesailClient = require('holesail-client')
var pubClient = null;
if (isConnectorSet) {
console.log("Test")
pubClient = new holesailClient(connector, "secure")
} else {
pubClient = new holesailClient(connector)
}
pubClient.connect({port: port, address: host}, () => {
console.log(`Client setup, access on http://${host}:${port}/`);
if (isConnectorSet) {
console.log(`Your connector is: ${argv['_'][0]}`);
} else {
console.log("Notice: There is no connector set.\n");
}
console.log('Connected to public key:', connector);
}
)
} else {

@@ -174,0 +184,0 @@ help.printHelp(help.helpMessage);

{
"name": "holesail",
"version": "1.4.13",
"version": "1.5.0",
"description": "A P2P based node package to expose your local ports on the Holepunch protocol",

@@ -27,8 +27,9 @@ "main": "index.js",

"b4a": "^1.6.6",
"cli-box": "^6.0.10",
"colors": "^1.4.0",
"graceful-goodbye": "^1.3.0",
"holesail-client": "latest",
"holesail-client": "^1.1.1",
"holesail-server": "latest",
"hyperdht": "^6.13.1",
"minimist": "^1.2.8"
},
"minimist": "^1.2.8"},
"bin": {

@@ -35,0 +36,0 @@ "holesail": "./index.js"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc