@mark1russell7/netdiag 0.1.0 → 0.1.1
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 +153 -1
- package/build/address.d.ts +56 -0
- package/build/address.d.ts.map +1 -0
- package/build/address.js +172 -0
- package/build/address.js.map +1 -0
- package/build/{diagnosis-BTa-Dfwl.js → diagnosis-a4hRzFxp.js} +113 -11
- package/build/diagnosis-a4hRzFxp.js.map +1 -0
- package/build/diagnosis.d.ts +3 -2
- package/build/diagnosis.js +1 -1
- package/build/{index-CP1hzELI.d.ts → index-K2dGiYxW.d.ts} +83 -22
- package/build/index-K2dGiYxW.d.ts.map +1 -0
- package/build/index.d.ts +253 -148
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1084 -161
- package/build/index.js.map +1 -1
- package/build/kinds-CQv769lK.js +341 -0
- package/build/kinds-CQv769lK.js.map +1 -0
- package/build/kinds-_NShfZpU.d.ts +377 -0
- package/build/kinds-_NShfZpU.d.ts.map +1 -0
- package/build/layer-BNg0VYuK.d.ts +22 -0
- package/build/layer-BNg0VYuK.d.ts.map +1 -0
- package/build/tools.d.ts +206 -0
- package/build/tools.d.ts.map +1 -0
- package/build/tools.js +896 -0
- package/build/tools.js.map +1 -0
- package/package.json +17 -5
- package/src/address/index.ts +155 -0
- package/src/diagnosis/catalog.ts +8 -8
- package/src/diagnosis/index.ts +13 -0
- package/src/diagnosis/score.ts +160 -0
- package/src/index.ts +35 -0
- package/src/kinds.ts +460 -0
- package/src/probes/native.ts +354 -0
- package/src/probes/socket.ts +520 -0
- package/src/readers.ts +367 -0
- package/src/scope.ts +5 -24
- package/src/tools/common.ts +47 -0
- package/src/tools/host.ts +91 -0
- package/src/tools/index.ts +38 -0
- package/src/tools/licenses.ts +37 -0
- package/src/tools/mtr.ts +156 -0
- package/src/tools/ping.ts +231 -0
- package/src/tools/traceroute.ts +313 -0
- package/build/diagnosis-BTa-Dfwl.js.map +0 -1
- package/build/index-CP1hzELI.d.ts.map +0 -1
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { n as Layer } from "./layer-BNg0VYuK.js";
|
|
2
|
+
import { Result } from "@mark1russell7/optional";
|
|
3
|
+
import { Clock } from "@mark1russell7/algebra/clock";
|
|
4
|
+
/** The kind of the host of a target: a DNS name, an IPv4 address or an IPv6 address. */
|
|
5
|
+
type HostKind = "name" | "ipv4" | "ipv6";
|
|
6
|
+
/**
|
|
7
|
+
* A host that a probe examines, and an optional port.
|
|
8
|
+
*
|
|
9
|
+
* The host is in its canonical form: lower case, with no final dot and no brackets around an IPv6 address.
|
|
10
|
+
*/
|
|
11
|
+
interface Target {
|
|
12
|
+
readonly host: string;
|
|
13
|
+
readonly kind: HostKind;
|
|
14
|
+
readonly port?: number | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** This function gives the kind of a host in its canonical form. */
|
|
17
|
+
declare function hostKind(host: string): HostKind;
|
|
18
|
+
/** This function gives the canonical form of a host: lower case, with no final dot and no brackets. */
|
|
19
|
+
declare function canonicalHost(host: string): string;
|
|
20
|
+
/** This function makes a target from a host and an optional port. */
|
|
21
|
+
declare function target(host: string, port?: number): Target;
|
|
22
|
+
/** This function gives the text of a target: `host`, `host:port`, or `[address]:port` for an IPv6 address. */
|
|
23
|
+
declare function formatTarget(t: Target): string;
|
|
24
|
+
/** This function tells if two targets have the same host and the same port. */
|
|
25
|
+
declare function sameTarget(a: Target, b: Target): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* This function reads a target from the text that a user gives.
|
|
28
|
+
*
|
|
29
|
+
* It accepts a URL (`https://example.com/a`), a host (`example.com`) and a host with a port (`example.com:8443`).
|
|
30
|
+
* It also accepts an IPv4 address, and an IPv6 address in brackets with a port (`[2001:db8::1]:443`).
|
|
31
|
+
* A URL with a known scheme and no port gets the port of its scheme.
|
|
32
|
+
*/
|
|
33
|
+
declare function parseTarget(text: string): Result<Target, string>;
|
|
34
|
+
/**
|
|
35
|
+
* The time of a fact, in milliseconds on the monotonic clock of the runner.
|
|
36
|
+
*
|
|
37
|
+
* The field `origin` of the runner gives the wall-clock time of one monotonic time. Thus each fact time has a wall-clock time.
|
|
38
|
+
*/
|
|
39
|
+
interface FactTime {
|
|
40
|
+
readonly start: number;
|
|
41
|
+
readonly end: number;
|
|
42
|
+
}
|
|
43
|
+
/** The source of a fact: the probe and its version, and the outside tool when the probe starts one. */
|
|
44
|
+
interface FactSource {
|
|
45
|
+
readonly probe: string;
|
|
46
|
+
readonly version: string;
|
|
47
|
+
readonly tool?: string | undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A typed fact of one layer of the network stack.
|
|
51
|
+
*
|
|
52
|
+
* A fact has a layer, a time, a source and a value. Its kind names the type of its value, for example `tcp.connect`.
|
|
53
|
+
* The subject is the target of the fact. A fact is plain data, so a record of facts is JSON.
|
|
54
|
+
*/
|
|
55
|
+
interface Fact<V = unknown> {
|
|
56
|
+
/** The id is unique in the facts of one runner, for example `f12`. */
|
|
57
|
+
readonly id: string;
|
|
58
|
+
readonly kind: string;
|
|
59
|
+
readonly layer: Layer;
|
|
60
|
+
readonly subject: Target;
|
|
61
|
+
readonly time: FactTime;
|
|
62
|
+
readonly source: FactSource;
|
|
63
|
+
readonly value: V;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The definition of a kind of fact: its name, its layer and the check of its value.
|
|
67
|
+
*
|
|
68
|
+
* The check is the contract of the value. The runner refuses a value that does not pass it, thus each fact of a kind has a
|
|
69
|
+
* value of the type `V`.
|
|
70
|
+
*/
|
|
71
|
+
interface FactKind<V> {
|
|
72
|
+
readonly kind: string;
|
|
73
|
+
readonly layer: Layer;
|
|
74
|
+
readonly summary: string;
|
|
75
|
+
readonly check: (value: unknown) => value is V;
|
|
76
|
+
}
|
|
77
|
+
/** The value type of a fact kind. */
|
|
78
|
+
type ValueOf<K> = K extends FactKind<infer V> ? V : never;
|
|
79
|
+
/** This function makes a fact kind. The name has lower-case words with dots, for example `tls.handshake`. */
|
|
80
|
+
declare function defineFactKind<V>(spec: FactKind<V>): FactKind<V>;
|
|
81
|
+
/** This function tells if a fact is of a kind, and if its value passes the check of the kind. */
|
|
82
|
+
declare function isFactOf<V>(kind: FactKind<V>, fact: Fact): fact is Fact<V>;
|
|
83
|
+
/** This function gives the facts of one kind, in their order. */
|
|
84
|
+
declare function factsOf<V>(kind: FactKind<V>, facts: readonly Fact[]): Fact<V>[];
|
|
85
|
+
/**
|
|
86
|
+
* An observation is a fact that a probe parsed, before the runner gives it an id, a layer and a source.
|
|
87
|
+
*
|
|
88
|
+
* The time is optional. Without a time, the fact gets the time of the run of the probe.
|
|
89
|
+
*/
|
|
90
|
+
interface Observation<V = unknown> {
|
|
91
|
+
readonly kind: FactKind<V>;
|
|
92
|
+
readonly subject: Target;
|
|
93
|
+
readonly value: V;
|
|
94
|
+
readonly time?: FactTime | undefined;
|
|
95
|
+
}
|
|
96
|
+
/** This function makes an observation with a type check of its value against its kind. */
|
|
97
|
+
declare function observe<V>(kind: FactKind<V>, subject: Target, value: V, time?: FactTime): Observation<V>;
|
|
98
|
+
/**
|
|
99
|
+
* The mode of a probe.
|
|
100
|
+
*
|
|
101
|
+
* - `active`: the probe sends packets to its peers, for example a TCP connect.
|
|
102
|
+
* - `passive`: the probe reads only the state of this computer, for example its routes. It has no peers.
|
|
103
|
+
*/
|
|
104
|
+
type ProbeMode = "active" | "passive";
|
|
105
|
+
/** The context of a run: the clock of the runner, and the signal that stops the run. */
|
|
106
|
+
interface ProbeContext {
|
|
107
|
+
readonly clock: Clock;
|
|
108
|
+
readonly signal: AbortSignal;
|
|
109
|
+
}
|
|
110
|
+
/** The availability of a probe on this computer. An unavailable probe tells why, for example a tool that is not installed. */
|
|
111
|
+
type Availability = {
|
|
112
|
+
readonly available: true;
|
|
113
|
+
readonly version?: string | undefined;
|
|
114
|
+
} | {
|
|
115
|
+
readonly available: false;
|
|
116
|
+
readonly reason: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* The contract of a probe. A probe is an adapter: it tells if it is available, it does its work, and it parses its raw output into
|
|
120
|
+
* observations.
|
|
121
|
+
*
|
|
122
|
+
* - `peers` gives each host that `run` sends packets to. A passive probe gives no peers. The runner examines each peer
|
|
123
|
+
* against the scope before `run` starts.
|
|
124
|
+
* - `run` does the effects and gives the raw output. A network failure is an observation, not an error. For example, a
|
|
125
|
+
* TCP connect that times out gives the outcome `timeout`. `run` throws only for a fault of the probe.
|
|
126
|
+
* - `parse` is a pure function of the raw output and the input. Thus a record of a raw output gives the same facts again,
|
|
127
|
+
* also after a correction of the parser.
|
|
128
|
+
*
|
|
129
|
+
* The input and the raw output are plain JSON data, so a record can keep them.
|
|
130
|
+
*/
|
|
131
|
+
interface Probe<I, R> {
|
|
132
|
+
/** The id has lower-case words with dots, for example `tcp.connect`. */
|
|
133
|
+
readonly id: string;
|
|
134
|
+
/** The version of the probe changes when its facts change. */
|
|
135
|
+
readonly version: string;
|
|
136
|
+
readonly summary: string;
|
|
137
|
+
readonly layer: Layer;
|
|
138
|
+
readonly mode: ProbeMode;
|
|
139
|
+
/** The kinds of the facts that the probe gives. The runner refuses an observation of a different kind. */
|
|
140
|
+
readonly kinds: readonly FactKind<unknown>[];
|
|
141
|
+
/** The outside tool that the probe starts, for example `ping`. A native probe has no tool. */
|
|
142
|
+
readonly tool?: string | undefined;
|
|
143
|
+
peers(input: I): readonly Target[];
|
|
144
|
+
available(context: ProbeContext): Promise<Availability>;
|
|
145
|
+
run(input: I, context: ProbeContext): Promise<R>;
|
|
146
|
+
parse(raw: R, input: I): readonly Observation[];
|
|
147
|
+
}
|
|
148
|
+
/** This function makes a probe, and examines its fields. */
|
|
149
|
+
declare function defineProbe<I, R>(probe: Probe<I, R>): Probe<I, R>;
|
|
150
|
+
/** The outcomes of a DNS query. `nodata` tells that the name exists, but it has no record of the type. */
|
|
151
|
+
declare const DNS_OUTCOMES: readonly ["ok", "nodata", "nxdomain", "servfail", "refused", "timeout", "unreachable", "error"];
|
|
152
|
+
type DnsOutcome = (typeof DNS_OUTCOMES)[number];
|
|
153
|
+
/** The record types of a DNS query for addresses. */
|
|
154
|
+
declare const RECORD_TYPES: readonly ["A", "AAAA"];
|
|
155
|
+
type RecordType = (typeof RECORD_TYPES)[number];
|
|
156
|
+
/** The answer of a DNS resolver to one query. */
|
|
157
|
+
interface DnsAnswer {
|
|
158
|
+
readonly name: string;
|
|
159
|
+
readonly record: RecordType;
|
|
160
|
+
/** The resolver, as `address:port`. */
|
|
161
|
+
readonly resolver: string;
|
|
162
|
+
readonly outcome: DnsOutcome;
|
|
163
|
+
readonly addresses: readonly string[];
|
|
164
|
+
/** The lowest TTL of the records, in seconds. */
|
|
165
|
+
readonly ttl?: number | undefined;
|
|
166
|
+
/** The time from the query to the answer or to the failure, in milliseconds. */
|
|
167
|
+
readonly ms: number;
|
|
168
|
+
/** The error code of the platform for a failure, for example `ENOTFOUND`. */
|
|
169
|
+
readonly code?: string | undefined;
|
|
170
|
+
}
|
|
171
|
+
/** The fact kind `dns.answer`. */
|
|
172
|
+
declare const DNS_ANSWER: FactKind<DnsAnswer>;
|
|
173
|
+
/** The outcomes of a TCP connect. */
|
|
174
|
+
declare const CONNECT_OUTCOMES: readonly ["connected", "refused", "timeout", "unreachable", "reset", "error"];
|
|
175
|
+
type ConnectOutcome = (typeof CONNECT_OUTCOMES)[number];
|
|
176
|
+
/** The outcome of one TCP connect. */
|
|
177
|
+
interface TcpConnect {
|
|
178
|
+
readonly address: string;
|
|
179
|
+
readonly port: number;
|
|
180
|
+
readonly family: 4 | 6;
|
|
181
|
+
readonly outcome: ConnectOutcome;
|
|
182
|
+
/** The time from the start of the connect to the connection or to the failure, in milliseconds. */
|
|
183
|
+
readonly ms: number;
|
|
184
|
+
readonly code?: string | undefined;
|
|
185
|
+
}
|
|
186
|
+
/** The fact kind `tcp.connect`. */
|
|
187
|
+
declare const TCP_CONNECT: FactKind<TcpConnect>;
|
|
188
|
+
/**
|
|
189
|
+
* The outcomes of a TLS handshake.
|
|
190
|
+
*
|
|
191
|
+
* - `cert-error`: the handshake ended, but the certificate is not valid for the name.
|
|
192
|
+
* - `alert`: the client and the server stopped the handshake, for example because they have no version in common.
|
|
193
|
+
* - `not-tls`: the server does not speak TLS on the port.
|
|
194
|
+
* - `closed`: the server closed the connection before the end of the handshake.
|
|
195
|
+
*/
|
|
196
|
+
declare const HANDSHAKE_OUTCOMES: readonly ["ok", "cert-error", "alert", "not-tls", "timeout", "reset", "closed", "error"];
|
|
197
|
+
type HandshakeOutcome = (typeof HANDSHAKE_OUTCOMES)[number];
|
|
198
|
+
/** The roots of trust that a certificate chain ends at: a public root, a root of the computer or the user, or none. */
|
|
199
|
+
declare const TRUSTS: readonly ["public", "private", "none"];
|
|
200
|
+
type Trust = (typeof TRUSTS)[number];
|
|
201
|
+
/** The problems of a certificate. */
|
|
202
|
+
declare const CERT_PROBLEMS: readonly ["expired", "not-yet-valid", "name", "untrusted", "revoked", "other"];
|
|
203
|
+
type CertProblem = (typeof CERT_PROBLEMS)[number];
|
|
204
|
+
/** The certificate of a server. */
|
|
205
|
+
interface TlsCertificate {
|
|
206
|
+
readonly subject: string;
|
|
207
|
+
readonly issuer: string;
|
|
208
|
+
/** The DNS names and the IP addresses of the certificate. */
|
|
209
|
+
readonly names: readonly string[];
|
|
210
|
+
/** The start of the validity, as an ISO 8601 time. */
|
|
211
|
+
readonly validFrom: string;
|
|
212
|
+
/** The end of the validity, as an ISO 8601 time. */
|
|
213
|
+
readonly validTo: string;
|
|
214
|
+
readonly fingerprint256: string;
|
|
215
|
+
readonly selfSigned: boolean;
|
|
216
|
+
/** The number of certificates from the certificate of the server to the root, with both. */
|
|
217
|
+
readonly chain: number;
|
|
218
|
+
/** The root that the chain ends at. A failed check of the certificate does not change it. */
|
|
219
|
+
readonly trust: Trust;
|
|
220
|
+
readonly problem?: CertProblem | undefined;
|
|
221
|
+
}
|
|
222
|
+
/** The outcome of one TLS handshake. */
|
|
223
|
+
interface TlsHandshake {
|
|
224
|
+
readonly address: string;
|
|
225
|
+
readonly port: number;
|
|
226
|
+
readonly servername?: string | undefined;
|
|
227
|
+
readonly outcome: HandshakeOutcome;
|
|
228
|
+
/** The time from the TCP connection to the end of the handshake or to the failure, in milliseconds. */
|
|
229
|
+
readonly ms: number;
|
|
230
|
+
/** The TLS version, for example `TLSv1.3`. */
|
|
231
|
+
readonly protocol?: string | undefined;
|
|
232
|
+
readonly cipher?: string | undefined;
|
|
233
|
+
/** The application protocol that the server chose with ALPN, for example `http/1.1`. */
|
|
234
|
+
readonly alpn?: string | undefined;
|
|
235
|
+
readonly code?: string | undefined;
|
|
236
|
+
readonly certificate?: TlsCertificate | undefined;
|
|
237
|
+
}
|
|
238
|
+
/** The fact kind `tls.handshake`. */
|
|
239
|
+
declare const TLS_HANDSHAKE: FactKind<TlsHandshake>;
|
|
240
|
+
/**
|
|
241
|
+
* The outcomes of an HTTP request.
|
|
242
|
+
*
|
|
243
|
+
* - `response`: the server sent a response. Its status can be an error.
|
|
244
|
+
* - `protocol`: the server sent bytes that are not HTTP.
|
|
245
|
+
* - `closed`: the server closed the connection before the response.
|
|
246
|
+
*/
|
|
247
|
+
declare const HTTP_OUTCOMES: readonly ["response", "protocol", "timeout", "reset", "closed", "error"];
|
|
248
|
+
type HttpOutcome = (typeof HTTP_OUTCOMES)[number];
|
|
249
|
+
/** The outcome of one HTTP request. */
|
|
250
|
+
interface HttpResponse {
|
|
251
|
+
readonly address: string;
|
|
252
|
+
readonly port: number;
|
|
253
|
+
readonly scheme: "http" | "https";
|
|
254
|
+
readonly method: "GET" | "HEAD";
|
|
255
|
+
/** The value of the `Host` field of the request. */
|
|
256
|
+
readonly host: string;
|
|
257
|
+
readonly path: string;
|
|
258
|
+
readonly outcome: HttpOutcome;
|
|
259
|
+
readonly status?: number | undefined;
|
|
260
|
+
/** The HTTP version of the response, for example `1.1`. */
|
|
261
|
+
readonly version?: string | undefined;
|
|
262
|
+
/** Some fields of the response head, with lower-case names: `server`, `via`, `location` and others. */
|
|
263
|
+
readonly fields: Readonly<Record<string, string>>;
|
|
264
|
+
/** The bytes of the body that the probe read. */
|
|
265
|
+
readonly bytes: number;
|
|
266
|
+
/** The probe stopped the read of the body at its limit. */
|
|
267
|
+
readonly truncated: boolean;
|
|
268
|
+
/** The time from the request to the head of the response, in milliseconds. */
|
|
269
|
+
readonly ttfbMs?: number | undefined;
|
|
270
|
+
/** The time from the request to the end of the response or to the failure, in milliseconds. */
|
|
271
|
+
readonly ms: number;
|
|
272
|
+
readonly code?: string | undefined;
|
|
273
|
+
}
|
|
274
|
+
/** The fact kind `http.response`. */
|
|
275
|
+
declare const HTTP_RESPONSE: FactKind<HttpResponse>;
|
|
276
|
+
/** The fact kinds of the native probes. */
|
|
277
|
+
declare const NATIVE_KINDS: readonly FactKind<unknown>[];
|
|
278
|
+
/**
|
|
279
|
+
* The outcomes of the ICMP echo requests to one address.
|
|
280
|
+
*
|
|
281
|
+
* - `reply`: one or more echo replies came back.
|
|
282
|
+
* - `none`: no reply came back in the time limit.
|
|
283
|
+
* - `unreachable`: no echo reply came back, and a router or this computer told that the address is unreachable.
|
|
284
|
+
* - `error`: the tool did not start, or netdiag cannot read its output.
|
|
285
|
+
*/
|
|
286
|
+
declare const ECHO_OUTCOMES: readonly ["reply", "none", "unreachable", "error"];
|
|
287
|
+
type EchoOutcome = (typeof ECHO_OUTCOMES)[number];
|
|
288
|
+
/** The result of the ICMP echo requests to one address. */
|
|
289
|
+
interface IcmpEcho {
|
|
290
|
+
readonly address: string;
|
|
291
|
+
readonly outcome: EchoOutcome;
|
|
292
|
+
/** The number of echo requests that the tool sent. */
|
|
293
|
+
readonly sent: number;
|
|
294
|
+
/** The number of echo replies. A message of an unreachable address is not a reply. */
|
|
295
|
+
readonly received: number;
|
|
296
|
+
/** The round-trip time of each reply, in milliseconds. */
|
|
297
|
+
readonly rttMs: readonly number[];
|
|
298
|
+
/** The TTL (IPv4) or the hop limit (IPv6) of the first reply. */
|
|
299
|
+
readonly ttl?: number | undefined;
|
|
300
|
+
/** The router that told that the address is unreachable. */
|
|
301
|
+
readonly from?: string | undefined;
|
|
302
|
+
/** The text of the tool for the outcomes `unreachable` and `error`. */
|
|
303
|
+
readonly detail?: string | undefined;
|
|
304
|
+
}
|
|
305
|
+
/** The fact kind `icmp.echo`. */
|
|
306
|
+
declare const ICMP_ECHO: FactKind<IcmpEcho>;
|
|
307
|
+
/**
|
|
308
|
+
* The outcomes of a trace of the path to an address.
|
|
309
|
+
*
|
|
310
|
+
* - `reached`: the address answered at the last hop.
|
|
311
|
+
* - `stopped`: the last hop is not the address, and no router told that the address is unreachable.
|
|
312
|
+
* - `unreachable`: a router or this computer told that the address is unreachable.
|
|
313
|
+
* - `error`: the tool failed, or netdiag cannot read its output.
|
|
314
|
+
*/
|
|
315
|
+
declare const TRACE_OUTCOMES: readonly ["reached", "stopped", "unreachable", "error"];
|
|
316
|
+
type TraceOutcome = (typeof TRACE_OUTCOMES)[number];
|
|
317
|
+
/** One hop of a trace: the answers to the probes with one TTL. */
|
|
318
|
+
interface TraceHop {
|
|
319
|
+
/** The TTL (IPv4) or the hop limit (IPv6) of the probes, from 1. */
|
|
320
|
+
readonly ttl: number;
|
|
321
|
+
/** The addresses that answered, in the order of their first answer. */
|
|
322
|
+
readonly addresses: readonly string[];
|
|
323
|
+
/** The number of probes that the tool sent with this TTL. */
|
|
324
|
+
readonly sent: number;
|
|
325
|
+
/** The number of answers. */
|
|
326
|
+
readonly received: number;
|
|
327
|
+
/** The round-trip time of each answer that has a time, in milliseconds. */
|
|
328
|
+
readonly rttMs: readonly number[];
|
|
329
|
+
/** The message of an unreachable address at this hop, for example `host unreachable (!H)`. */
|
|
330
|
+
readonly unreachable?: string | undefined;
|
|
331
|
+
}
|
|
332
|
+
/** The trace of the path to one address: the hops of the tool `traceroute`, or `tracert` on Windows. */
|
|
333
|
+
interface PathTrace {
|
|
334
|
+
readonly address: string;
|
|
335
|
+
readonly outcome: TraceOutcome;
|
|
336
|
+
/** The largest TTL of the probes. */
|
|
337
|
+
readonly maxHops: number;
|
|
338
|
+
/** The hops in the order of their TTL. An `error` keeps the hops before the failure. */
|
|
339
|
+
readonly hops: readonly TraceHop[];
|
|
340
|
+
/** The text of the tool for the outcomes `unreachable` and `error`. */
|
|
341
|
+
readonly detail?: string | undefined;
|
|
342
|
+
}
|
|
343
|
+
/** The fact kind `path.trace`. */
|
|
344
|
+
declare const PATH_TRACE: FactKind<PathTrace>;
|
|
345
|
+
/** One hop of a report of `mtr`: the counts and the times of many cycles of probes with one TTL. */
|
|
346
|
+
interface ReportHop {
|
|
347
|
+
readonly ttl: number;
|
|
348
|
+
/** The address that answered. A hop with no answer has no address. */
|
|
349
|
+
readonly address?: string | undefined;
|
|
350
|
+
/** The number of probes that the tool sent with this TTL. */
|
|
351
|
+
readonly sent: number;
|
|
352
|
+
/** The number of answers. The adapter calculates it from the loss and the number of probes of the report. */
|
|
353
|
+
readonly received: number;
|
|
354
|
+
/** The best round-trip time, in milliseconds. Only a hop with answers has the times. */
|
|
355
|
+
readonly bestMs?: number | undefined;
|
|
356
|
+
/** The mean round-trip time, in milliseconds. */
|
|
357
|
+
readonly meanMs?: number | undefined;
|
|
358
|
+
/** The worst round-trip time, in milliseconds. */
|
|
359
|
+
readonly worstMs?: number | undefined;
|
|
360
|
+
}
|
|
361
|
+
/** The report of the tool `mtr` for the path to one address. */
|
|
362
|
+
interface PathReport {
|
|
363
|
+
readonly address: string;
|
|
364
|
+
/** The outcome. A report of `mtr` has no messages of an unreachable address, so it does not have the outcome `unreachable`. */
|
|
365
|
+
readonly outcome: TraceOutcome;
|
|
366
|
+
/** The number of cycles of probes. */
|
|
367
|
+
readonly cycles: number;
|
|
368
|
+
readonly hops: readonly ReportHop[];
|
|
369
|
+
/** The text of the tool for the outcome `error`. */
|
|
370
|
+
readonly detail?: string | undefined;
|
|
371
|
+
}
|
|
372
|
+
/** The fact kind `path.report`. */
|
|
373
|
+
declare const PATH_REPORT: FactKind<PathReport>;
|
|
374
|
+
/** The fact kinds of the adapters of outside tools (`@mark1russell7/netdiag/tools`). */
|
|
375
|
+
declare const TOOL_KINDS: readonly FactKind<unknown>[];
|
|
376
|
+
export { HostKind as $, TRACE_OUTCOMES as A, ProbeContext as B, PathTrace as C, TCP_CONNECT as D, ReportHop as E, TraceHop as F, FactSource as G, defineProbe as H, TraceOutcome as I, ValueOf as J, FactTime as K, Trust as L, TcpConnect as M, TlsCertificate as N, TLS_HANDSHAKE as O, TlsHandshake as P, observe as Q, Availability as R, PathReport as S, RecordType as T, Fact as U, ProbeMode as V, FactKind as W, factsOf as X, defineFactKind as Y, isFactOf as Z, ICMP_ECHO as _, DNS_ANSWER as a, sameTarget as at, PATH_REPORT as b, DnsOutcome as c, HANDSHAKE_OUTCOMES as d, Target as et, HTTP_OUTCOMES as f, HttpResponse as g, HttpOutcome as h, ConnectOutcome as i, parseTarget as it, TRUSTS as j, TOOL_KINDS as k, ECHO_OUTCOMES as l, HandshakeOutcome as m, CONNECT_OUTCOMES as n, formatTarget as nt, DNS_OUTCOMES as o, target as ot, HTTP_RESPONSE as p, Observation as q, CertProblem as r, hostKind as rt, DnsAnswer as s, CERT_PROBLEMS as t, canonicalHost as tt, EchoOutcome as u, IcmpEcho as v, RECORD_TYPES as w, PATH_TRACE as x, NATIVE_KINDS as y, Probe as z };
|
|
377
|
+
//# sourceMappingURL=kinds-_NShfZpU.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds-_NShfZpU.d.ts","names":[],"sources":["../src/target.ts","../src/fact.ts","../src/probe.ts","../src/kinds.ts"],"mappings":";;;;KAIY;;;;;;UAOK;WACN;WACA,MAAM;WACN;;;iBAcK,SAAS,eAAe;;iBAQxB,cAAc;;iBAQd,OAAO,cAAc,gBAAgB;;iBAMrC,aAAa,GAAG;;iBAMhB,WAAW,GAAG,QAAQ,GAAG;;;;;;;;iBAwBzB,YAAY,eAAe,OAAO;;;;;;UCxEjC;WACN;WACA;;;UAIM;WACN;WACA;WACA;;;;;;;;UASM,KAAK;;WAEX;WACA;WACA,OAAO;WACP,SAAS;WACT,MAAM;WACN,QAAQ;WACR,OAAO;;;;;;;;UASD,SAAS;WACf;WACA,OAAO;WACP;WACA,QAAQ,mBAAmB,SAAS;;;KAInC,QAAQ,KAAK,UAAU,eAAe,KAAK;;iBAKvC,eAAe,GAAG,MAAM,SAAS,KAAK,SAAS;;iBAM/C,SAAS,GAAG,MAAM,SAAS,IAAI,MAAM,OAAO,QAAQ,KAAK;;iBAKzD,QAAQ,GAAG,MAAM,SAAS,IAAI,gBAAgB,SAAS,KAAK;;;;;;UAS3D,YAAY;WAClB,MAAM,SAAS;WACf,SAAS;WACT,OAAO;WACP,OAAO;;;iBAIF,QAAQ,GAAG,MAAM,SAAS,IAAI,SAAS,QAAQ,OAAO,GAAG,OAAO,WAAW,YAAY;;;;;;;KCzE3F;;UAGK;WACN,OAAO;WACP,QAAQ;;;KAIP;WACG;WAA0B;;WAC1B;WAA2B;;;;;;;;;;;;;;;UAezB,MAAM,GAAG;;WAEf;;WAEA;WACA;WACA,OAAO;WACP,MAAM;;WAEN,gBAAgB;;WAEhB;EACT,MAAM,OAAO,aAAa;EAC1B,UAAU,SAAS,eAAe,QAAQ;EAC1C,IAAI,OAAO,GAAG,SAAS,eAAe,QAAQ;EAC9C,MAAM,KAAK,GAAG,OAAO,aAAa;;;iBAIpB,YAAY,GAAG,GAAG,OAAO,MAAM,GAAG,KAAK,MAAM,GAAG;;cCnBnD;KACD,qBAAqB;;cAGpB;KACD,qBAAqB;;UAGhB;WACN;WACA,QAAQ;;WAER;WACA,SAAS;WACT;;WAEA;;WAEA;;WAEA;;;cAIE,YAAY,SAAS;;cAkBrB;KACD,yBAAyB;;UAGpB;WACN;WACA;WACA;WACA,SAAS;;WAET;WACA;;;cAIE,aAAa,SAAS;;;;;;;;;cAsBtB;KACD,2BAA2B;;cAG1B;KACD,gBAAgB;;cAGf;KACD,sBAAsB;;UAGjB;WACN;WACA;;WAEA;;WAEA;;WAEA;WACA;WACA;;WAEA;;WAEA,OAAO;WACP,UAAU;;;UAIJ;WACN;WACA;WACA;WACA,SAAS;;WAET;;WAEA;WACA;;WAEA;WACA;WACA,cAAc;;;cAsBZ,eAAe,SAAS;;;;;;;;cAyBxB;KACD,sBAAsB;;UAGjB;WACN;WACA;WACA;WACA;;WAEA;WACA;WACA,SAAS;WACT;;WAEA;;WAEA,QAAQ,SAAS;;WAEjB;;WAEA;;WAEA;;WAEA;WACA;;;cAIE,eAAe,SAAS;;cA4BxB,uBAAuB;;;;;;;;;cAUvB;KACD,sBAAsB;;UAGjB;WACN;WACA,SAAS;;WAET;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;cAIE,WAAW,SAAS;;;;;;;;;cA4BpB;KACD,uBAAuB;;UAGlB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;WACN;WACA,SAAS;;WAET;;WAEA,eAAe;;WAEf;;;cA0BE,YAAY,SAAS;;UAiBjB;WACN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;WACN;;WAEA,SAAS;;WAET;WACA,eAAe;;WAEf;;;cAoBE,aAAa,SAAS;;cAkBtB,qBAAqB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layers of the network stack that netdiag examines, from the bottom to the top.
|
|
3
|
+
*
|
|
4
|
+
* - `link`: the network interface and its physical link.
|
|
5
|
+
* - `wifi`: the Wi-Fi link: the signal, the channel and the rate.
|
|
6
|
+
* - `ip`: the addresses of the interfaces.
|
|
7
|
+
* - `route`: the routes of this computer and its gateway.
|
|
8
|
+
* - `path`: the hops through the provider networks to the remote host.
|
|
9
|
+
* - `dns`: the resolution of names to addresses.
|
|
10
|
+
* - `tcp`: the connections to a port.
|
|
11
|
+
* - `tls`: the handshake and the certificate of the server.
|
|
12
|
+
* - `http`: the request and the response.
|
|
13
|
+
*/
|
|
14
|
+
declare const LAYERS: readonly ["link", "wifi", "ip", "route", "path", "dns", "tcp", "tls", "http"];
|
|
15
|
+
/** A layer of the network stack. The list `LAYERS` gives each layer in its order. */
|
|
16
|
+
type Layer = (typeof LAYERS)[number];
|
|
17
|
+
/** This function tells if a value is the name of a layer. */
|
|
18
|
+
declare function isLayer(value: unknown): value is Layer;
|
|
19
|
+
/** This function gives the position of a layer in `LAYERS`. The bottom layer `link` has the position 0. */
|
|
20
|
+
declare function layerRank(layer: Layer): number;
|
|
21
|
+
export { layerRank as i, Layer as n, isLayer as r, LAYERS as t };
|
|
22
|
+
//# sourceMappingURL=layer-BNg0VYuK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-BNg0VYuK.d.ts","names":[],"sources":["../src/layer.ts"],"mappings":";;;;;;;;;;;;;cAaa;;KAGD,gBAAgB;;iBAKZ,QAAQ,iBAAiB,SAAS;;iBAKlC,UAAU,OAAO"}
|
package/build/tools.d.ts
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { B as ProbeContext, C as PathTrace, R as Availability, S as PathReport, v as IcmpEcho, z as Probe } from "./kinds-_NShfZpU.js";
|
|
2
|
+
/**
|
|
3
|
+
* The output of one command of an outside tool.
|
|
4
|
+
*
|
|
5
|
+
* The function `runCommand` of `@procedures/shell` gives this shape, so it is a host with no change (refer to the README).
|
|
6
|
+
*/
|
|
7
|
+
interface ToolOutput {
|
|
8
|
+
/** The exit code of the program. */
|
|
9
|
+
readonly exitCode: number;
|
|
10
|
+
readonly stdout: string;
|
|
11
|
+
readonly stderr: string;
|
|
12
|
+
/** This field is true when the time limit stopped the program. */
|
|
13
|
+
readonly timedOut?: boolean | undefined;
|
|
14
|
+
/** The error that kept the program from its start, for example `spawn ping ENOENT`. */
|
|
15
|
+
readonly error?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** The options of one command. */
|
|
18
|
+
interface ToolRunOptions {
|
|
19
|
+
/** The time limit of the command, in milliseconds. After the limit, the host stops the program. */
|
|
20
|
+
readonly timeoutMs: number;
|
|
21
|
+
readonly signal: AbortSignal;
|
|
22
|
+
/** The environment variables to add to the environment of the program, for example `LC_ALL=C` for English output. */
|
|
23
|
+
readonly env?: Readonly<Record<string, string>> | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The host of the outside tools: the operating system, and the function that starts a program.
|
|
27
|
+
*
|
|
28
|
+
* - `platform` has the values of `process.platform`, for example `linux`, `darwin` or `win32`.
|
|
29
|
+
* - `run` starts a program with a list of arguments and no shell. It does not throw. A failure is in the output.
|
|
30
|
+
*/
|
|
31
|
+
interface ToolHost {
|
|
32
|
+
readonly platform: string;
|
|
33
|
+
run(command: string, args: readonly string[], options: ToolRunOptions): Promise<ToolOutput>;
|
|
34
|
+
}
|
|
35
|
+
/** The raw output of a probe of an outside tool: the command, its output, and the times on the clock of the runner. */
|
|
36
|
+
interface ToolRaw extends ToolOutput {
|
|
37
|
+
readonly platform: string;
|
|
38
|
+
readonly command: string;
|
|
39
|
+
readonly args: readonly string[];
|
|
40
|
+
readonly start: number;
|
|
41
|
+
readonly end: number;
|
|
42
|
+
}
|
|
43
|
+
/** The time limit of the command that examines if a tool is available, in milliseconds. */
|
|
44
|
+
export declare const AVAILABILITY_TIMEOUT_MS = 5e3;
|
|
45
|
+
/** The time that an adapter adds to the time limit of a command, in milliseconds. In this time, a tool writes its last lines. */
|
|
46
|
+
export declare const TOOL_MARGIN_MS = 3e3;
|
|
47
|
+
/**
|
|
48
|
+
* This function gives the availability of a tool from the output of a harmless command. A tool is available when its
|
|
49
|
+
* program starts. The first group of `version` gives the version of the tool.
|
|
50
|
+
*/
|
|
51
|
+
export declare function availabilityOf(tool: string, output: ToolOutput, version?: RegExp): Availability;
|
|
52
|
+
/** A command of an outside tool: the program, its arguments, its time limit and the environment variables to add. */
|
|
53
|
+
interface ToolCommand {
|
|
54
|
+
readonly command: string;
|
|
55
|
+
readonly args: readonly string[];
|
|
56
|
+
readonly timeoutMs: number;
|
|
57
|
+
readonly env?: Readonly<Record<string, string>> | undefined;
|
|
58
|
+
}
|
|
59
|
+
/** This function starts a command on the host, and gives its raw output with the times of the clock of the runner. */
|
|
60
|
+
export declare function runTool(host: ToolHost, tool: ToolCommand, context: ProbeContext): Promise<ToolRaw>;
|
|
61
|
+
/**
|
|
62
|
+
* The use of an outside tool in netdiag.
|
|
63
|
+
*
|
|
64
|
+
* - `adapter`: netdiag has an optional adapter. The user installs the tool, and netdiag starts it when it is available.
|
|
65
|
+
* - `not-bundled`: netdiag does not start the tool, because its license is restrictive.
|
|
66
|
+
*/
|
|
67
|
+
type ToolUse = "adapter" | "not-bundled";
|
|
68
|
+
/** A row of the table of the licenses of the outside tools. */
|
|
69
|
+
interface ToolLicense {
|
|
70
|
+
/** The name of the program, for example `ping`. */
|
|
71
|
+
readonly tool: string;
|
|
72
|
+
readonly license: string;
|
|
73
|
+
readonly use: ToolUse;
|
|
74
|
+
/** The id of the probe of the adapter. A planned adapter has no probe yet. */
|
|
75
|
+
readonly probe?: string | undefined;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The licenses of the outside tools, as data. netdiag bundles no tool. A test makes sure that the probe of each adapter
|
|
79
|
+
* has a row with the use `adapter`.
|
|
80
|
+
*/
|
|
81
|
+
export declare const TOOL_LICENSES: readonly ToolLicense[];
|
|
82
|
+
/** This function gives the row of a tool, or `undefined` for a tool that is not in the table. */
|
|
83
|
+
export declare function toolLicense(tool: string): ToolLicense | undefined;
|
|
84
|
+
/** The input of the ping probe: echo requests to one IP address. */
|
|
85
|
+
interface PingInput {
|
|
86
|
+
readonly address: string;
|
|
87
|
+
/** The number of echo requests. The default is `DEFAULT_PING_COUNT`. */
|
|
88
|
+
readonly count?: number | undefined;
|
|
89
|
+
/** The time to wait for each reply, in milliseconds. The default is `DEFAULT_PING_WAIT_MS`. */
|
|
90
|
+
readonly waitMs?: number | undefined;
|
|
91
|
+
}
|
|
92
|
+
/** The default number of echo requests. The feature `path.loss` needs `LOSS_MIN_SENT` requests or more. */
|
|
93
|
+
export declare const DEFAULT_PING_COUNT = 4;
|
|
94
|
+
/** The default time to wait for each reply, in milliseconds. */
|
|
95
|
+
export declare const DEFAULT_PING_WAIT_MS = 1e3;
|
|
96
|
+
/** The largest number of echo requests in one input. */
|
|
97
|
+
export declare const MAX_PING_COUNT = 100;
|
|
98
|
+
/** The time between two echo requests on Linux and macOS, in milliseconds. A user without privileges can set it. */
|
|
99
|
+
export declare const PING_INTERVAL_MS = 200;
|
|
100
|
+
/**
|
|
101
|
+
* The time that the `ping6` of macOS waits after its last request when a reply is missing, in milliseconds. The tool
|
|
102
|
+
* has no option for it.
|
|
103
|
+
*/
|
|
104
|
+
export declare const PING6_LAST_WAIT_MS = 1e4;
|
|
105
|
+
/**
|
|
106
|
+
* This function gives the command of ping for an operating system and an input. For an operating system that the adapter
|
|
107
|
+
* does not know, it gives `undefined`. It throws for an input that is not valid.
|
|
108
|
+
*
|
|
109
|
+
* - Linux: iputils `ping`, with a deadline (`-w`) in seconds, so that ping writes its statistics.
|
|
110
|
+
* - macOS: `ping` with a deadline (`-t`), and `ping6` for an IPv6 address.
|
|
111
|
+
* - Windows: `ping.exe`. It sends one request each second.
|
|
112
|
+
*/
|
|
113
|
+
export declare function pingCommand(platform: string, input: PingInput): ToolCommand | undefined;
|
|
114
|
+
/** This function tells if ping is available on the host. On Linux, netdiag reads only the ping of iputils. */
|
|
115
|
+
export declare function pingAvailability(host: ToolHost, context: ProbeContext): Promise<Availability>;
|
|
116
|
+
/**
|
|
117
|
+
* This function reads the raw output of the ping probe into the value of a fact `icmp.echo`.
|
|
118
|
+
*
|
|
119
|
+
* - The replies are the lines of echo replies. A message of an unreachable address and a duplicate are not replies.
|
|
120
|
+
* - Output with no statistics gives the outcome `error`, also when it has replies. The time limit stopped such a ping.
|
|
121
|
+
*/
|
|
122
|
+
export declare function readPing(raw: ToolRaw, address: string): IcmpEcho;
|
|
123
|
+
/**
|
|
124
|
+
* This function makes the probe `icmp.ping`: the echo requests of the tool ping to one IP address. The host starts
|
|
125
|
+
* the tool. Give `runCommand` of `@procedures/shell`, or a fake host in a test.
|
|
126
|
+
*/
|
|
127
|
+
export declare function pingProbe(host: ToolHost): Probe<PingInput, ToolRaw>;
|
|
128
|
+
/** The input of the traceroute probe: the path to one IP address. */
|
|
129
|
+
interface TraceInput {
|
|
130
|
+
readonly address: string;
|
|
131
|
+
/** The largest TTL. The default is `DEFAULT_TRACE_HOPS`. */
|
|
132
|
+
readonly maxHops?: number | undefined;
|
|
133
|
+
/** The time to wait for each answer, in milliseconds. On Linux and macOS, the tool rounds it up to full seconds. */
|
|
134
|
+
readonly waitMs?: number | undefined;
|
|
135
|
+
}
|
|
136
|
+
/** The default largest TTL. */
|
|
137
|
+
export declare const DEFAULT_TRACE_HOPS = 30;
|
|
138
|
+
/** The largest TTL of one input. */
|
|
139
|
+
export declare const MAX_TRACE_HOPS = 64;
|
|
140
|
+
/** The default time to wait for each answer, in milliseconds. */
|
|
141
|
+
export declare const DEFAULT_TRACE_WAIT_MS = 1e3;
|
|
142
|
+
/** The number of probes for each TTL. `tracert` on Windows always sends 3 probes. */
|
|
143
|
+
export declare const TRACE_QUERIES = 3;
|
|
144
|
+
/**
|
|
145
|
+
* This function gives the command of traceroute for an operating system and an input. For an operating system that the
|
|
146
|
+
* adapter does not know, it gives `undefined`. It throws for an input that is not valid.
|
|
147
|
+
*
|
|
148
|
+
* - Linux: `traceroute`, with UDP probes. A user without privileges can send them.
|
|
149
|
+
* - macOS: `traceroute`, and `traceroute6` for an IPv6 address.
|
|
150
|
+
* - Windows: `tracert.exe`, with ICMP echo requests.
|
|
151
|
+
*
|
|
152
|
+
* The time limit is the time of a trace that waits for each probe of each hop.
|
|
153
|
+
*/
|
|
154
|
+
export declare function tracerouteCommand(platform: string, input: TraceInput): ToolCommand | undefined;
|
|
155
|
+
/** This function tells if traceroute is available on the host. On Linux, netdiag reads only the Modern traceroute for Linux. */
|
|
156
|
+
export declare function tracerouteAvailability(host: ToolHost, context: ProbeContext): Promise<Availability>;
|
|
157
|
+
/**
|
|
158
|
+
* This function reads the raw output of the traceroute probe into the value of a fact `path.trace`.
|
|
159
|
+
*
|
|
160
|
+
* - The outcome is `reached` when the address answered at the last hop.
|
|
161
|
+
* - Output that netdiag cannot read gives the outcome `error`. An `error` keeps the hops that netdiag read.
|
|
162
|
+
*/
|
|
163
|
+
export declare function readTraceroute(raw: ToolRaw, input: {
|
|
164
|
+
readonly address: string;
|
|
165
|
+
readonly maxHops?: number | undefined;
|
|
166
|
+
}): PathTrace;
|
|
167
|
+
/**
|
|
168
|
+
* This function makes the probe `path.traceroute`: the trace of the path to one IP address with the tool traceroute,
|
|
169
|
+
* or `tracert` on Windows. The host starts the tool.
|
|
170
|
+
*/
|
|
171
|
+
export declare function tracerouteProbe(host: ToolHost): Probe<TraceInput, ToolRaw>;
|
|
172
|
+
/** The input of the mtr probe: many cycles of probes on the path to one IP address. */
|
|
173
|
+
interface MtrInput {
|
|
174
|
+
readonly address: string;
|
|
175
|
+
/** The number of cycles. The default is `DEFAULT_MTR_CYCLES`. */
|
|
176
|
+
readonly cycles?: number | undefined;
|
|
177
|
+
/** The largest TTL. The default is `DEFAULT_TRACE_HOPS`. */
|
|
178
|
+
readonly maxHops?: number | undefined;
|
|
179
|
+
}
|
|
180
|
+
/** The default number of cycles. It is `LOSS_MIN_SENT` of the readers, so a report gives the feature `path.loss`. */
|
|
181
|
+
export declare const DEFAULT_MTR_CYCLES = 20;
|
|
182
|
+
/** The largest number of cycles of one input. */
|
|
183
|
+
export declare const MAX_MTR_CYCLES = 100;
|
|
184
|
+
/** The time that mtr waits for the last answers after the last cycle, in milliseconds (its option `--gracetime`). */
|
|
185
|
+
export declare const MTR_GRACE_MS = 5e3;
|
|
186
|
+
/**
|
|
187
|
+
* This function gives the command of mtr for an operating system and an input. On Windows and on an operating system
|
|
188
|
+
* that the adapter does not know, it gives `undefined`. It throws for an input that is not valid.
|
|
189
|
+
*/
|
|
190
|
+
export declare function mtrCommand(platform: string, input: MtrInput): ToolCommand | undefined;
|
|
191
|
+
/** This function tells if mtr is available on the host. The adapter knows Linux and macOS. */
|
|
192
|
+
export declare function mtrAvailability(host: ToolHost, context: ProbeContext): Promise<Availability>;
|
|
193
|
+
/**
|
|
194
|
+
* This function reads the raw output of the mtr probe into the value of a fact `path.report`.
|
|
195
|
+
*
|
|
196
|
+
* - The number of answers of a hop comes from its loss and its number of probes.
|
|
197
|
+
* - Output that netdiag cannot read gives the outcome `error`.
|
|
198
|
+
*/
|
|
199
|
+
export declare function readMtr(raw: ToolRaw, input: {
|
|
200
|
+
readonly address: string;
|
|
201
|
+
readonly cycles?: number | undefined;
|
|
202
|
+
}): PathReport;
|
|
203
|
+
/** This function makes the probe `path.mtr`: many cycles of probes on the path to one IP address with the tool mtr. */
|
|
204
|
+
export declare function mtrProbe(host: ToolHost): Probe<MtrInput, ToolRaw>;
|
|
205
|
+
export type { MtrInput, PingInput, ToolCommand, ToolHost, ToolLicense, ToolOutput, ToolRaw, ToolRunOptions, ToolUse, TraceInput };
|
|
206
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","names":[],"sources":["../src/tools/host.ts","../src/tools/licenses.ts","../src/tools/ping.ts","../src/tools/traceroute.ts","../src/tools/mtr.ts"],"mappings":";;;;;;UAOiB;;WAEN;WACA;WACA;;WAEA;;WAEA;;;UAIM;;WAEN;WACA,QAAQ;;WAER,MAAM,SAAS;;;;;;;;UAST;WACN;EACT,IAAI,iBAAiB,yBAAyB,SAAS,iBAAiB,QAAQ;;;UAIjE,gBAAgB;WACtB;WACA;WACA;WACA;WACA;;;qBAIE;;qBAGA;;;;;wBAMG,eAAe,cAAc,QAAQ,YAAY,UAAU,SAAS;;UAOnE;WACN;WACA;WACA;WACA,MAAM,SAAS;;;wBAIJ,QAAQ,MAAM,UAAU,MAAM,aAAa,SAAS,eAAe,QAAQ;;;;;;;KClErF;;UAGK;;WAEN;WACA;WACA,KAAK;;WAEL;;;;;;qBAOE,wBAAwB;;wBAYrB,YAAY,eAAe;;UCrB1B;WACN;;WAEA;;WAEA;;;qBAIE;;qBAGA;;qBAGA;;qBAGA;;;;;qBAMA;;;;;;;;;wBAuBG,YAAY,kBAAkB,OAAO,YAAY;;wBAqC3C,iBAAiB,MAAM,UAAU,SAAS,eAAe,QAAQ;;;;;;;wBA0FvE,SAAS,KAAK,SAAS,kBAAkB;;;;;wBAyBzC,UAAU,MAAM,WAAW,MAAM,WAAW;;UCxM3C;WACN;;WAEA;;WAEA;;;qBAIE;;qBAGA;;qBAGA;;qBAGA;;;;;;;;;;;wBAyBG,kBAAkB,kBAAkB,OAAO,aAAa;;wBAyBlD,uBAAuB,MAAM,UAAU,SAAS,eAAe,QAAQ;;;;;;;wBA4L7E,eAAe,KAAK,SAAS;WAAkB;WAA0B;IAAiC;;;;;wBA0B1G,gBAAgB,MAAM,WAAW,MAAM,YAAY;;UC1RlD;WACN;;WAEA;;WAEA;;;qBAIE;;qBAGA;;qBAGA;;;;;wBAmBG,WAAW,kBAAkB,OAAO,WAAW;;wBAYzC,gBAAgB,MAAM,UAAU,SAAS,eAAe,QAAQ;;;;;;;wBAyDtE,QAAQ,KAAK,SAAS;WAAkB;WAA0B;IAAgC;;wBAsBlG,SAAS,MAAM,WAAW,MAAM,UAAU"}
|