@cosyte/mllp 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +33 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -2
- package/dist/index.d.ts +79 -2
- package/dist/index.mjs +33 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.d.cts
CHANGED
|
@@ -1856,6 +1856,56 @@ interface AckModeWarningEvent {
|
|
|
1856
1856
|
/** Wall-clock time at point of emission. */
|
|
1857
1857
|
readonly timestamp: Date;
|
|
1858
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* The stable code on a {@link ConnectionRejectedEvent}: a connection arrived while the server
|
|
1861
|
+
* already held {@link ServerOptions.maxConnections} connections, and it was closed at accept.
|
|
1862
|
+
*
|
|
1863
|
+
* Part of the public surface: renaming or removing it is a breaking change.
|
|
1864
|
+
*
|
|
1865
|
+
* @example
|
|
1866
|
+
* ```typescript
|
|
1867
|
+
* import { MLLP_CONNECTION_LIMIT_REACHED } from '@cosyte/mllp';
|
|
1868
|
+
* server.on('connectionRejected', (e) => {
|
|
1869
|
+
* if (e.code === MLLP_CONNECTION_LIMIT_REACHED) metrics.increment('mllp.over_cap');
|
|
1870
|
+
* });
|
|
1871
|
+
* ```
|
|
1872
|
+
*/
|
|
1873
|
+
declare const MLLP_CONNECTION_LIMIT_REACHED = "MLLP_CONNECTION_LIMIT_REACHED";
|
|
1874
|
+
/**
|
|
1875
|
+
* Payload of the server `'connectionRejected'` event: a connection was closed at accept and never
|
|
1876
|
+
* reached the server's handler.
|
|
1877
|
+
*
|
|
1878
|
+
* Emitted when a connection arrives while the server already holds
|
|
1879
|
+
* {@link ServerOptions.maxConnections} sockets. The socket is closed before any byte is read from
|
|
1880
|
+
* it and before any TLS handshake, so the rejected peer never becomes a `Connection`, never fires
|
|
1881
|
+
* `'connection'` and never reaches `onMessage`. The peer sees its connection close; a client that
|
|
1882
|
+
* reconnects will try again.
|
|
1883
|
+
*
|
|
1884
|
+
* **PHI-safe by construction:** a stable code, a fixed message, the configured cap and the peer's
|
|
1885
|
+
* address and port (the routing metadata the `'connection'` event already carries), never a byte
|
|
1886
|
+
* of payload. The object is `Object.freeze()`'d before emission.
|
|
1887
|
+
*
|
|
1888
|
+
* @example
|
|
1889
|
+
* ```typescript
|
|
1890
|
+
* server.on('connectionRejected', ({ code, remoteAddress }) => {
|
|
1891
|
+
* logger.warn({ code, remoteAddress });
|
|
1892
|
+
* });
|
|
1893
|
+
* ```
|
|
1894
|
+
*/
|
|
1895
|
+
interface ConnectionRejectedEvent {
|
|
1896
|
+
/** Why the connection was closed. */
|
|
1897
|
+
readonly code: typeof MLLP_CONNECTION_LIMIT_REACHED;
|
|
1898
|
+
/** Fixed text for `code`. Never interpolated. */
|
|
1899
|
+
readonly message: string;
|
|
1900
|
+
/** The configured {@link ServerOptions.maxConnections}. */
|
|
1901
|
+
readonly maxConnections: number;
|
|
1902
|
+
/** The rejected peer's address, or `null` if it could not be read. */
|
|
1903
|
+
readonly remoteAddress: string | null;
|
|
1904
|
+
/** The rejected peer's port, or `null` if it could not be read. */
|
|
1905
|
+
readonly remotePort: number | null;
|
|
1906
|
+
/** Wall-clock time at point of emission. */
|
|
1907
|
+
readonly timestamp: Date;
|
|
1908
|
+
}
|
|
1859
1909
|
/**
|
|
1860
1910
|
* Observability snapshot returned by `server.getStats()`.
|
|
1861
1911
|
*
|
|
@@ -2008,6 +2058,23 @@ interface ServerOptions {
|
|
|
2008
2058
|
* @default false
|
|
2009
2059
|
*/
|
|
2010
2060
|
allowWildcardBind?: boolean;
|
|
2061
|
+
/**
|
|
2062
|
+
* The most connections this server holds at once. A connection that arrives while the server
|
|
2063
|
+
* already holds this many is closed at accept: it never reaches `onMessage` or the
|
|
2064
|
+
* `'connection'` event, and the server emits `'connectionRejected'`
|
|
2065
|
+
* ({@link ConnectionRejectedEvent}, code `MLLP_CONNECTION_LIMIT_REACHED`) instead.
|
|
2066
|
+
*
|
|
2067
|
+
* The count is of open sockets, the number that bounds file descriptors: it includes a TLS
|
|
2068
|
+
* handshake still in progress, and a connection counts until its socket has fully closed. An
|
|
2069
|
+
* over-cap TLS connection is closed before its handshake, so it costs no handshake work and is
|
|
2070
|
+
* not a `'tlsClientError'`.
|
|
2071
|
+
*
|
|
2072
|
+
* Must be a positive integer; anything else throws a `RangeError` at construction. Unset means
|
|
2073
|
+
* no cap.
|
|
2074
|
+
*
|
|
2075
|
+
* @default undefined (no cap)
|
|
2076
|
+
*/
|
|
2077
|
+
maxConnections?: number;
|
|
2011
2078
|
}
|
|
2012
2079
|
/**
|
|
2013
2080
|
* Options for `createStarterServer()`, the "three lines of code" factory.
|
|
@@ -2080,6 +2147,9 @@ interface StarterServerOptions extends ServerOptions {
|
|
|
2080
2147
|
* `'tlsNegotiated'` ({@link NegotiatedTlsParameters}, the protocol version and cipher
|
|
2081
2148
|
* suite each accepted link actually negotiated, once per completed handshake and never
|
|
2082
2149
|
* on a plaintext listener).
|
|
2150
|
+
* With {@link ServerOptions.maxConnections} set, `'connectionRejected'`
|
|
2151
|
+
* ({@link ConnectionRejectedEvent}) reports each connection closed at accept because the server
|
|
2152
|
+
* was already full; such a connection never fires `'connection'` and never reaches `onMessage`.
|
|
2083
2153
|
* All event payloads are `Object.freeze()`'d before emission.
|
|
2084
2154
|
*
|
|
2085
2155
|
* @example
|
|
@@ -2134,6 +2204,13 @@ declare class MllpServer extends EventEmitter {
|
|
|
2134
2204
|
* @param opts - Server options (bind host/port, auto-ACK policy, message handler, framing, …).
|
|
2135
2205
|
*/
|
|
2136
2206
|
constructor(opts: ServerOptions);
|
|
2207
|
+
/**
|
|
2208
|
+
* Report a connection the listener closed at accept because the cap was full.
|
|
2209
|
+
*
|
|
2210
|
+
* Contained: this runs inside the listener's own 'drop' callback, so a throwing subscriber would
|
|
2211
|
+
* otherwise unwind into the accept path. The throw is surfaced on 'error' instead.
|
|
2212
|
+
*/
|
|
2213
|
+
private _onConnectionOverCap;
|
|
2137
2214
|
/**
|
|
2138
2215
|
* Start listening on the given port.
|
|
2139
2216
|
*
|
|
@@ -4952,5 +5029,5 @@ declare function runDifferential(options?: DifferentialRunOptions): Promise<Diff
|
|
|
4952
5029
|
*/
|
|
4953
5030
|
declare const VERSION: string;
|
|
4954
5031
|
|
|
4955
|
-
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, MllpWarning, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, Transport, VERSION, WarningCode, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, tlsConfigurationMessage };
|
|
4956
|
-
export type { AckCode, AckCorrelationCode, AckCorrelationWarning, AckModeCode, AckModeWarning, AckModeWarningEvent, ApplicationAckFailure, CanonicalExchange, ClientAuth, ClientOptions, ClientStats, CommitAckReport, ConnectionErrorCause, ConnectionErrorPhase, ConnectionOptions, ConnectionState, ConnectionStats, DifferentialConfigurationErrorCode, DifferentialConnect, DifferentialCorrelationOutcome, DifferentialDeviation, DifferentialExchangeOutcome, DifferentialExchangeReport, DifferentialParityOutcome, DifferentialPeer, DifferentialReport, DifferentialReportPeer, DifferentialRunOptions, DifferentialRunResult, DifferentialSkipReason, EncoderOptions, FrameReaderOptions, MessageMeta, NackAckCode, NackEvent, NackReason, NegativeAckCode, NegotiatedTlsParameters, PemInput, ReconnectingEvent, ResolvedTlsCipherPolicy, RetryContext, RetryStrategy, SecurityWarning, SecurityWarningCode, ServerOptions, ServerStats, ServerTlsOptions, StarterClientOptions, StarterServerOptions, StateChangeEvent, TlsCipherPolicyInput, TlsConfigurationErrorCode, TlsOptions };
|
|
5032
|
+
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, MllpWarning, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, Transport, VERSION, WarningCode, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, tlsConfigurationMessage };
|
|
5033
|
+
export type { AckCode, AckCorrelationCode, AckCorrelationWarning, AckModeCode, AckModeWarning, AckModeWarningEvent, ApplicationAckFailure, CanonicalExchange, ClientAuth, ClientOptions, ClientStats, CommitAckReport, ConnectionErrorCause, ConnectionErrorPhase, ConnectionOptions, ConnectionRejectedEvent, ConnectionState, ConnectionStats, DifferentialConfigurationErrorCode, DifferentialConnect, DifferentialCorrelationOutcome, DifferentialDeviation, DifferentialExchangeOutcome, DifferentialExchangeReport, DifferentialParityOutcome, DifferentialPeer, DifferentialReport, DifferentialReportPeer, DifferentialRunOptions, DifferentialRunResult, DifferentialSkipReason, EncoderOptions, FrameReaderOptions, MessageMeta, NackAckCode, NackEvent, NackReason, NegativeAckCode, NegotiatedTlsParameters, PemInput, ReconnectingEvent, ResolvedTlsCipherPolicy, RetryContext, RetryStrategy, SecurityWarning, SecurityWarningCode, ServerOptions, ServerStats, ServerTlsOptions, StarterClientOptions, StarterServerOptions, StateChangeEvent, TlsCipherPolicyInput, TlsConfigurationErrorCode, TlsOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1856,6 +1856,56 @@ interface AckModeWarningEvent {
|
|
|
1856
1856
|
/** Wall-clock time at point of emission. */
|
|
1857
1857
|
readonly timestamp: Date;
|
|
1858
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* The stable code on a {@link ConnectionRejectedEvent}: a connection arrived while the server
|
|
1861
|
+
* already held {@link ServerOptions.maxConnections} connections, and it was closed at accept.
|
|
1862
|
+
*
|
|
1863
|
+
* Part of the public surface: renaming or removing it is a breaking change.
|
|
1864
|
+
*
|
|
1865
|
+
* @example
|
|
1866
|
+
* ```typescript
|
|
1867
|
+
* import { MLLP_CONNECTION_LIMIT_REACHED } from '@cosyte/mllp';
|
|
1868
|
+
* server.on('connectionRejected', (e) => {
|
|
1869
|
+
* if (e.code === MLLP_CONNECTION_LIMIT_REACHED) metrics.increment('mllp.over_cap');
|
|
1870
|
+
* });
|
|
1871
|
+
* ```
|
|
1872
|
+
*/
|
|
1873
|
+
declare const MLLP_CONNECTION_LIMIT_REACHED = "MLLP_CONNECTION_LIMIT_REACHED";
|
|
1874
|
+
/**
|
|
1875
|
+
* Payload of the server `'connectionRejected'` event: a connection was closed at accept and never
|
|
1876
|
+
* reached the server's handler.
|
|
1877
|
+
*
|
|
1878
|
+
* Emitted when a connection arrives while the server already holds
|
|
1879
|
+
* {@link ServerOptions.maxConnections} sockets. The socket is closed before any byte is read from
|
|
1880
|
+
* it and before any TLS handshake, so the rejected peer never becomes a `Connection`, never fires
|
|
1881
|
+
* `'connection'` and never reaches `onMessage`. The peer sees its connection close; a client that
|
|
1882
|
+
* reconnects will try again.
|
|
1883
|
+
*
|
|
1884
|
+
* **PHI-safe by construction:** a stable code, a fixed message, the configured cap and the peer's
|
|
1885
|
+
* address and port (the routing metadata the `'connection'` event already carries), never a byte
|
|
1886
|
+
* of payload. The object is `Object.freeze()`'d before emission.
|
|
1887
|
+
*
|
|
1888
|
+
* @example
|
|
1889
|
+
* ```typescript
|
|
1890
|
+
* server.on('connectionRejected', ({ code, remoteAddress }) => {
|
|
1891
|
+
* logger.warn({ code, remoteAddress });
|
|
1892
|
+
* });
|
|
1893
|
+
* ```
|
|
1894
|
+
*/
|
|
1895
|
+
interface ConnectionRejectedEvent {
|
|
1896
|
+
/** Why the connection was closed. */
|
|
1897
|
+
readonly code: typeof MLLP_CONNECTION_LIMIT_REACHED;
|
|
1898
|
+
/** Fixed text for `code`. Never interpolated. */
|
|
1899
|
+
readonly message: string;
|
|
1900
|
+
/** The configured {@link ServerOptions.maxConnections}. */
|
|
1901
|
+
readonly maxConnections: number;
|
|
1902
|
+
/** The rejected peer's address, or `null` if it could not be read. */
|
|
1903
|
+
readonly remoteAddress: string | null;
|
|
1904
|
+
/** The rejected peer's port, or `null` if it could not be read. */
|
|
1905
|
+
readonly remotePort: number | null;
|
|
1906
|
+
/** Wall-clock time at point of emission. */
|
|
1907
|
+
readonly timestamp: Date;
|
|
1908
|
+
}
|
|
1859
1909
|
/**
|
|
1860
1910
|
* Observability snapshot returned by `server.getStats()`.
|
|
1861
1911
|
*
|
|
@@ -2008,6 +2058,23 @@ interface ServerOptions {
|
|
|
2008
2058
|
* @default false
|
|
2009
2059
|
*/
|
|
2010
2060
|
allowWildcardBind?: boolean;
|
|
2061
|
+
/**
|
|
2062
|
+
* The most connections this server holds at once. A connection that arrives while the server
|
|
2063
|
+
* already holds this many is closed at accept: it never reaches `onMessage` or the
|
|
2064
|
+
* `'connection'` event, and the server emits `'connectionRejected'`
|
|
2065
|
+
* ({@link ConnectionRejectedEvent}, code `MLLP_CONNECTION_LIMIT_REACHED`) instead.
|
|
2066
|
+
*
|
|
2067
|
+
* The count is of open sockets, the number that bounds file descriptors: it includes a TLS
|
|
2068
|
+
* handshake still in progress, and a connection counts until its socket has fully closed. An
|
|
2069
|
+
* over-cap TLS connection is closed before its handshake, so it costs no handshake work and is
|
|
2070
|
+
* not a `'tlsClientError'`.
|
|
2071
|
+
*
|
|
2072
|
+
* Must be a positive integer; anything else throws a `RangeError` at construction. Unset means
|
|
2073
|
+
* no cap.
|
|
2074
|
+
*
|
|
2075
|
+
* @default undefined (no cap)
|
|
2076
|
+
*/
|
|
2077
|
+
maxConnections?: number;
|
|
2011
2078
|
}
|
|
2012
2079
|
/**
|
|
2013
2080
|
* Options for `createStarterServer()`, the "three lines of code" factory.
|
|
@@ -2080,6 +2147,9 @@ interface StarterServerOptions extends ServerOptions {
|
|
|
2080
2147
|
* `'tlsNegotiated'` ({@link NegotiatedTlsParameters}, the protocol version and cipher
|
|
2081
2148
|
* suite each accepted link actually negotiated, once per completed handshake and never
|
|
2082
2149
|
* on a plaintext listener).
|
|
2150
|
+
* With {@link ServerOptions.maxConnections} set, `'connectionRejected'`
|
|
2151
|
+
* ({@link ConnectionRejectedEvent}) reports each connection closed at accept because the server
|
|
2152
|
+
* was already full; such a connection never fires `'connection'` and never reaches `onMessage`.
|
|
2083
2153
|
* All event payloads are `Object.freeze()`'d before emission.
|
|
2084
2154
|
*
|
|
2085
2155
|
* @example
|
|
@@ -2134,6 +2204,13 @@ declare class MllpServer extends EventEmitter {
|
|
|
2134
2204
|
* @param opts - Server options (bind host/port, auto-ACK policy, message handler, framing, …).
|
|
2135
2205
|
*/
|
|
2136
2206
|
constructor(opts: ServerOptions);
|
|
2207
|
+
/**
|
|
2208
|
+
* Report a connection the listener closed at accept because the cap was full.
|
|
2209
|
+
*
|
|
2210
|
+
* Contained: this runs inside the listener's own 'drop' callback, so a throwing subscriber would
|
|
2211
|
+
* otherwise unwind into the accept path. The throw is surfaced on 'error' instead.
|
|
2212
|
+
*/
|
|
2213
|
+
private _onConnectionOverCap;
|
|
2137
2214
|
/**
|
|
2138
2215
|
* Start listening on the given port.
|
|
2139
2216
|
*
|
|
@@ -4952,5 +5029,5 @@ declare function runDifferential(options?: DifferentialRunOptions): Promise<Diff
|
|
|
4952
5029
|
*/
|
|
4953
5030
|
declare const VERSION: string;
|
|
4954
5031
|
|
|
4955
|
-
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, MllpWarning, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, Transport, VERSION, WarningCode, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, tlsConfigurationMessage };
|
|
4956
|
-
export type { AckCode, AckCorrelationCode, AckCorrelationWarning, AckModeCode, AckModeWarning, AckModeWarningEvent, ApplicationAckFailure, CanonicalExchange, ClientAuth, ClientOptions, ClientStats, CommitAckReport, ConnectionErrorCause, ConnectionErrorPhase, ConnectionOptions, ConnectionState, ConnectionStats, DifferentialConfigurationErrorCode, DifferentialConnect, DifferentialCorrelationOutcome, DifferentialDeviation, DifferentialExchangeOutcome, DifferentialExchangeReport, DifferentialParityOutcome, DifferentialPeer, DifferentialReport, DifferentialReportPeer, DifferentialRunOptions, DifferentialRunResult, DifferentialSkipReason, EncoderOptions, FrameReaderOptions, MessageMeta, NackAckCode, NackEvent, NackReason, NegativeAckCode, NegotiatedTlsParameters, PemInput, ReconnectingEvent, ResolvedTlsCipherPolicy, RetryContext, RetryStrategy, SecurityWarning, SecurityWarningCode, ServerOptions, ServerStats, ServerTlsOptions, StarterClientOptions, StarterServerOptions, StateChangeEvent, TlsCipherPolicyInput, TlsConfigurationErrorCode, TlsOptions };
|
|
5032
|
+
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, MllpWarning, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, Transport, VERSION, WarningCode, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, tlsConfigurationMessage };
|
|
5033
|
+
export type { AckCode, AckCorrelationCode, AckCorrelationWarning, AckModeCode, AckModeWarning, AckModeWarningEvent, ApplicationAckFailure, CanonicalExchange, ClientAuth, ClientOptions, ClientStats, CommitAckReport, ConnectionErrorCause, ConnectionErrorPhase, ConnectionOptions, ConnectionRejectedEvent, ConnectionState, ConnectionStats, DifferentialConfigurationErrorCode, DifferentialConnect, DifferentialCorrelationOutcome, DifferentialDeviation, DifferentialExchangeOutcome, DifferentialExchangeReport, DifferentialParityOutcome, DifferentialPeer, DifferentialReport, DifferentialReportPeer, DifferentialRunOptions, DifferentialRunResult, DifferentialSkipReason, EncoderOptions, FrameReaderOptions, MessageMeta, NackAckCode, NackEvent, NackReason, NegativeAckCode, NegotiatedTlsParameters, PemInput, ReconnectingEvent, ResolvedTlsCipherPolicy, RetryContext, RetryStrategy, SecurityWarning, SecurityWarningCode, ServerOptions, ServerStats, ServerTlsOptions, StarterClientOptions, StarterServerOptions, StateChangeEvent, TlsCipherPolicyInput, TlsConfigurationErrorCode, TlsOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1742,6 +1742,8 @@ function isWildcardHost(host) {
|
|
|
1742
1742
|
}
|
|
1743
1743
|
return false;
|
|
1744
1744
|
}
|
|
1745
|
+
var MLLP_CONNECTION_LIMIT_REACHED = "MLLP_CONNECTION_LIMIT_REACHED";
|
|
1746
|
+
var CONNECTION_LIMIT_MESSAGE = "connection closed at accept: the server already holds maxConnections connections";
|
|
1745
1747
|
var SERVER_DEFAULT_FRAMING = {
|
|
1746
1748
|
allowFsOnly: true,
|
|
1747
1749
|
allowLfAfterFs: true,
|
|
@@ -1788,6 +1790,12 @@ var MllpServer = class extends EventEmitter {
|
|
|
1788
1790
|
*/
|
|
1789
1791
|
constructor(opts) {
|
|
1790
1792
|
super();
|
|
1793
|
+
const maxConnections = opts.maxConnections;
|
|
1794
|
+
if (maxConnections !== void 0 && !(Number.isSafeInteger(maxConnections) && maxConnections >= 1)) {
|
|
1795
|
+
throw new RangeError(
|
|
1796
|
+
"ServerOptions.maxConnections must be a positive integer, or left unset for no cap"
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1791
1799
|
this._opts = opts;
|
|
1792
1800
|
this._isTls = opts.tls !== void 0;
|
|
1793
1801
|
let cipherPolicy = null;
|
|
@@ -1844,6 +1852,29 @@ var MllpServer = class extends EventEmitter {
|
|
|
1844
1852
|
this.emit("error", err);
|
|
1845
1853
|
}
|
|
1846
1854
|
});
|
|
1855
|
+
if (maxConnections !== void 0) {
|
|
1856
|
+
this._netServer.maxConnections = maxConnections;
|
|
1857
|
+
this._netServer.on("drop", (data) => {
|
|
1858
|
+
this._onConnectionOverCap(maxConnections, data);
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Report a connection the listener closed at accept because the cap was full.
|
|
1864
|
+
*
|
|
1865
|
+
* Contained: this runs inside the listener's own 'drop' callback, so a throwing subscriber would
|
|
1866
|
+
* otherwise unwind into the accept path. The throw is surfaced on 'error' instead.
|
|
1867
|
+
*/
|
|
1868
|
+
_onConnectionOverCap(maxConnections, data) {
|
|
1869
|
+
const event = Object.freeze({
|
|
1870
|
+
code: MLLP_CONNECTION_LIMIT_REACHED,
|
|
1871
|
+
message: CONNECTION_LIMIT_MESSAGE,
|
|
1872
|
+
maxConnections,
|
|
1873
|
+
remoteAddress: data?.remoteAddress ?? null,
|
|
1874
|
+
remotePort: data?.remotePort ?? null,
|
|
1875
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1876
|
+
});
|
|
1877
|
+
this._emitContained("connectionRejected", event);
|
|
1847
1878
|
}
|
|
1848
1879
|
/**
|
|
1849
1880
|
* Start listening on the given port.
|
|
@@ -5149,8 +5180,8 @@ async function runDifferential(options = {}) {
|
|
|
5149
5180
|
}
|
|
5150
5181
|
|
|
5151
5182
|
// src/index.ts
|
|
5152
|
-
var VERSION = "0.1.
|
|
5183
|
+
var VERSION = "0.1.10";
|
|
5153
5184
|
|
|
5154
|
-
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, VERSION, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, createWarning, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, tlsConfigurationMessage };
|
|
5185
|
+
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, VERSION, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, createWarning, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, tlsConfigurationMessage };
|
|
5155
5186
|
//# sourceMappingURL=index.mjs.map
|
|
5156
5187
|
//# sourceMappingURL=index.mjs.map
|