🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

ssb-lan

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-lan - npm Package Compare versions

Comparing version
1.0.1
to
1.1.0
+1
-1
lib/index.d.ts
import { SSBConfig } from './types';
declare class LAN {
private readonly ssb;
private readonly notifyDiscovery;
private readonly caps;
private readonly legacyEnabled;
private notifyDiscovery?;
private legacyBroadcast?;

@@ -8,0 +8,0 @@ private normalBroadcast?;

@@ -12,2 +12,3 @@ "use strict";

const Keys = require('ssb-keys');
const pull = require('pull-stream');
const Notify = require('pull-notify');

@@ -59,2 +60,4 @@ const debug = require('debug')('ssb:lan');

this.start = () => {
var _a, _b;
this.notifyDiscovery = Notify();
try {

@@ -82,21 +85,27 @@ this.normalBroadcast = broadcast(NORMAL_PORT);

this.int = setInterval(this.writeBoth, 2e3);
if (this.int.unref)
this.int.unref();
(_b = (_a = this.int) === null || _a === void 0 ? void 0 : _a.unref) === null || _b === void 0 ? void 0 : _b.call(_a);
const that = this;
this.ssb.close.hook(function (fn, args) {
that.stop();
fn.apply(this, args);
});
};
this.stop = () => {
var _a, _b, _c;
clearInterval(this.int);
if (this.normalBroadcast) {
this.normalBroadcast.close();
this.normalBroadcast = void 0;
}
if (this.legacyBroadcast) {
this.legacyBroadcast.close();
this.legacyBroadcast = void 0;
}
(_a = this.notifyDiscovery) === null || _a === void 0 ? void 0 : _a.end();
this.notifyDiscovery = void 0;
(_b = this.normalBroadcast) === null || _b === void 0 ? void 0 : _b.close();
this.normalBroadcast = void 0;
(_c = this.legacyBroadcast) === null || _c === void 0 ? void 0 : _c.close();
this.legacyBroadcast = void 0;
};
this.discoveredPeers = () => {
return this.notifyDiscovery.listen();
if (this.notifyDiscovery)
return this.notifyDiscovery.listen();
else
return pull.empty();
};
this.ssb = ssb;
this.notifyDiscovery = Notify();
this.notifyDiscovery = void 0;
this.caps = Buffer.from(config.caps.shs, 'base64');

@@ -128,13 +137,13 @@ this.legacyEnabled = ((_a = config.lan) === null || _a === void 0 ? void 0 : _a.legacy) !== false;

__decorate([
secret_stack_decorators_1.muxrpc('sync')
(0, secret_stack_decorators_1.muxrpc)('sync')
], LAN.prototype, "start", void 0);
__decorate([
secret_stack_decorators_1.muxrpc('sync')
(0, secret_stack_decorators_1.muxrpc)('sync')
], LAN.prototype, "stop", void 0);
__decorate([
secret_stack_decorators_1.muxrpc('source')
(0, secret_stack_decorators_1.muxrpc)('source')
], LAN.prototype, "discoveredPeers", void 0);
LAN = __decorate([
secret_stack_decorators_1.plugin('1.0.0')
(0, secret_stack_decorators_1.plugin)('1.1.0')
], LAN);
module.exports = LAN;
{
"name": "ssb-lan",
"description": "SSB plugin for discovery of other peers in the same LAN",
"version": "1.0.1",
"version": "1.1.0",
"homepage": "https://github.com/staltz/ssb-lan",

@@ -20,2 +20,3 @@ "main": "lib/index.js",

"pull-notify": "~0.1.1",
"pull-stream": "^3.6.14",
"secret-stack-decorators": "~1.1.0",

@@ -30,6 +31,5 @@ "ssb-keys": "^8.0.2",

"@types/node": "^13.1.8",
"pull-stream": "^3.6.14",
"ssb-server": "~15.2.0",
"tape": "^5.2.0",
"typescript": "4.2.2"
"typescript": "4.4.4"
},

@@ -36,0 +36,0 @@ "author": "Andre Staltz <contact@staltz.com> (http://staltz.com)",