Socket
Socket
Sign inDemoInstall

yamux-js

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.7 to 0.1.0

4

changelog.md
# CHANGELOG
## 0.1.0
- Emit error objects instead of strings (https://github.com/th-ch/yamux-js/pull/5)
## 0.0.7

@@ -4,0 +8,0 @@

30

lib/constants.d.ts

@@ -30,16 +30,16 @@ export declare const VERSION = 0;

}
export declare enum ERRORS {
errInvalidVersion = "invalid protocol version",
errInvalidMsgType = "invalid msg type",
errSessionShutdown = "session shutdown",
errStreamsExhausted = "streams exhausted",
errDuplicateStream = "duplicate stream initiated",
errRecvWindowExceeded = "recv window exceeded",
errTimeout = "i/o deadline reached",
errStreamClosed = "stream closed",
errUnexpectedFlag = "unexpected flag",
errRemoteGoAway = "remote end is not accepting connections",
errConnectionReset = "connection reset",
errConnectionWriteTimeout = "connection write timeout",
errKeepAliveTimeout = "keepalive timeout"
}
export declare const ERRORS: {
readonly errInvalidVersion: Error;
readonly errInvalidMsgType: Error;
readonly errSessionShutdown: Error;
readonly errStreamsExhausted: Error;
readonly errDuplicateStream: Error;
readonly errRecvWindowExceeded: Error;
readonly errTimeout: Error;
readonly errStreamClosed: Error;
readonly errUnexpectedFlag: Error;
readonly errRemoteGoAway: Error;
readonly errConnectionReset: Error;
readonly errConnectionWriteTimeout: Error;
readonly errKeepAliveTimeout: Error;
};

@@ -40,38 +40,37 @@ "use strict";

})(GO_AWAY_ERRORS = exports.GO_AWAY_ERRORS || (exports.GO_AWAY_ERRORS = {}));
var ERRORS;
(function (ERRORS) {
exports.ERRORS = {
// ErrInvalidVersion means we received a frame with an
// invalid version
ERRORS["errInvalidVersion"] = "invalid protocol version";
errInvalidVersion: new Error('invalid protocol version'),
// ErrInvalidMsgType means we received a frame with an
// invalid message type
ERRORS["errInvalidMsgType"] = "invalid msg type";
errInvalidMsgType: new Error('invalid msg type'),
// ErrSessionShutdown is used if there is a shutdown during
// an operation
ERRORS["errSessionShutdown"] = "session shutdown";
errSessionShutdown: new Error('session shutdown'),
// ErrStreamsExhausted is returned if we have no more
// stream ids to issue
// WARNING [Difference with the Go implementation]: not used in the Node.js lib
ERRORS["errStreamsExhausted"] = "streams exhausted";
errStreamsExhausted: new Error('streams exhausted'),
// ErrDuplicateStream is used if a duplicate stream is
// opened inbound
ERRORS["errDuplicateStream"] = "duplicate stream initiated";
errDuplicateStream: new Error('duplicate stream initiated'),
// ErrReceiveWindowExceeded indicates the window was exceeded
ERRORS["errRecvWindowExceeded"] = "recv window exceeded";
errRecvWindowExceeded: new Error('recv window exceeded'),
// ErrTimeout is used when we reach an IO deadline
ERRORS["errTimeout"] = "i/o deadline reached";
errTimeout: new Error('i/o deadline reached'),
// ErrStreamClosed is returned when using a closed stream
ERRORS["errStreamClosed"] = "stream closed";
errStreamClosed: new Error('stream closed'),
// ErrUnexpectedFlag is set when we get an unexpected flag
ERRORS["errUnexpectedFlag"] = "unexpected flag";
errUnexpectedFlag: new Error('unexpected flag'),
// ErrRemoteGoAway is used when we get a go away from the other side
ERRORS["errRemoteGoAway"] = "remote end is not accepting connections";
errRemoteGoAway: new Error('remote end is not accepting connections'),
// ErrConnectionReset is sent if a stream is reset. This can happen
// if the backlog is exceeded, or if there was a remote GoAway.
ERRORS["errConnectionReset"] = "connection reset";
errConnectionReset: new Error('connection reset'),
// ErrConnectionWriteTimeout indicates that we hit the "safety valve"
// timeout writing to the underlying stream connection.
ERRORS["errConnectionWriteTimeout"] = "connection write timeout";
errConnectionWriteTimeout: new Error('connection write timeout'),
// ErrKeepAliveTimeout is sent if a missed keepalive caused the stream close
ERRORS["errKeepAliveTimeout"] = "keepalive timeout";
})(ERRORS = exports.ERRORS || (exports.ERRORS = {}));
errKeepAliveTimeout: new Error('keepalive timeout'),
};
/// <reference types="node" />
import { Duplex, Transform, TransformCallback } from 'stream';
import { ERRORS } from './constants';
import { Header } from './header';

@@ -24,3 +23,3 @@ import { Config, defaultConfig } from './mux';

isClosed(): boolean;
close(error?: ERRORS | string): void;
close(error?: Error): void;
private incomingStream;

@@ -27,0 +26,0 @@ private goAway;

@@ -238,9 +238,9 @@ "use strict";

this.config.logger('[ERR] yamux: received protocol error go away');
return this.close('yamux protocol error');
return this.close(new Error('yamux protocol error'));
case constants_1.GO_AWAY_ERRORS.goAwayInternalErr:
this.config.logger('[ERR] yamux: received internal error go away');
return this.close('remote yamux internal error');
return this.close(new Error('remote yamux internal error'));
default:
this.config.logger('[ERR] yamux: received unexpected go away');
return this.close('unexpected go away received');
return this.close(new Error('unexpected go away received'));
}

@@ -247,0 +247,0 @@ }

{
"name": "yamux-js",
"version": "0.0.7",
"version": "0.1.0",
"main": "lib/index",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc