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

@ndn/endpoint

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndn/endpoint - npm Package Compare versions

Comparing version 0.0.20210203 to 0.0.20210930

8

lib/consumer_browser.js

@@ -16,3 +16,2 @@ import { __importDefault, __importStar } from "tslib";

const promise = new Promise((resolve, reject) => {
var _a;
const rx = pushable();

@@ -39,11 +38,10 @@ let timer;

};
(_a = signal) === null || _a === void 0 ? void 0 : _a.addEventListener("abort", onabort);
signal?.addEventListener("abort", onabort);
this.fw.addFace({
rx,
async tx(iterable) {
var _a;
for await (const pkt of iterable) {
if (pkt.l3 instanceof Data) {
try {
await (verifier === null || verifier === void 0 ? void 0 : verifier.verify(pkt.l3));
await verifier?.verify(pkt.l3);
}

@@ -63,3 +61,3 @@ catch (err) {

cancelRetx();
(_a = signal) === null || _a === void 0 ? void 0 : _a.removeEventListener("abort", onabort);
signal?.removeEventListener("abort", onabort);
rx.end();

@@ -66,0 +64,0 @@ },

@@ -16,3 +16,2 @@ import { __importDefault, __importStar } from "tslib";

const promise = new Promise((resolve, reject) => {
var _a;
const rx = pushable();

@@ -39,11 +38,10 @@ let timer;

};
(_a = signal) === null || _a === void 0 ? void 0 : _a.addEventListener("abort", onabort);
signal?.addEventListener("abort", onabort);
this.fw.addFace({
rx,
async tx(iterable) {
var _a;
for await (const pkt of iterable) {
if (pkt.l3 instanceof Data) {
try {
await (verifier === null || verifier === void 0 ? void 0 : verifier.verify(pkt.l3));
await verifier?.verify(pkt.l3);
}

@@ -63,3 +61,3 @@ catch (err) {

cancelRetx();
(_a = signal) === null || _a === void 0 ? void 0 : _a.removeEventListener("abort", onabort);
signal?.removeEventListener("abort", onabort);
rx.end();

@@ -66,0 +64,0 @@ },

@@ -0,1 +1,3 @@

/// <reference types="node" />
/// <reference types="web" />
import { Forwarder } from "@ndn/fw";

@@ -29,9 +31,9 @@ import { Data, Interest, NameLike, Verifier } from "@ndn/packet";

*
* This is a Promise that resolves with the retrieved Data, and rejects upon timeout.
* Calling .cancel() cancels Data retrieval and rejects the Promise.
* This is a Promise that resolves with the retrieved Data and rejects upon timeout,
* annotated with the Interest and some counters.
*/
export declare type Context = Promise<Data> & {
export interface Context extends Promise<Data> {
readonly interest: Interest;
readonly nRetx: number;
};
}
/** Consumer functionality of Endpoint. */

@@ -38,0 +40,0 @@ export declare class EndpointConsumer {

@@ -0,0 +0,0 @@ import { Data, Interest, Signer } from "@ndn/packet";

@@ -7,3 +7,3 @@ import { __importDefault, __importStar } from "tslib";

/**
* Endpoint is the main entrypoint for an application to interact with the forwarding plane.
* Endpoint is the main entry point for an application to interact with the forwarding plane.
* It provides basic consumer and producer functionality.

@@ -13,5 +13,4 @@ */

constructor(opts = {}) {
var _a;
this.opts = opts;
this.fw = (_a = opts.fw) !== null && _a !== void 0 ? _a : Forwarder.getDefault();
this.fw = opts.fw ?? Forwarder.getDefault();
}

@@ -18,0 +17,0 @@ }

@@ -7,3 +7,3 @@ import { __importDefault, __importStar } from "tslib";

/**
* Endpoint is the main entrypoint for an application to interact with the forwarding plane.
* Endpoint is the main entry point for an application to interact with the forwarding plane.
* It provides basic consumer and producer functionality.

@@ -13,5 +13,4 @@ */

constructor(opts = {}) {
var _a;
this.opts = opts;
this.fw = (_a = opts.fw) !== null && _a !== void 0 ? _a : Forwarder.getDefault();
this.fw = opts.fw ?? Forwarder.getDefault();
}

@@ -18,0 +17,0 @@ }

@@ -8,3 +8,3 @@ import { Forwarder } from "@ndn/fw";

/**
* Endpoint is the main entrypoint for an application to interact with the forwarding plane.
* Endpoint is the main entry point for an application to interact with the forwarding plane.
* It provides basic consumer and producer functionality.

@@ -11,0 +11,0 @@ */

@@ -0,0 +0,0 @@ export type { RetxOptions, RetxPolicy } from "./retx";

@@ -12,4 +12,4 @@ import { FwPacket } from "@ndn/fw";

produce(prefixInput, handler, opts = {}) {
const prefix = typeof prefixInput === "undefined" ? undefined : new Name(prefixInput);
const { describe = `produce(${prefix})`, announcement, concurrency = 1, dataSigner, dataBuffer, autoBuffer = true, } = { ...this.opts, ...opts };
const prefix = prefixInput === undefined ? undefined : new Name(prefixInput);
const { describe = `produce(${prefix})`, routeCapture = true, announcement, concurrency = 1, dataSigner, dataBuffer, autoBuffer = true, } = { ...this.opts, ...opts };
let producer; // eslint-disable-line prefer-const

@@ -45,3 +45,3 @@ const processInterestUnbuffered = async (interest) => {

const face = this.fw.addFace({
transform: flatTransform(concurrency, async function* ({ l3: interest, token }) {
duplex: flatTransform(concurrency, async function* ({ l3: interest, token }) {
if (!(interest instanceof Interest)) {

@@ -59,2 +59,3 @@ return;

local: true,
routeCapture,
});

@@ -61,0 +62,0 @@ if (prefix) {

@@ -12,4 +12,4 @@ import { FwPacket } from "@ndn/fw";

produce(prefixInput, handler, opts = {}) {
const prefix = typeof prefixInput === "undefined" ? undefined : new Name(prefixInput);
const { describe = `produce(${prefix})`, announcement, concurrency = 1, dataSigner, dataBuffer, autoBuffer = true, } = { ...this.opts, ...opts };
const prefix = prefixInput === undefined ? undefined : new Name(prefixInput);
const { describe = `produce(${prefix})`, routeCapture = true, announcement, concurrency = 1, dataSigner, dataBuffer, autoBuffer = true, } = { ...this.opts, ...opts };
let producer; // eslint-disable-line prefer-const

@@ -45,3 +45,3 @@ const processInterestUnbuffered = async (interest) => {

const face = this.fw.addFace({
transform: flatTransform(concurrency, async function* ({ l3: interest, token }) {
duplex: flatTransform(concurrency, async function* ({ l3: interest, token }) {
if (!(interest instanceof Interest)) {

@@ -59,2 +59,3 @@ return;

local: true,
routeCapture,
});

@@ -61,0 +62,0 @@ if (prefix) {

@@ -19,2 +19,11 @@ import { Forwarder, FwFace } from "@ndn/fw";

/**
* Whether routes registered by producer would cause @ndn/fw internal FIB to stop matching toward
* shorter prefixes. Default is true.
*
* If all nexthops of a FIB entry are set to non-capture, FIB lookup may continue onto nexthops
* on FIB entries with shorter prefixes. One use case is in @ndn/sync package, where both local
* and remote sync participants want to receive each other's Interests.
*/
routeCapture?: boolean;
/**
* What name to be readvertised.

@@ -21,0 +30,0 @@ * Ignored if prefix is undefined.

@@ -0,0 +0,0 @@ /** Interest retransmission policy options. */

{
"name": "@ndn/endpoint",
"version": "0.0.20210203",
"version": "0.0.20210930",
"description": "NDNts: Client Endpoint",

@@ -25,13 +25,13 @@ "keywords": [

"dependencies": {
"@ndn/fw": "0.0.20210203",
"@ndn/packet": "0.0.20210203",
"@ndn/tlv": "0.0.20210203",
"@ndn/fw": "0.0.20210930",
"@ndn/packet": "0.0.20210930",
"@ndn/tlv": "0.0.20210930",
"abort-controller": "^3.0.0",
"applymixins": "^1.1.0",
"it-pushable": "1.4.0",
"it-pushable": "^1.4.2",
"minimalistic-assert": "^1.0.1",
"streaming-iterables": "^5.0.4",
"tslib": "^2.1.0"
"streaming-iterables": "^6.0.0",
"tslib": "^2.3.1"
},
"types": "lib/mod.d.ts"
}
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