werift 0.27.0 → 0.28.0
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/README.md +119 -8
- package/lib/common/src/event.d.ts +26 -0
- package/lib/common/src/event.js +87 -2
- package/lib/common/src/event.js.map +1 -1
- package/lib/common/src/network.d.ts +6 -1
- package/lib/common/src/network.js +8 -2
- package/lib/common/src/network.js.map +1 -1
- package/lib/common/src/transport.d.ts +12 -5
- package/lib/common/src/transport.js +3 -2
- package/lib/common/src/transport.js.map +1 -1
- package/lib/dtls/src/alert.d.ts +49 -0
- package/lib/dtls/src/alert.js +103 -0
- package/lib/dtls/src/alert.js.map +1 -0
- package/lib/dtls/src/client.js +15 -1
- package/lib/dtls/src/client.js.map +1 -1
- package/lib/dtls/src/context/dtls.d.ts +2 -0
- package/lib/dtls/src/context/dtls.js +7 -0
- package/lib/dtls/src/context/dtls.js.map +1 -1
- package/lib/dtls/src/context/transport.d.ts +17 -1
- package/lib/dtls/src/context/transport.js +38 -2
- package/lib/dtls/src/context/transport.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +4 -1
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.d.ts +5 -0
- package/lib/dtls/src/flight/flight.js +10 -1
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight6.js +4 -1
- package/lib/dtls/src/flight/server/flight6.js.map +1 -1
- package/lib/dtls/src/index.d.ts +3 -1
- package/lib/dtls/src/index.js +10 -1
- package/lib/dtls/src/index.js.map +1 -1
- package/lib/dtls/src/record/const.d.ts +9 -0
- package/lib/dtls/src/record/const.js +9 -1
- package/lib/dtls/src/record/const.js.map +1 -1
- package/lib/dtls/src/record/receive.d.ts +6 -0
- package/lib/dtls/src/record/receive.js +50 -19
- package/lib/dtls/src/record/receive.js.map +1 -1
- package/lib/dtls/src/server.js +19 -1
- package/lib/dtls/src/server.js.map +1 -1
- package/lib/dtls/src/socket.d.ts +134 -2
- package/lib/dtls/src/socket.js +322 -6
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/ice/src/candidateError.d.ts +155 -0
- package/lib/ice/src/candidateError.js +246 -0
- package/lib/ice/src/candidateError.js.map +1 -0
- package/lib/ice/src/candidateGatherer.d.ts +127 -0
- package/lib/ice/src/candidateGatherer.js +745 -0
- package/lib/ice/src/candidateGatherer.js.map +1 -0
- package/lib/ice/src/consent.d.ts +49 -0
- package/lib/ice/src/consent.js +258 -0
- package/lib/ice/src/consent.js.map +1 -0
- package/lib/ice/src/ice.d.ts +223 -71
- package/lib/ice/src/ice.js +873 -975
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/iceBase.d.ts +207 -8
- package/lib/ice/src/iceBase.js +94 -31
- package/lib/ice/src/iceBase.js.map +1 -1
- package/lib/ice/src/index.d.ts +1 -0
- package/lib/ice/src/index.js +1 -0
- package/lib/ice/src/index.js.map +1 -1
- package/lib/ice/src/internal/checkMessages.d.ts +41 -0
- package/lib/ice/src/internal/checkMessages.js +63 -0
- package/lib/ice/src/internal/checkMessages.js.map +1 -0
- package/lib/ice/src/internal/defaultRoute.d.ts +20 -0
- package/lib/ice/src/internal/defaultRoute.js +134 -0
- package/lib/ice/src/internal/defaultRoute.js.map +1 -0
- package/lib/ice/src/internal/hostInterfaces.d.ts +17 -0
- package/lib/ice/src/internal/hostInterfaces.js +77 -0
- package/lib/ice/src/internal/hostInterfaces.js.map +1 -0
- package/lib/ice/src/internal/hostPreference.d.ts +24 -0
- package/lib/ice/src/internal/hostPreference.js +38 -0
- package/lib/ice/src/internal/hostPreference.js.map +1 -0
- package/lib/ice/src/internal/resolveHostAddresses.d.ts +56 -8
- package/lib/ice/src/internal/resolveHostAddresses.js +127 -24
- package/lib/ice/src/internal/resolveHostAddresses.js.map +1 -1
- package/lib/ice/src/internal/selectAddresses.d.ts +27 -0
- package/lib/ice/src/internal/selectAddresses.js +37 -18
- package/lib/ice/src/internal/selectAddresses.js.map +1 -1
- package/lib/ice/src/nomination/regularNomination.d.ts +200 -0
- package/lib/ice/src/nomination/regularNomination.js +311 -0
- package/lib/ice/src/nomination/regularNomination.js.map +1 -0
- package/lib/ice/src/nomination/selectionReplacement.d.ts +138 -0
- package/lib/ice/src/nomination/selectionReplacement.js +371 -0
- package/lib/ice/src/nomination/selectionReplacement.js.map +1 -0
- package/lib/ice/src/provisional.d.ts +139 -0
- package/lib/ice/src/provisional.js +468 -0
- package/lib/ice/src/provisional.js.map +1 -0
- package/lib/ice/src/stun/protocol.d.ts +9 -2
- package/lib/ice/src/stun/protocol.js +16 -17
- package/lib/ice/src/stun/protocol.js.map +1 -1
- package/lib/ice/src/stun/tcpProtocol.d.ts +1 -1
- package/lib/ice/src/stun/tcpProtocol.js +7 -7
- package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
- package/lib/ice/src/stun/transaction.js +4 -2
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/turn/protocol.d.ts +2 -2
- package/lib/ice/src/turn/protocol.js +6 -3
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/types/model.d.ts +16 -5
- package/lib/ice/src/types/model.js.map +1 -1
- package/lib/ice-server/src/stun/attributes.js +4 -0
- package/lib/ice-server/src/stun/attributes.js.map +1 -1
- package/lib/ice-server/src/stun/const.d.ts +20 -1
- package/lib/ice-server/src/stun/const.js +9 -1
- package/lib/ice-server/src/stun/const.js.map +1 -1
- package/lib/ice-server/src/stun/message.d.ts +28 -1
- package/lib/ice-server/src/stun/message.js +102 -15
- package/lib/ice-server/src/stun/message.js.map +1 -1
- package/lib/index.mjs +13394 -7732
- package/lib/nonstandard/index.mjs +680 -286
- package/lib/polyfill/dom.mjs +19605 -14243
- package/lib/polyfill/index.mjs +19605 -14243
- package/lib/rtp/src/index.d.ts +1 -0
- package/lib/rtp/src/index.js +1 -0
- package/lib/rtp/src/index.js.map +1 -1
- package/lib/rtp/src/rtp/continuity.d.ts +14 -1
- package/lib/rtp/src/rtp/continuity.js +24 -4
- package/lib/rtp/src/rtp/continuity.js.map +1 -1
- package/lib/rtp/src/rtp/timelineRewriter.d.ts +178 -0
- package/lib/rtp/src/rtp/timelineRewriter.js +417 -0
- package/lib/rtp/src/rtp/timelineRewriter.js.map +1 -0
- package/lib/sctp/src/sctp.d.ts +5 -0
- package/lib/sctp/src/sctp.js +81 -47
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/webrtc/src/api/compatibilityOptions.d.ts +33 -0
- package/lib/webrtc/src/api/compatibilityOptions.js +33 -0
- package/lib/webrtc/src/api/compatibilityOptions.js.map +1 -0
- package/lib/webrtc/src/api/peerConfig.d.ts +348 -34
- package/lib/webrtc/src/api/peerConfig.js +90 -24
- package/lib/webrtc/src/api/peerConfig.js.map +1 -1
- package/lib/webrtc/src/api/peerConnectionEvents.d.ts +77 -1
- package/lib/webrtc/src/api/peerConnectionEvents.js +105 -1
- package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -1
- package/lib/webrtc/src/helper.d.ts +8 -0
- package/lib/webrtc/src/helper.js +40 -4
- package/lib/webrtc/src/helper.js.map +1 -1
- package/lib/webrtc/src/media/codecCompatibility.d.ts +87 -1
- package/lib/webrtc/src/media/codecCompatibility.js +338 -12
- package/lib/webrtc/src/media/codecCompatibility.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.d.ts +43 -10
- package/lib/webrtc/src/media/receiver/nack.js +245 -88
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/router.d.ts +239 -51
- package/lib/webrtc/src/media/router.js +664 -237
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/routing/pendingRoutes.d.ts +26 -0
- package/lib/webrtc/src/media/routing/pendingRoutes.js +48 -0
- package/lib/webrtc/src/media/routing/pendingRoutes.js.map +1 -0
- package/lib/webrtc/src/media/routing/ridRouting.d.ts +37 -0
- package/lib/webrtc/src/media/routing/ridRouting.js +74 -0
- package/lib/webrtc/src/media/routing/ridRouting.js.map +1 -0
- package/lib/webrtc/src/media/routing/routeTable.d.ts +60 -0
- package/lib/webrtc/src/media/routing/routeTable.js +95 -0
- package/lib/webrtc/src/media/routing/routeTable.js.map +1 -0
- package/lib/webrtc/src/media/routing/rtcpRouting.d.ts +34 -0
- package/lib/webrtc/src/media/routing/rtcpRouting.js +165 -0
- package/lib/webrtc/src/media/routing/rtcpRouting.js.map +1 -0
- package/lib/webrtc/src/media/routing/unknownSsrc.d.ts +55 -0
- package/lib/webrtc/src/media/routing/unknownSsrc.js +117 -0
- package/lib/webrtc/src/media/routing/unknownSsrc.js.map +1 -0
- package/lib/webrtc/src/media/rtpReceiver.d.ts +222 -0
- package/lib/webrtc/src/media/rtpReceiver.js +668 -28
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +7 -0
- package/lib/webrtc/src/media/rtpSender.js +9 -3
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +18 -0
- package/lib/webrtc/src/media/rtpTransceiver.js +64 -2
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderReportHistory.d.ts +51 -0
- package/lib/webrtc/src/media/sender/senderReportHistory.js +111 -0
- package/lib/webrtc/src/media/sender/senderReportHistory.js.map +1 -0
- package/lib/webrtc/src/media/sender/senderStats.d.ts +6 -5
- package/lib/webrtc/src/media/sender/senderStats.js +14 -19
- package/lib/webrtc/src/media/sender/senderStats.js.map +1 -1
- package/lib/webrtc/src/media/track.d.ts +9 -0
- package/lib/webrtc/src/media/track.js +9 -0
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +23 -6
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js +46 -22
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js.map +1 -1
- package/lib/webrtc/src/negotiation/transceiverPairing.d.ts +1 -0
- package/lib/webrtc/src/negotiation/transceiverPairing.js +62 -0
- package/lib/webrtc/src/negotiation/transceiverPairing.js.map +1 -0
- package/lib/webrtc/src/negotiation/transportActivation.d.ts +8 -1
- package/lib/webrtc/src/negotiation/transportActivation.js +21 -0
- package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -1
- package/lib/webrtc/src/negotiationTransaction.d.ts +35 -4
- package/lib/webrtc/src/negotiationTransaction.js +111 -8
- package/lib/webrtc/src/negotiationTransaction.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +65 -6
- package/lib/webrtc/src/peerConnection.js +283 -28
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/polyfill/globals.d.ts +2 -1
- package/lib/webrtc/src/polyfill/globals.js.map +1 -1
- package/lib/webrtc/src/polyfill/install.js +2 -0
- package/lib/webrtc/src/polyfill/install.js.map +1 -1
- package/lib/webrtc/src/sctpManager.js +4 -0
- package/lib/webrtc/src/sctpManager.js.map +1 -1
- package/lib/webrtc/src/sdp.d.ts +69 -0
- package/lib/webrtc/src/sdp.js +139 -14
- package/lib/webrtc/src/sdp.js.map +1 -1
- package/lib/webrtc/src/sdpManager.d.ts +85 -4
- package/lib/webrtc/src/sdpManager.js +214 -14
- package/lib/webrtc/src/sdpManager.js.map +1 -1
- package/lib/webrtc/src/secureTransportManager.d.ts +38 -1
- package/lib/webrtc/src/secureTransportManager.js +82 -7
- package/lib/webrtc/src/secureTransportManager.js.map +1 -1
- package/lib/webrtc/src/transceiverManager.d.ts +82 -4
- package/lib/webrtc/src/transceiverManager.js +231 -38
- package/lib/webrtc/src/transceiverManager.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +95 -1
- package/lib/webrtc/src/transport/dtls.js +324 -28
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +61 -4
- package/lib/webrtc/src/transport/ice.js +180 -11
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.d.ts +23 -0
- package/lib/webrtc/src/transport/sctp.js +87 -2
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +33 -0
- package/lib/webrtc/src/utils.js +52 -3
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { TransactionFailed, TransactionIntegrityViolation, TurnRedirectError } from "./exceptions";
|
|
2
|
+
import type { Address } from "./imports/common";
|
|
3
|
+
import type { Message } from "./stun/message";
|
|
4
|
+
/**
|
|
5
|
+
* One STUN/TURN server of a gathering, as configured. `urls` are the
|
|
6
|
+
* application's names for the server (`IceOptions.stunServerUrls`,
|
|
7
|
+
* `TurnServerOptions.urls`), passed through unchanged; they are metadata
|
|
8
|
+
* only and never carry a credential.
|
|
9
|
+
*/
|
|
10
|
+
export type IceServerRef = {
|
|
11
|
+
kind: "stun";
|
|
12
|
+
address: Address;
|
|
13
|
+
/** The `stunServerUrls` entries of this address, when configured. */
|
|
14
|
+
urls?: string[];
|
|
15
|
+
} | {
|
|
16
|
+
kind: "turn";
|
|
17
|
+
address: Address;
|
|
18
|
+
transport: "udp" | "tcp" | "tls";
|
|
19
|
+
/** `TurnServerOptions.urls` of the server, passed through. */
|
|
20
|
+
urls?: string[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A STUN or TURN server a gathering used could not give a candidate
|
|
24
|
+
* (`Connection.onIceCandidateError`). Reported at most once per server, local
|
|
25
|
+
* socket and generation (a 701 once per server and generation, when no
|
|
26
|
+
* socket reached it), only for the generation gathering and never after
|
|
27
|
+
* close.
|
|
28
|
+
*/
|
|
29
|
+
export type IceCandidateErrorInfo = {
|
|
30
|
+
server: IceServerRef;
|
|
31
|
+
/** Local address used to contact the server; undefined when unknown or hidden. */
|
|
32
|
+
address?: string;
|
|
33
|
+
/** Local port; undefined when `address` is. */
|
|
34
|
+
port?: number;
|
|
35
|
+
/**
|
|
36
|
+
* STUN error code (300-699) the server answered with, or
|
|
37
|
+
* {@link IceCandidateErrorCode.SERVER_NOT_REACHED} (701) when no answer
|
|
38
|
+
* came.
|
|
39
|
+
*/
|
|
40
|
+
errorCode: number;
|
|
41
|
+
/**
|
|
42
|
+
* The server's reason phrase with the credential material werift knows
|
|
43
|
+
* masked (gatherErrorReasonText; the registered phrase when it is
|
|
44
|
+
* empty), or a description of the 701 cause.
|
|
45
|
+
*/
|
|
46
|
+
errorText: string;
|
|
47
|
+
/** Gathering generation the failure belongs to. */
|
|
48
|
+
generation: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A STUN or TURN server a gathering used answered (`Connection
|
|
52
|
+
* .onIceServerReached`): a STUN query or TURN allocation gave a candidate,
|
|
53
|
+
* or the server answered with an error response (300-699). A server that
|
|
54
|
+
* answered is reachable, so `icecandidateerror` reports no 701 for it.
|
|
55
|
+
* Only for the generation gathering and never after close; a STUN server
|
|
56
|
+
* may be reported once per local socket that reached it.
|
|
57
|
+
*/
|
|
58
|
+
export type IceServerReachedInfo = {
|
|
59
|
+
server: IceServerRef;
|
|
60
|
+
/** Gathering generation the answer belongs to. */
|
|
61
|
+
generation: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Error codes of {@link IceCandidateErrorInfo} besides the STUN ones
|
|
65
|
+
* (W3C WebRTC §4.8.2: 701 when the server could not be reached).
|
|
66
|
+
* @enum
|
|
67
|
+
*/
|
|
68
|
+
export declare const IceCandidateErrorCode: {
|
|
69
|
+
readonly SERVER_NOT_REACHED: 701;
|
|
70
|
+
};
|
|
71
|
+
export type IceCandidateErrorCode = (typeof IceCandidateErrorCode)[keyof typeof IceCandidateErrorCode];
|
|
72
|
+
/**
|
|
73
|
+
* A STUN Binding success response without XOR-MAPPED-ADDRESS: the server
|
|
74
|
+
* answered but gave no server-reflexive address.
|
|
75
|
+
*/
|
|
76
|
+
export declare class MissingMappedAddressError extends Error {
|
|
77
|
+
addr: Address;
|
|
78
|
+
constructor(addr: Address);
|
|
79
|
+
}
|
|
80
|
+
/** The STUN/TURN stage of the gathering the error came from. */
|
|
81
|
+
export type GatherErrorContext = {
|
|
82
|
+
kind: "stun" | "turn";
|
|
83
|
+
/** Transport toward the server (TURN); STUN queries are UDP. */
|
|
84
|
+
transport?: "udp" | "tcp" | "tls";
|
|
85
|
+
/**
|
|
86
|
+
* Credential material the agent sent the server (a TURN username and
|
|
87
|
+
* password), masked out of the server's reason phrase (see
|
|
88
|
+
* gatherErrorReasonText).
|
|
89
|
+
*/
|
|
90
|
+
secrets?: readonly string[];
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The registered reason phrase of a STUN / TURN error `code`, or a generic
|
|
94
|
+
* one naming the code.
|
|
95
|
+
*/
|
|
96
|
+
export declare function stunErrorReasonPhrase(code: number): string;
|
|
97
|
+
/** Text that replaces credential material in a server's reason phrase. */
|
|
98
|
+
export declare const MASKED_REASON_TEXT = "***";
|
|
99
|
+
/**
|
|
100
|
+
* The `errorText` of a STUN / TURN error response (W3C: the reason text the
|
|
101
|
+
* server returned), safe to hand to the application:
|
|
102
|
+
*
|
|
103
|
+
* - every credential material werift knows is replaced by
|
|
104
|
+
* {@link MASKED_REASON_TEXT}: what it sent (`secrets`: the TURN username
|
|
105
|
+
* and password) and what the response carries (USERNAME, REALM, NONCE);
|
|
106
|
+
* - control characters are dropped and the text is cut to 127 characters
|
|
107
|
+
* (RFC 8489 §14.8);
|
|
108
|
+
* - an empty result gives the registered phrase of the code
|
|
109
|
+
* (stunErrorReasonPhrase).
|
|
110
|
+
*/
|
|
111
|
+
export declare function gatherErrorReasonText(code: number, reason: unknown, response?: Message, secrets?: readonly string[]): string;
|
|
112
|
+
/**
|
|
113
|
+
* Whether `error` means a response from the server arrived, whatever its
|
|
114
|
+
* content: an error response (with or without a valid ERROR-CODE, a
|
|
115
|
+
* challenge, a redirect that was not followed), a response that failed
|
|
116
|
+
* MESSAGE-INTEGRITY, or a success response without XOR-MAPPED-ADDRESS. A
|
|
117
|
+
* server that answered was reached, so it is never reported as 701.
|
|
118
|
+
*/
|
|
119
|
+
export declare function isServerAnswer(error: unknown): error is TransactionFailed | TransactionIntegrityViolation | TurnRedirectError | MissingMappedAddressError;
|
|
120
|
+
/**
|
|
121
|
+
* The `errorCode` / `errorText` an application is told for a failed STUN
|
|
122
|
+
* query or TURN allocation, or undefined when the failure is not reported:
|
|
123
|
+
* a transaction cancelled by close, or an answer that carries no STUN error
|
|
124
|
+
* code (an error response without a valid ERROR-CODE, a response that
|
|
125
|
+
* failed MESSAGE-INTEGRITY, a success response without
|
|
126
|
+
* XOR-MAPPED-ADDRESS). Such a server was reached (isServerAnswer), so 701
|
|
127
|
+
* does not apply (W3C: 701 only when no host candidate reaches the server),
|
|
128
|
+
* and there is no STUN error code to report.
|
|
129
|
+
*
|
|
130
|
+
* - an error response: its ERROR-CODE and the server's reason phrase with
|
|
131
|
+
* credential material masked (gatherErrorReasonText; a 300 whose redirect
|
|
132
|
+
* was not followed: 300 and why it was not followed);
|
|
133
|
+
* - no answer (timeout, DNS, address family, TCP / TLS connect, socket
|
|
134
|
+
* error): 701 and a fixed phrase naming the cause;
|
|
135
|
+
* - an answer without a STUN error code: not reported (undefined).
|
|
136
|
+
*
|
|
137
|
+
* The text never includes the username, password, realm or nonce werift
|
|
138
|
+
* knows of (they are masked).
|
|
139
|
+
*/
|
|
140
|
+
export declare function classifyGatherError(error: unknown, context: GatherErrorContext): {
|
|
141
|
+
errorCode: number;
|
|
142
|
+
errorText: string;
|
|
143
|
+
} | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Of the failures of the attempts at one TURN server (UDP, then the TCP
|
|
146
|
+
* fallback), the one to report: a STUN error code the server answered with
|
|
147
|
+
* wins over 701 (not reached); otherwise the last attempt's.
|
|
148
|
+
*/
|
|
149
|
+
export declare function pickReportedGatherError(failures: ({
|
|
150
|
+
errorCode: number;
|
|
151
|
+
errorText: string;
|
|
152
|
+
} | undefined)[]): {
|
|
153
|
+
errorCode: number;
|
|
154
|
+
errorText: string;
|
|
155
|
+
};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MASKED_REASON_TEXT = exports.MissingMappedAddressError = exports.IceCandidateErrorCode = void 0;
|
|
4
|
+
exports.stunErrorReasonPhrase = stunErrorReasonPhrase;
|
|
5
|
+
exports.gatherErrorReasonText = gatherErrorReasonText;
|
|
6
|
+
exports.isServerAnswer = isServerAnswer;
|
|
7
|
+
exports.classifyGatherError = classifyGatherError;
|
|
8
|
+
exports.pickReportedGatherError = pickReportedGatherError;
|
|
9
|
+
const exceptions_1 = require("./exceptions");
|
|
10
|
+
/**
|
|
11
|
+
* Error codes of {@link IceCandidateErrorInfo} besides the STUN ones
|
|
12
|
+
* (W3C WebRTC §4.8.2: 701 when the server could not be reached).
|
|
13
|
+
* @enum
|
|
14
|
+
*/
|
|
15
|
+
exports.IceCandidateErrorCode = {
|
|
16
|
+
SERVER_NOT_REACHED: 701,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A STUN Binding success response without XOR-MAPPED-ADDRESS: the server
|
|
20
|
+
* answered but gave no server-reflexive address.
|
|
21
|
+
*/
|
|
22
|
+
class MissingMappedAddressError extends Error {
|
|
23
|
+
constructor(addr) {
|
|
24
|
+
super(`STUN response from ${addr[0]}:${addr[1]} has no XOR-MAPPED-ADDRESS`);
|
|
25
|
+
Object.defineProperty(this, "addr", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
31
|
+
this.addr = addr;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.MissingMappedAddressError = MissingMappedAddressError;
|
|
35
|
+
const DNS_ERROR_CODES = new Set([
|
|
36
|
+
"ENOTFOUND",
|
|
37
|
+
"EAI_AGAIN",
|
|
38
|
+
"EAI_FAIL",
|
|
39
|
+
"EAI_NONAME",
|
|
40
|
+
"EAI_NODATA",
|
|
41
|
+
"ENODATA",
|
|
42
|
+
"ESERVFAIL",
|
|
43
|
+
"ENONAME",
|
|
44
|
+
"ETIMEOUT",
|
|
45
|
+
]);
|
|
46
|
+
const CONNECT_ERROR_CODES = new Set([
|
|
47
|
+
"ECONNREFUSED",
|
|
48
|
+
"ECONNRESET",
|
|
49
|
+
"ECONNABORTED",
|
|
50
|
+
"ETIMEDOUT",
|
|
51
|
+
"EPIPE",
|
|
52
|
+
]);
|
|
53
|
+
const SOCKET_ERROR_TEXTS = {
|
|
54
|
+
EHOSTUNREACH: "Host unreachable",
|
|
55
|
+
ENETUNREACH: "Network unreachable",
|
|
56
|
+
EHOSTDOWN: "Host down",
|
|
57
|
+
ENETDOWN: "Network down",
|
|
58
|
+
EADDRNOTAVAIL: "Address not available",
|
|
59
|
+
EACCES: "Permission denied",
|
|
60
|
+
EPERM: "Operation not permitted",
|
|
61
|
+
};
|
|
62
|
+
const errnoOf = (error) => {
|
|
63
|
+
const code = error?.code;
|
|
64
|
+
return typeof code === "string" ? code : undefined;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* The reason phrases of the STUN / TURN error codes (IANA "STUN Error
|
|
68
|
+
* Codes" registry: RFC 8489, 8656, 6062, 8445, 5780): the `errorText` of
|
|
69
|
+
* an error response whose own reason phrase is empty.
|
|
70
|
+
*/
|
|
71
|
+
const STUN_ERROR_REASON_PHRASES = {
|
|
72
|
+
300: "Try Alternate",
|
|
73
|
+
400: "Bad Request",
|
|
74
|
+
401: "Unauthorized",
|
|
75
|
+
403: "Forbidden",
|
|
76
|
+
405: "Mobility Forbidden",
|
|
77
|
+
420: "Unknown Attribute",
|
|
78
|
+
437: "Allocation Mismatch",
|
|
79
|
+
438: "Stale Nonce",
|
|
80
|
+
440: "Address Family not Supported",
|
|
81
|
+
441: "Wrong Credentials",
|
|
82
|
+
442: "Unsupported Transport Protocol",
|
|
83
|
+
443: "Peer Address Family Mismatch",
|
|
84
|
+
446: "Connection Already Exists",
|
|
85
|
+
447: "Connection Timeout or Failure",
|
|
86
|
+
486: "Allocation Quota Reached",
|
|
87
|
+
487: "Role Conflict",
|
|
88
|
+
500: "Server Error",
|
|
89
|
+
508: "Insufficient Capacity",
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The registered reason phrase of a STUN / TURN error `code`, or a generic
|
|
93
|
+
* one naming the code.
|
|
94
|
+
*/
|
|
95
|
+
function stunErrorReasonPhrase(code) {
|
|
96
|
+
return STUN_ERROR_REASON_PHRASES[code] ?? `STUN error ${code}`;
|
|
97
|
+
}
|
|
98
|
+
/** Text that replaces credential material in a server's reason phrase. */
|
|
99
|
+
exports.MASKED_REASON_TEXT = "***";
|
|
100
|
+
/** RFC 8489 §14.8: a reason phrase has fewer than 128 characters. */
|
|
101
|
+
const MAX_REASON_PHRASE_LENGTH = 127;
|
|
102
|
+
/**
|
|
103
|
+
* The `errorText` of a STUN / TURN error response (W3C: the reason text the
|
|
104
|
+
* server returned), safe to hand to the application:
|
|
105
|
+
*
|
|
106
|
+
* - every credential material werift knows is replaced by
|
|
107
|
+
* {@link MASKED_REASON_TEXT}: what it sent (`secrets`: the TURN username
|
|
108
|
+
* and password) and what the response carries (USERNAME, REALM, NONCE);
|
|
109
|
+
* - control characters are dropped and the text is cut to 127 characters
|
|
110
|
+
* (RFC 8489 §14.8);
|
|
111
|
+
* - an empty result gives the registered phrase of the code
|
|
112
|
+
* (stunErrorReasonPhrase).
|
|
113
|
+
*/
|
|
114
|
+
function gatherErrorReasonText(code, reason, response, secrets = []) {
|
|
115
|
+
let text = typeof reason === "string" ? reason : "";
|
|
116
|
+
const material = [
|
|
117
|
+
...secrets,
|
|
118
|
+
...["USERNAME", "REALM", "NONCE"].map((name) => {
|
|
119
|
+
const value = response?.getAttributeValue(name);
|
|
120
|
+
return Buffer.isBuffer(value) ? value.toString("utf8") : value;
|
|
121
|
+
}),
|
|
122
|
+
]
|
|
123
|
+
.filter((value) => typeof value === "string")
|
|
124
|
+
.filter((value) => value.length > 0)
|
|
125
|
+
// Longest first, so a secret containing another is masked whole.
|
|
126
|
+
.sort((a, b) => b.length - a.length);
|
|
127
|
+
for (const value of material) {
|
|
128
|
+
text = text.split(value).join(exports.MASKED_REASON_TEXT);
|
|
129
|
+
}
|
|
130
|
+
text = text
|
|
131
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: dropping them is the point
|
|
132
|
+
.replace(/[\u0000-\u001f\u007f]/g, "")
|
|
133
|
+
.trim()
|
|
134
|
+
.slice(0, MAX_REASON_PHRASE_LENGTH);
|
|
135
|
+
return text || stunErrorReasonPhrase(code);
|
|
136
|
+
}
|
|
137
|
+
const notReached = (errorText) => ({
|
|
138
|
+
errorCode: exports.IceCandidateErrorCode.SERVER_NOT_REACHED,
|
|
139
|
+
errorText,
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* Whether `error` means a response from the server arrived, whatever its
|
|
143
|
+
* content: an error response (with or without a valid ERROR-CODE, a
|
|
144
|
+
* challenge, a redirect that was not followed), a response that failed
|
|
145
|
+
* MESSAGE-INTEGRITY, or a success response without XOR-MAPPED-ADDRESS. A
|
|
146
|
+
* server that answered was reached, so it is never reported as 701.
|
|
147
|
+
*/
|
|
148
|
+
function isServerAnswer(error) {
|
|
149
|
+
return (error instanceof exceptions_1.TransactionFailed ||
|
|
150
|
+
error instanceof exceptions_1.TransactionIntegrityViolation ||
|
|
151
|
+
error instanceof MissingMappedAddressError ||
|
|
152
|
+
error instanceof exceptions_1.TurnRedirectError);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The `errorCode` / `errorText` an application is told for a failed STUN
|
|
156
|
+
* query or TURN allocation, or undefined when the failure is not reported:
|
|
157
|
+
* a transaction cancelled by close, or an answer that carries no STUN error
|
|
158
|
+
* code (an error response without a valid ERROR-CODE, a response that
|
|
159
|
+
* failed MESSAGE-INTEGRITY, a success response without
|
|
160
|
+
* XOR-MAPPED-ADDRESS). Such a server was reached (isServerAnswer), so 701
|
|
161
|
+
* does not apply (W3C: 701 only when no host candidate reaches the server),
|
|
162
|
+
* and there is no STUN error code to report.
|
|
163
|
+
*
|
|
164
|
+
* - an error response: its ERROR-CODE and the server's reason phrase with
|
|
165
|
+
* credential material masked (gatherErrorReasonText; a 300 whose redirect
|
|
166
|
+
* was not followed: 300 and why it was not followed);
|
|
167
|
+
* - no answer (timeout, DNS, address family, TCP / TLS connect, socket
|
|
168
|
+
* error): 701 and a fixed phrase naming the cause;
|
|
169
|
+
* - an answer without a STUN error code: not reported (undefined).
|
|
170
|
+
*
|
|
171
|
+
* The text never includes the username, password, realm or nonce werift
|
|
172
|
+
* knows of (they are masked).
|
|
173
|
+
*/
|
|
174
|
+
function classifyGatherError(error, context) {
|
|
175
|
+
if (error instanceof exceptions_1.TransactionCancelled)
|
|
176
|
+
return undefined;
|
|
177
|
+
if (error instanceof exceptions_1.TurnRedirectError) {
|
|
178
|
+
return { errorCode: 300, errorText: `Try Alternate (${error.reason})` };
|
|
179
|
+
}
|
|
180
|
+
if (error instanceof exceptions_1.TransactionFailed) {
|
|
181
|
+
const [code, reason] = error.response.getAttributeValue("ERROR-CODE") ?? [];
|
|
182
|
+
if (typeof code === "number" && code >= 300 && code <= 699) {
|
|
183
|
+
return {
|
|
184
|
+
errorCode: code,
|
|
185
|
+
errorText: gatherErrorReasonText(code, reason, error.response, context.secrets),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
// Answered without a valid ERROR-CODE: reached, nothing to report.
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
if (error instanceof exceptions_1.TransactionIntegrityViolation) {
|
|
192
|
+
// A response arrived (it failed MESSAGE-INTEGRITY): reached.
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
if (error instanceof exceptions_1.TransactionTimeout) {
|
|
196
|
+
return notReached(context.kind === "stun"
|
|
197
|
+
? "STUN binding request timed out"
|
|
198
|
+
: "TURN allocate request timed out");
|
|
199
|
+
}
|
|
200
|
+
if (error instanceof exceptions_1.AddressFamilyMismatch) {
|
|
201
|
+
return notReached("No address of the socket family");
|
|
202
|
+
}
|
|
203
|
+
if (error instanceof MissingMappedAddressError) {
|
|
204
|
+
// A success response without XOR-MAPPED-ADDRESS: reached.
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
const errno = errnoOf(error);
|
|
208
|
+
if (errno && DNS_ERROR_CODES.has(errno)) {
|
|
209
|
+
return notReached("Address resolution failed");
|
|
210
|
+
}
|
|
211
|
+
const stream = context.transport === "tcp" || context.transport === "tls";
|
|
212
|
+
if (stream) {
|
|
213
|
+
const message = error instanceof Error ? error.message : "";
|
|
214
|
+
if ((errno && CONNECT_ERROR_CODES.has(errno)) ||
|
|
215
|
+
/connect timed out/.test(message)) {
|
|
216
|
+
return notReached("TCP connect failed");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (errno && SOCKET_ERROR_TEXTS[errno]) {
|
|
220
|
+
return notReached(SOCKET_ERROR_TEXTS[errno]);
|
|
221
|
+
}
|
|
222
|
+
if (context.transport === "tls") {
|
|
223
|
+
return notReached("TLS handshake failed");
|
|
224
|
+
}
|
|
225
|
+
if (stream && errno) {
|
|
226
|
+
return notReached(`TCP connect failed (${errno})`);
|
|
227
|
+
}
|
|
228
|
+
if (errno && /^E[A-Z]+$/.test(errno)) {
|
|
229
|
+
return notReached(errno);
|
|
230
|
+
}
|
|
231
|
+
return notReached(context.kind === "stun"
|
|
232
|
+
? "STUN binding request failed"
|
|
233
|
+
: "TURN allocate request failed");
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Of the failures of the attempts at one TURN server (UDP, then the TCP
|
|
237
|
+
* fallback), the one to report: a STUN error code the server answered with
|
|
238
|
+
* wins over 701 (not reached); otherwise the last attempt's.
|
|
239
|
+
*/
|
|
240
|
+
function pickReportedGatherError(failures) {
|
|
241
|
+
const reported = failures.filter((failure) => failure !== undefined);
|
|
242
|
+
return ([...reported]
|
|
243
|
+
.reverse()
|
|
244
|
+
.find((failure) => failure.errorCode !== exports.IceCandidateErrorCode.SERVER_NOT_REACHED) ?? reported[reported.length - 1]);
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=candidateError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candidateError.js","sourceRoot":"","sources":["../../../../ice/src/candidateError.ts"],"names":[],"mappings":";;;AAiLA,sDAEC;AAoBD,sDA2BC;AAcD,wCAOC;AAsBD,kDA2EC;AAOD,0DAeC;AA9WD,6CAOsB;AAoEtB;;;;GAIG;AACU,QAAA,qBAAqB,GAAG;IACnC,kBAAkB,EAAE,GAAG;CACf,CAAC;AAIX;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,KAAK;IAGlD,YAAY,IAAa;QACvB,KAAK,CAAC,sBAAsB,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC;QAHvE;;;;;WAAc;QAInB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAPD,8DAOC;AAeD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,WAAW;IACX,WAAW;IACX,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,WAAW;IACX,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,cAAc;IACd,YAAY;IACZ,cAAc;IACd,WAAW;IACX,OAAO;CACR,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAA2B;IACjD,YAAY,EAAE,kBAAkB;IAChC,WAAW,EAAE,qBAAqB;IAClC,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,cAAc;IACxB,aAAa,EAAE,uBAAuB;IACtC,MAAM,EAAE,mBAAmB;I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KAAK,MAAM;QACrB,CAAC,CAAC,6BAA6B;QAC/B,CAAC,CAAC,8BAA8B,CACnC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CACrC,QAAkE;IAElE,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAC9B,CAAC,OAAO,EAAuD,EAAE,CAC/D,OAAO,KAAK,SAAS,CACxB,CAAC;IACF,OAAO,CACL,CAAC,GAAG,QAAQ,CAAC;SACV,OAAO,EAAE;SACT,IAAI,CACH,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,SAAS,KAAK,6BAAqB,CAAC,kBAAkB,CACjE,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CACrC,CAAC;AACJ,CAAC","sourcesContent":["import {\n AddressFamilyMismatch,\n TransactionCancelled,\n TransactionFailed,\n TransactionIntegrityViolation,\n TransactionTimeout,\n TurnRedirectError,\n} from \"./exceptions\";\nimport type { Address } from \"./imports/common\";\nimport type { Message } from \"./stun/message\";\n\n/**\n * One STUN/TURN server of a gathering, as configured. `urls` are the\n * application's names for the server (`IceOptions.stunServerUrls`,\n * `TurnServerOptions.urls`), passed through unchanged; they are metadata\n * only and never carry a credential.\n */\nexport type IceServerRef =\n | {\n kind: \"stun\";\n address: Address;\n /** The `stunServerUrls` entries of this address, when configured. */\n urls?: string[];\n }\n | {\n kind: \"turn\";\n address: Address;\n transport: \"udp\" | \"tcp\" | \"tls\";\n /** `TurnServerOptions.urls` of the server, passed through. */\n urls?: string[];\n };\n\n/**\n * A STUN or TURN server a gathering used could not give a candidate\n * (`Connection.onIceCandidateError`). Reported at most once per server, local\n * socket and generation (a 701 once per server and generation, when no\n * socket reached it), only for the generation gathering and never after\n * close.\n */\nexport type IceCandidateErrorInfo = {\n server: IceServerRef;\n /** Local address used to contact the server; undefined when unknown or hidden. */\n address?: string;\n /** Local port; undefined when `address` is. */\n port?: number;\n /**\n * STUN error code (300-699) the server answered with, or\n * {@link IceCandidateErrorCode.SERVER_NOT_REACHED} (701) when no answer\n * came.\n */\n errorCode: number;\n /**\n * The server's reason phrase with the credential material werift knows\n * masked (gatherErrorReasonText; the registered phrase when it is\n * empty), or a description of the 701 cause.\n */\n errorText: string;\n /** Gathering generation the failure belongs to. */\n generation: number;\n};\n\n/**\n * A STUN or TURN server a gathering used answered (`Connection\n * .onIceServerReached`): a STUN query or TURN allocation gave a candidate,\n * or the server answered with an error response (300-699). A server that\n * answered is reachable, so `icecandidateerror` reports no 701 for it.\n * Only for the generation gathering and never after close; a STUN server\n * may be reported once per local socket that reached it.\n */\nexport type IceServerReachedInfo = {\n server: IceServerRef;\n /** Gathering generation the answer belongs to. */\n generation: number;\n};\n\n/**\n * Error codes of {@link IceCandidateErrorInfo} besides the STUN ones\n * (W3C WebRTC §4.8.2: 701 when the server could not be reached).\n * @enum\n */\nexport const IceCandidateErrorCode = {\n SERVER_NOT_REACHED: 701,\n} as const;\nexport type IceCandidateErrorCode =\n (typeof IceCandidateErrorCode)[keyof typeof IceCandidateErrorCode];\n\n/**\n * A STUN Binding success response without XOR-MAPPED-ADDRESS: the server\n * answered but gave no server-reflexive address.\n */\nexport class MissingMappedAddressError extends Error {\n public addr: Address;\n\n constructor(addr: Address) {\n super(`STUN response from ${addr[0]}:${addr[1]} has no XOR-MAPPED-ADDRESS`);\n this.addr = addr;\n }\n}\n\n/** The STUN/TURN stage of the gathering the error came from. */\nexport type GatherErrorContext = {\n kind: \"stun\" | \"turn\";\n /** Transport toward the server (TURN); STUN queries are UDP. */\n transport?: \"udp\" | \"tcp\" | \"tls\";\n /**\n * Credential material the agent sent the server (a TURN username and\n * password), masked out of the server's reason phrase (see\n * gatherErrorReasonText).\n */\n secrets?: readonly string[];\n};\n\nconst DNS_ERROR_CODES = new Set([\n \"ENOTFOUND\",\n \"EAI_AGAIN\",\n \"EAI_FAIL\",\n \"EAI_NONAME\",\n \"EAI_NODATA\",\n \"ENODATA\",\n \"ESERVFAIL\",\n \"ENONAME\",\n \"ETIMEOUT\",\n]);\n\nconst CONNECT_ERROR_CODES = new Set([\n \"ECONNREFUSED\",\n \"ECONNRESET\",\n \"ECONNABORTED\",\n \"ETIMEDOUT\",\n \"EPIPE\",\n]);\n\nconst SOCKET_ERROR_TEXTS: Record<string, string> = {\n EHOSTUNREACH: \"Host unreachable\",\n ENETUNREACH: \"Network unreachable\",\n EHOSTDOWN: \"Host down\",\n ENETDOWN: \"Network down\",\n EADDRNOTAVAIL: \"Address not available\",\n EACCES: \"Permission denied\",\n EPERM: \"Operation not permitted\",\n};\n\nconst errnoOf = (error: unknown): string | undefined => {\n const code = (error as { code?: unknown } | undefined)?.code;\n return typeof code === \"string\" ? code : undefined;\n};\n\n/**\n * The reason phrases of the STUN / TURN error codes (IANA \"STUN Error\n * Codes\" registry: RFC 8489, 8656, 6062, 8445, 5780): the `errorText` of\n * an error response whose own reason phrase is empty.\n */\nconst STUN_ERROR_REASON_PHRASES: Readonly<Record<number, string>> = {\n 300: \"Try Alternate\",\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 405: \"Mobility Forbidden\",\n 420: \"Unknown Attribute\",\n 437: \"Allocation Mismatch\",\n 438: \"Stale Nonce\",\n 440: \"Address Family not Supported\",\n 441: \"Wrong Credentials\",\n 442: \"Unsupported Transport Protocol\",\n 443: \"Peer Address Family Mismatch\",\n 446: \"Connection Already Exists\",\n 447: \"Connection Timeout or Failure\",\n 486: \"Allocation Quota Reached\",\n 487: \"Role Conflict\",\n 500: \"Server Error\",\n 508: \"Insufficient Capacity\",\n};\n\n/**\n * The registered reason phrase of a STUN / TURN error `code`, or a generic\n * one naming the code.\n */\nexport function stunErrorReasonPhrase(code: number) {\n return STUN_ERROR_REASON_PHRASES[code] ?? `STUN error ${code}`;\n}\n\n/** Text that replaces credential material in a server's reason phrase. */\nexport const MASKED_REASON_TEXT = \"***\";\n\n/** RFC 8489 §14.8: a reason phrase has fewer than 128 characters. */\nconst MAX_REASON_PHRASE_LENGTH = 127;\n\n/**\n * The `errorText` of a STUN / TURN error response (W3C: the reason text the\n * server returned), safe to hand to the application:\n *\n * - every credential material werift knows is replaced by\n * {@link MASKED_REASON_TEXT}: what it sent (`secrets`: the TURN username\n * and password) and what the response carries (USERNAME, REALM, NONCE);\n * - control characters are dropped and the text is cut to 127 characters\n * (RFC 8489 §14.8);\n * - an empty result gives the registered phrase of the code\n * (stunErrorReasonPhrase).\n */\nexport function gatherErrorReasonText(\n code: number,\n reason: unknown,\n response?: Message,\n secrets: readonly string[] = [],\n) {\n let text = typeof reason === \"string\" ? reason : \"\";\n const material = [\n ...secrets,\n ...([\"USERNAME\", \"REALM\", \"NONCE\"] as const).map((name) => {\n const value = response?.getAttributeValue(name);\n return Buffer.isBuffer(value) ? value.toString(\"utf8\") : value;\n }),\n ]\n .filter((value): value is string => typeof value === \"string\")\n .filter((value) => value.length > 0)\n // Longest first, so a secret containing another is masked whole.\n .sort((a, b) => b.length - a.length);\n for (const value of material) {\n text = text.split(value).join(MASKED_REASON_TEXT);\n }\n text = text\n // biome-ignore lint/suspicious/noControlCharactersInRegex: dropping them is the point\n .replace(/[\\u0000-\\u001f\\u007f]/g, \"\")\n .trim()\n .slice(0, MAX_REASON_PHRASE_LENGTH);\n return text || stunErrorReasonPhrase(code);\n}\n\nconst notReached = (errorText: string) => ({\n errorCode: IceCandidateErrorCode.SERVER_NOT_REACHED,\n errorText,\n});\n\n/**\n * Whether `error` means a response from the server arrived, whatever its\n * content: an error response (with or without a valid ERROR-CODE, a\n * challenge, a redirect that was not followed), a response that failed\n * MESSAGE-INTEGRITY, or a success response without XOR-MAPPED-ADDRESS. A\n * server that answered was reached, so it is never reported as 701.\n */\nexport function isServerAnswer(error: unknown) {\n return (\n error instanceof TransactionFailed ||\n error instanceof TransactionIntegrityViolation ||\n error instanceof MissingMappedAddressError ||\n error instanceof TurnRedirectError\n );\n}\n\n/**\n * The `errorCode` / `errorText` an application is told for a failed STUN\n * query or TURN allocation, or undefined when the failure is not reported:\n * a transaction cancelled by close, or an answer that carries no STUN error\n * code (an error response without a valid ERROR-CODE, a response that\n * failed MESSAGE-INTEGRITY, a success response without\n * XOR-MAPPED-ADDRESS). Such a server was reached (isServerAnswer), so 701\n * does not apply (W3C: 701 only when no host candidate reaches the server),\n * and there is no STUN error code to report.\n *\n * - an error response: its ERROR-CODE and the server's reason phrase with\n * credential material masked (gatherErrorReasonText; a 300 whose redirect\n * was not followed: 300 and why it was not followed);\n * - no answer (timeout, DNS, address family, TCP / TLS connect, socket\n * error): 701 and a fixed phrase naming the cause;\n * - an answer without a STUN error code: not reported (undefined).\n *\n * The text never includes the username, password, realm or nonce werift\n * knows of (they are masked).\n */\nexport function classifyGatherError(\n error: unknown,\n context: GatherErrorContext,\n): { errorCode: number; errorText: string } | undefined {\n if (error instanceof TransactionCancelled) return undefined;\n\n if (error instanceof TurnRedirectError) {\n return { errorCode: 300, errorText: `Try Alternate (${error.reason})` };\n }\n if (error instanceof TransactionFailed) {\n const [code, reason] = error.response.getAttributeValue(\"ERROR-CODE\") ?? [];\n if (typeof code === \"number\" && code >= 300 && code <= 699) {\n return {\n errorCode: code,\n errorText: gatherErrorReasonText(\n code,\n reason,\n error.response,\n context.secrets,\n ),\n };\n }\n // Answered without a valid ERROR-CODE: reached, nothing to report.\n return undefined;\n }\n if (error instanceof TransactionIntegrityViolation) {\n // A response arrived (it failed MESSAGE-INTEGRITY): reached.\n return undefined;\n }\n if (error instanceof TransactionTimeout) {\n return notReached(\n context.kind === \"stun\"\n ? \"STUN binding request timed out\"\n : \"TURN allocate request timed out\",\n );\n }\n if (error instanceof AddressFamilyMismatch) {\n return notReached(\"No address of the socket family\");\n }\n if (error instanceof MissingMappedAddressError) {\n // A success response without XOR-MAPPED-ADDRESS: reached.\n return undefined;\n }\n\n const errno = errnoOf(error);\n if (errno && DNS_ERROR_CODES.has(errno)) {\n return notReached(\"Address resolution failed\");\n }\n const stream = context.transport === \"tcp\" || context.transport === \"tls\";\n if (stream) {\n const message = error instanceof Error ? error.message : \"\";\n if (\n (errno && CONNECT_ERROR_CODES.has(errno)) ||\n /connect timed out/.test(message)\n ) {\n return notReached(\"TCP connect failed\");\n }\n }\n if (errno && SOCKET_ERROR_TEXTS[errno]) {\n return notReached(SOCKET_ERROR_TEXTS[errno]);\n }\n if (context.transport === \"tls\") {\n return notReached(\"TLS handshake failed\");\n }\n if (stream && errno) {\n return notReached(`TCP connect failed (${errno})`);\n }\n if (errno && /^E[A-Z]+$/.test(errno)) {\n return notReached(errno);\n }\n return notReached(\n context.kind === \"stun\"\n ? \"STUN binding request failed\"\n : \"TURN allocate request failed\",\n );\n}\n\n/**\n * Of the failures of the attempts at one TURN server (UDP, then the TCP\n * fallback), the one to report: a STUN error code the server answered with\n * wins over 701 (not reached); otherwise the last attempt's.\n */\nexport function pickReportedGatherError(\n failures: ({ errorCode: number; errorText: string } | undefined)[],\n) {\n const reported = failures.filter(\n (failure): failure is { errorCode: number; errorText: string } =>\n failure !== undefined,\n );\n return (\n [...reported]\n .reverse()\n .find(\n (failure) =>\n failure.errorCode !== IceCandidateErrorCode.SERVER_NOT_REACHED,\n ) ?? reported[reported.length - 1]\n );\n}\n"]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Candidate } from "./candidate";
|
|
2
|
+
import { type IceServerRef } from "./candidateError";
|
|
3
|
+
import { type IceOptions, type NormalizedTurnServer, type StunServerUrl } from "./iceBase";
|
|
4
|
+
import { type Address } from "./imports/common";
|
|
5
|
+
import { type HostAddress } from "./internal/resolveHostAddresses";
|
|
6
|
+
import { StunProtocol } from "./stun/protocol";
|
|
7
|
+
import type { Protocol } from "./types/model";
|
|
8
|
+
/** A failed STUN query / TURN allocation (see `Connection.onIceCandidateError`). */
|
|
9
|
+
type GatherFailure = {
|
|
10
|
+
errorCode: number;
|
|
11
|
+
errorText: string;
|
|
12
|
+
};
|
|
13
|
+
/** What the agent supplies to its `CandidateGatherer`. */
|
|
14
|
+
export type GatherHost = {
|
|
15
|
+
options: () => IceOptions;
|
|
16
|
+
iceLite: () => boolean;
|
|
17
|
+
/** The local generation the candidates belong to (read when each is made). */
|
|
18
|
+
generation: () => number;
|
|
19
|
+
localUsername: () => string;
|
|
20
|
+
/** The agent's sockets and TURN allocations; new ones are pushed to it. */
|
|
21
|
+
protocols: () => Protocol[];
|
|
22
|
+
stunServers: () => Address[];
|
|
23
|
+
turnServers: () => NormalizedTurnServer[];
|
|
24
|
+
/**
|
|
25
|
+
* The built-in default STUN server and the URL it is reported by, when
|
|
26
|
+
* no STUN server is configured (see `DEFAULT_STUN_SERVER_URL`).
|
|
27
|
+
*/
|
|
28
|
+
defaultStunServer: () => StunServerUrl | undefined;
|
|
29
|
+
/** `generation` is still being gathered (no restart replaced it, the agent is open). */
|
|
30
|
+
isGathering: (generation: number) => boolean;
|
|
31
|
+
/** Aborted by close(): a TURN allocation still running is released. */
|
|
32
|
+
closing: () => AbortSignal;
|
|
33
|
+
/** Listen to the socket's checks and data. */
|
|
34
|
+
ensureProtocol: (protocol: Protocol) => void;
|
|
35
|
+
/** Pair a socket gathered after the remote candidates arrived. */
|
|
36
|
+
pairLocalProtocol: (protocol: Protocol) => void;
|
|
37
|
+
/** Report a local candidate. */
|
|
38
|
+
appendLocalCandidate: (candidate: Candidate) => void;
|
|
39
|
+
/** Report a failed STUN query / TURN allocation (`onIceCandidateError`). */
|
|
40
|
+
emitCandidateError: (stale: () => boolean, generation: number, server: IceServerRef, failure: GatherFailure | undefined, local?: {
|
|
41
|
+
address: string;
|
|
42
|
+
port: number;
|
|
43
|
+
}) => void;
|
|
44
|
+
/** Report a STUN / TURN server that answered (`onIceServerReached`). */
|
|
45
|
+
emitServerReached: (stale: () => boolean, generation: number, server: IceServerRef) => void;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Candidate gathering of one agent (RFC 8445 §5.1.1): a UDP socket per host
|
|
49
|
+
* address (kept across ICE restarts), TCP passive / active candidates
|
|
50
|
+
* (RFC 6544), server-reflexive candidates from every STUN server (through
|
|
51
|
+
* the host sockets and, in default mode, a wildcard socket per family), and
|
|
52
|
+
* a relay candidate from every TURN server. Failed STUN / TURN servers are
|
|
53
|
+
* reported through the host (`emitCandidateError`).
|
|
54
|
+
*/
|
|
55
|
+
export declare class CandidateGatherer {
|
|
56
|
+
/**
|
|
57
|
+
* Server-reflexive candidates each UDP socket advertised in its last
|
|
58
|
+
* gathering (one per distinct mapping its STUN servers returned).
|
|
59
|
+
*/
|
|
60
|
+
readonly reflexiveBySocket: WeakMap<Protocol, Candidate[]>;
|
|
61
|
+
/**
|
|
62
|
+
* The wildcard UDP socket of each family (default mode with a STUN server).
|
|
63
|
+
* It advertises no host candidate; its first server-reflexive candidate is
|
|
64
|
+
* its local candidate. Kept across ICE restarts like the host sockets.
|
|
65
|
+
*/
|
|
66
|
+
readonly wildcardProtocols: Map<4 | 6, StunProtocol>;
|
|
67
|
+
private readonly host;
|
|
68
|
+
constructor(host: GatherHost);
|
|
69
|
+
/**
|
|
70
|
+
* The gathering work of one generation.
|
|
71
|
+
*
|
|
72
|
+
* - `primary`: what gathering waits for. The host sockets, the TURN
|
|
73
|
+
* allocations and the server-reflexive queries of the representative
|
|
74
|
+
* sockets: the wildcard socket of each family and the host socket of
|
|
75
|
+
* the default-route address (every host socket when the family has
|
|
76
|
+
* neither).
|
|
77
|
+
* - `background`: the server-reflexive queries of the other host sockets,
|
|
78
|
+
* complete once `primary` has settled. Their candidates trickle after
|
|
79
|
+
* gathering returns; end-of-candidates (`localCandidatesEnd`) waits for
|
|
80
|
+
* them. A network interface whose address cannot reach the STUN server
|
|
81
|
+
* so no longer delays gathering.
|
|
82
|
+
*/
|
|
83
|
+
candidatePromises(hostAddresses: HostAddress[], timeout?: number, generation?: number, defaultRoutes?: Promise<string[]>): {
|
|
84
|
+
primary: Promise<unknown>[];
|
|
85
|
+
background: {
|
|
86
|
+
query: Promise<unknown>;
|
|
87
|
+
settled: boolean;
|
|
88
|
+
}[];
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Open the wildcard socket of `family` and query the STUN servers from it.
|
|
92
|
+
* Its first server-reflexive candidate becomes the socket's local
|
|
93
|
+
* candidate: the socket joins the agent and pairs with the remote
|
|
94
|
+
* candidates (its checks leave through the NAT mapping it advertised).
|
|
95
|
+
* A socket that maps nothing is closed.
|
|
96
|
+
*/
|
|
97
|
+
private gatherWildcardReflexive;
|
|
98
|
+
/** Whether `protocol` is a wildcard socket (advertises no host candidate). */
|
|
99
|
+
isWildcardProtocol(protocol: Protocol): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Whether the wildcard socket should check `remoteCandidate`: only a path
|
|
102
|
+
* no host socket covers. When the OS routes to the remote address from an
|
|
103
|
+
* address a UDP host socket is bound to, that socket checks the same path
|
|
104
|
+
* (through a NAT as its own server-reflexive address), while the wildcard
|
|
105
|
+
* socket's packets would leave from an address it does not advertise and
|
|
106
|
+
* make the peer learn a peer-reflexive candidate. Without a route the
|
|
107
|
+
* socket cannot reach the address either.
|
|
108
|
+
*/
|
|
109
|
+
wildcardPathUncovered(remoteCandidate: Candidate): Promise<boolean>;
|
|
110
|
+
/** The base of a wildcard socket's server-reflexive candidates. */
|
|
111
|
+
private wildcardBaseOf;
|
|
112
|
+
/**
|
|
113
|
+
* The STUN servers a socket (or the wildcard socket of a family) queries:
|
|
114
|
+
* every server for IPv4 (as the IPv4 host sockets always did), only the
|
|
115
|
+
* IPv6 literal servers for the IPv6 wildcard socket.
|
|
116
|
+
*/
|
|
117
|
+
private reflexiveServersOf;
|
|
118
|
+
/**
|
|
119
|
+
* Allocate on one TURN server and add its relay candidate. A UDP
|
|
120
|
+
* allocation that fails falls back to TCP on the same server. An
|
|
121
|
+
* allocation that completes for a replaced generation (or a closed agent)
|
|
122
|
+
* is released. A failed allocation (both attempts, for the fallback) is
|
|
123
|
+
* reported once (onIceCandidateError) before it rejects.
|
|
124
|
+
*/
|
|
125
|
+
private gatherRelayCandidate;
|
|
126
|
+
}
|
|
127
|
+
export {};
|