Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ssb-conn-query

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-conn-query - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

14

lib/index.js

@@ -32,8 +32,8 @@ "use strict";

var Sorting = require("./queries/sorting");
function modeToSource(mode) {
if (mode === 'lan')
function typeToSource(type) {
if (type === 'lan')
return 'local';
if (mode === 'bt')
if (type === 'bt')
return 'bt';
if (mode === 'internet')
if (type === 'internet')
return 'pub';

@@ -56,3 +56,3 @@ return 'manual';

? __assign({ address: address }, this.db.get(address)) : !!stagingEntry
? { address: address, source: modeToSource(stagingEntry[1].mode) }
? { address: address, source: typeToSource(stagingEntry[1].type) }
: { address: address, source: 'manual' };

@@ -108,4 +108,4 @@ if (hubData.key)

var _b = __read(_a, 2), address = _b[0], data = _b[1];
if (!data.source && data.mode) {
return __assign({ address: address, source: modeToSource(data.mode) }, data);
if (!data.source && data.type) {
return __assign({ address: address, source: typeToSource(data.type) }, data);
}

@@ -112,0 +112,0 @@ else {

@@ -18,3 +18,3 @@ "use strict";

return function (group) {
var newestStateChange = group.reduce(function (M, p) { return Math.max(M, p.stateChange || 0); }, 0);
var newestStateChange = group.reduce(function (max, peer) { return Math.max(max, peer.stateChange || 0); }, 0);
var minTimeThreshold = newestStateChange + groupMin;

@@ -21,0 +21,0 @@ if (timestamp < minTimeThreshold)

{
"name": "ssb-conn-query",
"description": "Module that helps querying potential SSB peer connections",
"version": "0.0.2",
"version": "0.0.3",
"homepage": "https://github.com/staltz/ssb-conn-query",

@@ -14,4 +14,4 @@ "main": "lib/index.js",

"ssb-conn-db": "~0.2.0",
"ssb-conn-hub": "~0.0.4",
"ssb-conn-staging": "~0.0.1"
"ssb-conn-hub": "~0.0.6",
"ssb-conn-staging": "~0.0.3"
},

@@ -18,0 +18,0 @@ "devDependencies": {

@@ -12,9 +12,8 @@ import ConnDB = require('ssb-conn-db');

/**
* Convert ssb-conn-staging modes to legacy gossip 'source'
* @param mode
* Convert ssb-conn-staging types to legacy gossip 'source'
*/
function modeToSource(mode: StagedData['mode']): Peer['source'] {
if (mode === 'lan') return 'local';
if (mode === 'bt') return 'bt';
if (mode === 'internet') return 'pub';
function typeToSource(type: StagedData['type']): Peer['source'] {
if (type === 'lan') return 'local';
if (type === 'bt') return 'bt';
if (type === 'internet') return 'pub';
return 'manual';

@@ -44,3 +43,3 @@ }

: !!stagingEntry
? {address, source: modeToSource(stagingEntry[1].mode)}
? {address, source: typeToSource(stagingEntry[1].type)}
: {address, source: 'manual'};

@@ -118,4 +117,4 @@ if (hubData.key) peer.key = hubData.key;

.map(([address, data]) => {
if (!data.source && data.mode) {
return {address, source: modeToSource(data.mode), ...data};
if (!data.source && data.type) {
return {address, source: typeToSource(data.type), ...data};
} else {

@@ -122,0 +121,0 @@ return {address, ...data};

@@ -29,3 +29,3 @@ import {Peer} from '../types';

const newestStateChange = group.reduce(
(M: number, p: Peer) => Math.max(M, p.stateChange || 0),
(max: number, peer: Peer) => Math.max(max, peer.stateChange || 0),
0,

@@ -32,0 +32,0 @@ );

@@ -76,4 +76,4 @@ const tape = require('tape');

entries: () => [
['net:192.168.1.12:5678~noauth', {mode: 'lan'}],
['net:192.168.1.13:6789~noauth', {mode: 'lan'}],
['net:192.168.1.12:5678~noauth', {type: 'lan'}],
['net:192.168.1.13:6789~noauth', {type: 'lan'}],
],

@@ -131,3 +131,3 @@ };

source: 'local',
mode: 'lan',
type: 'lan',
},

@@ -258,3 +258,3 @@ ]),

source: 'local',
mode: 'lan',
type: 'lan',
},

@@ -283,3 +283,3 @@ ]),

source: 'local',
mode: 'lan',
type: 'lan',
},

@@ -307,3 +307,3 @@ ]),

source: 'local',
mode: 'lan',
type: 'lan',
},

@@ -310,0 +310,0 @@ ]),

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