@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.
Files changed (45) hide show
  1. package/README.md +153 -1
  2. package/build/address.d.ts +56 -0
  3. package/build/address.d.ts.map +1 -0
  4. package/build/address.js +172 -0
  5. package/build/address.js.map +1 -0
  6. package/build/{diagnosis-BTa-Dfwl.js → diagnosis-a4hRzFxp.js} +113 -11
  7. package/build/diagnosis-a4hRzFxp.js.map +1 -0
  8. package/build/diagnosis.d.ts +3 -2
  9. package/build/diagnosis.js +1 -1
  10. package/build/{index-CP1hzELI.d.ts → index-K2dGiYxW.d.ts} +83 -22
  11. package/build/index-K2dGiYxW.d.ts.map +1 -0
  12. package/build/index.d.ts +253 -148
  13. package/build/index.d.ts.map +1 -1
  14. package/build/index.js +1084 -161
  15. package/build/index.js.map +1 -1
  16. package/build/kinds-CQv769lK.js +341 -0
  17. package/build/kinds-CQv769lK.js.map +1 -0
  18. package/build/kinds-_NShfZpU.d.ts +377 -0
  19. package/build/kinds-_NShfZpU.d.ts.map +1 -0
  20. package/build/layer-BNg0VYuK.d.ts +22 -0
  21. package/build/layer-BNg0VYuK.d.ts.map +1 -0
  22. package/build/tools.d.ts +206 -0
  23. package/build/tools.d.ts.map +1 -0
  24. package/build/tools.js +896 -0
  25. package/build/tools.js.map +1 -0
  26. package/package.json +17 -5
  27. package/src/address/index.ts +155 -0
  28. package/src/diagnosis/catalog.ts +8 -8
  29. package/src/diagnosis/index.ts +13 -0
  30. package/src/diagnosis/score.ts +160 -0
  31. package/src/index.ts +35 -0
  32. package/src/kinds.ts +460 -0
  33. package/src/probes/native.ts +354 -0
  34. package/src/probes/socket.ts +520 -0
  35. package/src/readers.ts +367 -0
  36. package/src/scope.ts +5 -24
  37. package/src/tools/common.ts +47 -0
  38. package/src/tools/host.ts +91 -0
  39. package/src/tools/index.ts +38 -0
  40. package/src/tools/licenses.ts +37 -0
  41. package/src/tools/mtr.ts +156 -0
  42. package/src/tools/ping.ts +231 -0
  43. package/src/tools/traceroute.ts +313 -0
  44. package/build/diagnosis-BTa-Dfwl.js.map +0 -1
  45. package/build/index-CP1hzELI.d.ts.map +0 -1
package/build/index.d.ts CHANGED
@@ -1,152 +1,10 @@
1
- import { A as LAYERS, C as Strength, D as expand, E as diagnose, M as isLayer, N as layerRank, O as explain, S as STRENGTHS, T as compileCatalog, _ as NONE, a as Catalog, b as Prediction, c as Contribution, d as Evidence, f as Expectation, g as Hypothesis, h as Feature, i as STANDARD_FEATURES, j as Layer, k as predictive, l as Diagnosis, m as Fault, n as STANDARD_CATALOG_SPEC, o as CatalogSpec, p as FLOOR, r as STANDARD_FAULTS, s as Cause, t as STANDARD_CATALOG, u as Distribution, v as PARTS, w as UNKNOWN, x as Reach, y as Part } from "./index-CP1hzELI.js";
1
+ import { i as layerRank, n as Layer, r as isLayer, t as LAYERS } from "./layer-BNg0VYuK.js";
2
+ import { $ as HostKind, A as TRACE_OUTCOMES, B as ProbeContext, C as PathTrace, D as TCP_CONNECT, E as ReportHop, F as TraceHop, G as FactSource, H as defineProbe, I as TraceOutcome, J as ValueOf, K as FactTime, L as Trust, M as TcpConnect, N as TlsCertificate, O as TLS_HANDSHAKE, P as TlsHandshake, Q as observe, R as Availability, S as PathReport, T as RecordType, U as Fact, V as ProbeMode, W as FactKind, X as factsOf, Y as defineFactKind, Z as isFactOf, _ as ICMP_ECHO, a as DNS_ANSWER, at as sameTarget, b as PATH_REPORT, c as DnsOutcome, d as HANDSHAKE_OUTCOMES, et as Target, f as HTTP_OUTCOMES, g as HttpResponse, h as HttpOutcome, i as ConnectOutcome, it as parseTarget, j as TRUSTS, k as TOOL_KINDS, l as ECHO_OUTCOMES, m as HandshakeOutcome, n as CONNECT_OUTCOMES, nt as formatTarget, o as DNS_OUTCOMES, ot as target, p as HTTP_RESPONSE, q as Observation, r as CertProblem, rt as hostKind, s as DnsAnswer, t as CERT_PROBLEMS, tt as canonicalHost, u as EchoOutcome, v as IcmpEcho, w as RECORD_TYPES, x as PATH_TRACE, y as NATIVE_KINDS, z as Probe } from "./kinds-_NShfZpU.js";
3
+ import { ADDRESS_CLASSES, AddressClass, AddressFamily, Cidr, CidrSet, addressClass, addressFamily, addressKind, canonicalAddress, cidrContains, cidrSet, formatCidr, parseCidr } from "./address.js";
4
+ import { A as Part, B as predictive, C as Expectation, D as Hypothesis, E as Feature, F as UNKNOWN, I as compileCatalog, L as diagnose, M as Reach, N as STRENGTHS, O as NONE, P as Strength, R as expand, S as Evidence, T as Fault, _ as CatalogSpec, a as LabRecord, b as Diagnosis, c as LabVerdict, d as scoreLab, f as STANDARD_CATALOG, g as Catalog, h as STANDARD_FEATURES, i as LabGate, j as Prediction, k as PARTS, l as labGate, m as STANDARD_FAULTS, n as LabBars, o as LabScore, p as STANDARD_CATALOG_SPEC, r as LabCause, s as LabStatus, t as LAB_RECORD_FORMAT, u as labRecordOf, v as Cause, w as FLOOR, x as Distribution, y as Contribution, z as explain } from "./index-K2dGiYxW.js";
5
+ import { Socket, TcpNetConnectOpts } from "node:net";
2
6
  import { Result } from "@mark1russell7/optional";
3
7
  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
- export 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
- export declare function canonicalHost(host: string): string;
20
- /** This function makes a target from a host and an optional port. */
21
- export 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
- export declare function formatTarget(t: Target): string;
24
- /** This function tells if two targets have the same host and the same port. */
25
- export 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
- export 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
- export 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
- export 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
- export 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
- export 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
- export declare function defineProbe<I, R>(probe: Probe<I, R>): Probe<I, R>;
150
8
  /**
151
9
  * The basis of a grant: why a target is in the scope.
152
10
  *
@@ -283,5 +141,252 @@ interface Runner {
283
141
  }
284
142
  /** This function makes a runner. */
285
143
  export declare function createRunner(options: RunnerOptions): Runner;
286
- export { type Availability, type Catalog, type CatalogSpec, type Cause, type ClockOrigin, type Contribution, type Diagnosis, type Distribution, type Evidence, type Expectation, FLOOR, type Fact, type FactKind, type FactSource, type FactTime, type Fault, type Feature, type Grant, type GrantBasis, type HostGrant, type HostKind, type Hypothesis, LAYERS, type Layer, NONE, type Observation, PARTS, type Part, type PortLedger, type Prediction, type Probe, type ProbeContext, type ProbeMode, type ProbeOutcome, type RangeGrant, type Reach, type Runner, type RunnerOptions, STANDARD_CATALOG, STANDARD_CATALOG_SPEC, STANDARD_FAULTS, STANDARD_FEATURES, STRENGTHS, type Scope, type ScopeDecision, type Strength, type Target, UNKNOWN, type ValueOf, compileCatalog, diagnose, expand, explain, isLayer, layerRank, predictive };
144
+ /** The function that opens a TCP socket. A test can give a function that gives a socket with no connection. */
145
+ type Dial = (options: TcpNetConnectOpts) => Socket;
146
+ /** The options of the native probes that connect. */
147
+ interface ConnectOptions {
148
+ /** The function that opens a TCP socket. The default is `connect` of `node:net`. */
149
+ readonly dial?: Dial | undefined;
150
+ }
151
+ /** The time limit of a probe run, when its input gives none: 5 seconds. */
152
+ export declare const DEFAULT_TIMEOUT_MS = 5e3;
153
+ /** This function maps an error code of a TCP connect to its outcome. */
154
+ export declare function connectOutcome(code: string | undefined): ConnectOutcome;
155
+ /** This function maps an error of a TLS handshake to its outcome. */
156
+ export declare function handshakeOutcome(thrown: unknown, expired: boolean): HandshakeOutcome;
157
+ /** This function maps the authorization error of a TLS socket to the problem of the certificate. */
158
+ export declare function certProblem(code: string): CertProblem;
159
+ /** The TCP phase of a probe run. The times are readings of the clock of the runner. */
160
+ interface TcpPhase {
161
+ readonly address: string;
162
+ readonly port: number;
163
+ readonly family: 4 | 6;
164
+ readonly start: number;
165
+ readonly end: number;
166
+ readonly outcome: ConnectOutcome;
167
+ readonly code?: string | undefined;
168
+ }
169
+ /** The TLS phase of a probe run. */
170
+ interface TlsPhase {
171
+ readonly servername?: string | undefined;
172
+ readonly start: number;
173
+ readonly end: number;
174
+ readonly outcome: HandshakeOutcome;
175
+ readonly protocol?: string | undefined;
176
+ readonly cipher?: string | undefined;
177
+ readonly alpn?: string | undefined;
178
+ readonly code?: string | undefined;
179
+ readonly certificate?: TlsCertificate | undefined;
180
+ }
181
+ /** The fields of a response head that an HTTP fact keeps. */
182
+ export declare const KEPT_FIELDS: readonly string[];
183
+ /** The HTTP phase of a probe run. */
184
+ interface HttpPhase {
185
+ readonly method: "GET" | "HEAD";
186
+ readonly host: string;
187
+ readonly path: string;
188
+ readonly start: number;
189
+ /** The time of the head of the response. */
190
+ readonly head?: number | undefined;
191
+ readonly end: number;
192
+ readonly outcome: HttpOutcome;
193
+ readonly status?: number | undefined;
194
+ readonly version?: string | undefined;
195
+ readonly fields: Readonly<Record<string, string>>;
196
+ readonly bytes: number;
197
+ readonly truncated: boolean;
198
+ readonly code?: string | undefined;
199
+ }
200
+ /** The input of the DNS probe: one query for the addresses of a name, to one resolver. */
201
+ interface DnsInput {
202
+ readonly name: string;
203
+ /** The record type. The default is `A`. */
204
+ readonly record?: RecordType | undefined;
205
+ /** The IP address of the resolver. */
206
+ readonly resolver: string;
207
+ /** The port of the resolver. The default is 53. */
208
+ readonly port?: number | undefined;
209
+ readonly timeoutMs?: number | undefined;
210
+ }
211
+ /** The raw output of the DNS probe. The times are readings of the clock of the runner. */
212
+ interface DnsRaw {
213
+ readonly name: string;
214
+ readonly record: RecordType;
215
+ readonly resolver: string;
216
+ readonly start: number;
217
+ readonly end: number;
218
+ readonly outcome: DnsOutcome;
219
+ readonly addresses: readonly string[];
220
+ readonly ttl?: number | undefined;
221
+ readonly code?: string | undefined;
222
+ }
223
+ /** This function maps an error code of a DNS query to its outcome. */
224
+ export declare function dnsOutcome(code: string | undefined): DnsOutcome;
225
+ /**
226
+ * The DNS probe sends one query for the addresses of a name to one resolver. Its peer is the resolver, not the name.
227
+ * The query uses no search domain.
228
+ */
229
+ export declare const DNS_PROBE: Probe<DnsInput, DnsRaw>;
230
+ /** The input of the TCP probe: one connect to an IP address and a port. */
231
+ interface TcpInput {
232
+ readonly address: string;
233
+ readonly port: number;
234
+ readonly timeoutMs?: number | undefined;
235
+ }
236
+ /** The raw output of the TCP probe. */
237
+ interface TcpRaw {
238
+ readonly tcp: TcpPhase;
239
+ }
240
+ /** This function makes the TCP probe. It connects, and then it closes the connection. */
241
+ export declare function tcpProbe(options?: ConnectOptions): Probe<TcpInput, TcpRaw>;
242
+ /** The TCP probe with the `connect` of `node:net`. */
243
+ export declare const TCP_PROBE: Probe<TcpInput, TcpRaw>;
244
+ /** The input of the TLS probe: a TCP connect and a TLS handshake. */
245
+ interface TlsInput {
246
+ readonly address: string;
247
+ /** The port. The default is 443. */
248
+ readonly port?: number | undefined;
249
+ /** The name for SNI and for the check of the certificate. */
250
+ readonly servername?: string | undefined;
251
+ readonly alpn?: readonly string[] | undefined;
252
+ readonly timeoutMs?: number | undefined;
253
+ }
254
+ /** The raw output of the TLS probe. It has no TLS phase when the TCP connect failed. */
255
+ interface TlsRaw {
256
+ readonly tcp: TcpPhase;
257
+ readonly tls?: TlsPhase | undefined;
258
+ }
259
+ /** The options of the TLS and HTTP probes. */
260
+ interface TlsProbeOptions extends ConnectOptions {
261
+ /** More roots of trust, as PEM text: the roots that the user trusts, for example the root of a company. */
262
+ readonly roots?: readonly string[] | undefined;
263
+ /**
264
+ * More public roots, as PEM text. A chain that ends at one of them gets the trust `public`. A lab gives its own
265
+ * root here, so that its servers stand for servers on the internet.
266
+ */
267
+ readonly publicRoots?: readonly string[] | undefined;
268
+ }
269
+ /**
270
+ * This function makes the TLS probe. It measures the TCP connect and the TLS handshake apart. It examines the
271
+ * certificate, and it does not refuse a certificate that is not valid.
272
+ */
273
+ export declare function tlsProbe(options?: TlsProbeOptions): Probe<TlsInput, TlsRaw>;
274
+ /** The TLS probe with the public roots and the roots of the computer. */
275
+ export declare const TLS_PROBE: Probe<TlsInput, TlsRaw>;
276
+ /** The input of the HTTP probe: one HTTP/1.1 request over TCP, or over TLS for `https`. */
277
+ interface HttpInput {
278
+ readonly address: string;
279
+ readonly scheme: "http" | "https";
280
+ /** The port. The default is 80 for `http` and 443 for `https`. */
281
+ readonly port?: number | undefined;
282
+ /** The name of the host for the `Host` field and for SNI. The default is the address. */
283
+ readonly host?: string | undefined;
284
+ /** The path of the request. The default is `/`. */
285
+ readonly path?: string | undefined;
286
+ /** The method. The default is `GET`. */
287
+ readonly method?: "GET" | "HEAD" | undefined;
288
+ readonly timeoutMs?: number | undefined;
289
+ /** The limit of the bytes of the body that the probe reads. The default is 65536. */
290
+ readonly maxBytes?: number | undefined;
291
+ }
292
+ /** The raw output of the HTTP probe. */
293
+ interface HttpRaw {
294
+ readonly scheme: "http" | "https";
295
+ readonly tcp: TcpPhase;
296
+ readonly tls?: TlsPhase | undefined;
297
+ readonly http?: HttpPhase | undefined;
298
+ }
299
+ /** The limit of the bytes of a body that the HTTP probe reads, when its input gives none: 64 KiB. */
300
+ export declare const DEFAULT_MAX_BYTES = 65536;
301
+ /**
302
+ * This function makes the HTTP probe. It sends one request, follows no redirect, and reads the body up to a limit. It
303
+ * gives the facts of each phase: TCP, TLS for `https`, and HTTP. For `https`, it sends the request only when the
304
+ * certificate passes its check.
305
+ */
306
+ export declare function httpProbe(options?: TlsProbeOptions): Probe<HttpInput, HttpRaw>;
307
+ /** The HTTP probe with the public roots and the roots of the computer. */
308
+ export declare const HTTP_PROBE: Probe<HttpInput, HttpRaw>;
309
+ /** A fact that gave no evidence, with the reason in plain words. */
310
+ export interface Skipped {
311
+ readonly fact: string;
312
+ readonly reason: string;
313
+ }
314
+ /** The evidence of a list of facts, and the facts that gave no evidence. */
315
+ export interface Reading {
316
+ readonly evidence: readonly Evidence[];
317
+ readonly skipped: readonly Skipped[];
318
+ }
319
+ /** The options of `readEvidence`. */
320
+ export interface ReadOptions {
321
+ /** This function tells if a fact is about the target (`true`) or about a reference host (`false`). The default is `true`. */
322
+ readonly primary?: ((fact: Fact) => boolean) | undefined;
323
+ /**
324
+ * The IP address of the default gateway. The ICMP echo facts of this address give the feature `gateway.reply`. The
325
+ * ICMP echo facts of the other addresses give the feature `icmp.reply`.
326
+ */
327
+ readonly gateway?: string | undefined;
328
+ }
329
+ /** A bin of a time or a ratio. A number below `below` gets `value`. The last bin has no limit. */
330
+ export interface Bin {
331
+ readonly below?: number | undefined;
332
+ readonly value: string;
333
+ }
334
+ /** The bins of the feature `tcp.time`, in milliseconds. A connect of 900 ms or more sent its SYN again. */
335
+ export declare const TCP_TIME_BINS: readonly Bin[];
336
+ /** The bins of the feature `tls.ratio`: the time of the TLS handshake divided by the time of the TCP connect. */
337
+ export declare const TLS_RATIO_BINS: readonly Bin[];
338
+ /** The bins of the feature `http.ttfb`: the time to the first byte divided by the time of the TCP connect. */
339
+ export declare const HTTP_TTFB_BINS: readonly Bin[];
340
+ /**
341
+ * The smallest time of a TCP connect in a ratio, in milliseconds. On a local link, a ratio with a smaller time measures
342
+ * only the cost of the cryptography.
343
+ */
344
+ export declare const MIN_CONNECT_MS = 1;
345
+ /** The value of the feature `dns.answer` for each outcome of a DNS query. `nodata` tells that the name exists. */
346
+ export declare const DNS_ANSWER_VALUES: Readonly<Partial<Record<DnsOutcome, string>>>;
347
+ /** The value of the feature `tcp.connect` for each outcome of a TCP connect. */
348
+ export declare const TCP_CONNECT_VALUES: Readonly<Partial<Record<ConnectOutcome, string>>>;
349
+ /**
350
+ * The value of the feature `tls.handshake` for each outcome of a TLS handshake. The catalog has no value for `not-tls`
351
+ * and `closed` yet. The lab runs (ND-7) tell which faults cause them.
352
+ */
353
+ export declare const TLS_HANDSHAKE_VALUES: Readonly<Partial<Record<HandshakeOutcome, string>>>;
354
+ /** The value of the feature `tls.trust` for each trust. A chain that ends at no root of the store has no public root. */
355
+ export declare const TLS_TRUST_VALUES: Readonly<Record<Trust, string>>;
356
+ /** The value of the feature `icmp.reply` for each outcome of the ICMP echo requests to an address. */
357
+ export declare const ICMP_REPLY_VALUES: Readonly<Partial<Record<EchoOutcome, string>>>;
358
+ /**
359
+ * The value of the feature `gateway.reply` for each outcome of the ICMP echo requests to the gateway. When this computer
360
+ * tells that the gateway is unreachable, the gateway gives no reply.
361
+ */
362
+ export declare const GATEWAY_REPLY_VALUES: Readonly<Partial<Record<EchoOutcome, string>>>;
363
+ /**
364
+ * The bins of the feature `path.loss`, on the share of the echo requests with a reply. A share of 1 has no loss. A share
365
+ * of 0.95 or more has a loss of up to 5 %.
366
+ */
367
+ export declare const PATH_LOSS_BINS: readonly Bin[];
368
+ /**
369
+ * The smallest number of echo requests that gives the feature `path.loss`. With 20 requests, one lost request is a loss
370
+ * of 5 %. With no reply, the feature `icmp.reply` tells the result, not `path.loss`.
371
+ */
372
+ export declare const LOSS_MIN_SENT = 20;
373
+ /** The suffixes of the names of local networks and of the special-use names (RFC 6761, RFC 6762 and RFC 8375). */
374
+ export declare const LOCAL_SUFFIXES: readonly string[];
375
+ /** This function gives the value of the first bin that holds `x`. */
376
+ export declare function binOf(bins: readonly Bin[], x: number): string;
377
+ /** This function tells if a name is a local name: a name with one label, or a name with a local suffix. */
378
+ export declare function isLocalName(name: string): boolean;
379
+ /**
380
+ * This function changes facts into evidence for the model.
381
+ *
382
+ * - The reader gives one evidence for each feature, subject and role. When a subject has more facts, the last fact decides.
383
+ * - For `dns.answer`, one answer `ok` of a name and a resolver decides. For `dns.address`, one private address decides.
384
+ * - The order of the facts is the order of the runner. A ratio uses the last TCP connect before the handshake or the request.
385
+ * - An ICMP echo fact gives `gateway.reply` for the gateway, and `icmp.reply` for each other address.
386
+ * - An ICMP echo fact with replies to `LOSS_MIN_SENT` requests or more gives `path.loss`. A report of `mtr` gives it from
387
+ * the last hop, when the address answered there.
388
+ * - A trace of `traceroute` gives no evidence. The catalog has no feature for the hops of a path.
389
+ */
390
+ export declare function readEvidence(facts: readonly Fact[], options?: ReadOptions): Reading;
391
+ export { ADDRESS_CLASSES, AddressClass, AddressFamily, type Availability, CERT_PROBLEMS, CONNECT_OUTCOMES, type Catalog, type CatalogSpec, type Cause, CertProblem, Cidr, CidrSet, type ClockOrigin, type ConnectOptions, ConnectOutcome, type Contribution, DNS_ANSWER, DNS_OUTCOMES, type Diagnosis, type Dial, type Distribution, DnsAnswer, type DnsInput, DnsOutcome, type DnsRaw, ECHO_OUTCOMES, EchoOutcome, type Evidence, type Expectation, FLOOR, type Fact, type FactKind, type FactSource, type FactTime, type Fault, type Feature, type Grant, type GrantBasis, HANDSHAKE_OUTCOMES, HTTP_OUTCOMES, HTTP_RESPONSE, HandshakeOutcome, type HostGrant, type HostKind, type HttpInput, HttpOutcome, type HttpPhase, type HttpRaw, HttpResponse, type Hypothesis, ICMP_ECHO, IcmpEcho, LAB_RECORD_FORMAT, LAYERS, type LabBars, type LabCause, type LabGate, type LabRecord, type LabScore, type LabStatus, type LabVerdict, type Layer, NATIVE_KINDS, NONE, type Observation, PARTS, PATH_REPORT, PATH_TRACE, type Part, PathReport, PathTrace, type PortLedger, type Prediction, type Probe, type ProbeContext, type ProbeMode, type ProbeOutcome, RECORD_TYPES, type RangeGrant, type Reach, RecordType, ReportHop, type Runner, type RunnerOptions, STANDARD_CATALOG, STANDARD_CATALOG_SPEC, STANDARD_FAULTS, STANDARD_FEATURES, STRENGTHS, type Scope, type ScopeDecision, type Strength, TCP_CONNECT, TLS_HANDSHAKE, TOOL_KINDS, TRACE_OUTCOMES, TRUSTS, type Target, TcpConnect, type TcpInput, type TcpPhase, type TcpRaw, TlsCertificate, TlsHandshake, type TlsInput, type TlsPhase, type TlsProbeOptions, type TlsRaw, TraceHop, TraceOutcome, Trust, UNKNOWN, type ValueOf, addressClass, addressFamily, addressKind, canonicalAddress, canonicalHost, cidrContains, cidrSet, compileCatalog, defineFactKind, defineProbe, diagnose, expand, explain, factsOf, formatCidr, formatTarget, hostKind, isFactOf, isLayer, labGate, labRecordOf, layerRank, observe, parseCidr, parseTarget, predictive, sameTarget, scoreLab, target };
287
392
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/target.ts","../src/fact.ts","../src/probe.ts","../src/scope.ts","../src/run.ts"],"mappings":";;;;KAIY;;;;;;UAOK;WACN;WACA,MAAM;WACN;;;wBAcK,SAAS,eAAe;;wBAQxB,cAAc;;wBAQd,OAAO,cAAc,gBAAgB;;wBAMrC,aAAa,GAAG;;wBAMhB,WAAW,GAAG,QAAQ,GAAG;;;;;;;;wBAwBzB,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;;wBAKvC,eAAe,GAAG,MAAM,SAAS,KAAK,SAAS;;wBAM/C,SAAS,GAAG,MAAM,SAAS,IAAI,MAAM,OAAO,QAAQ,KAAK;;wBAKzD,QAAQ,GAAG,MAAM,S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B;WACN;WACA;;;UAIM;WACN,OAAO;WACP,OAAO;;WAEP;;;;;;;UAQM;WACN,QAAQ;EACjB,SAAS;EACT,kBAAkB;;EAElB,MAAM,iBAAiB;EACvB,IAAI,GAAG,GAAG,OAAO,MAAM,GAAG,IAAI,OAAO,GAAG,SAAS,cAAc,QAAQ,aAAa;;;wBActE,aAAa,SAAS,gBAAgB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/scope.ts","../src/run.ts","../src/probes/socket.ts","../src/probes/native.ts","../src/readers.ts"],"mappings":";;;;;;;;;;;;;;;KAaY;;;;;;;KAQA,QAAQ,YAAY;;UAGf;WACN;WACA;WACA;WACA,OAAO;WACP;;;UAIM;WACN;WACA;WACA,OAAO;WACP;;;;;;;;UASM;WACN,iBAAiB;WACjB;;;qBAIE;;KAGD;WACG;WAAwB,OAAO;;WAC/B;WAAyB;;;KAG5B,aAAa,oBAAoB;;wBAG7B,cAAc,OAAO;;;;;;wBAgBrB,QAAQ,iBAAiB,SAAS;WAAoB;IAAkC,OAAO;;;;;wBAY/F,WAAW,GAAG,QAAQ,gBAAgB;;wBAMtC,cAAc,cAAc,iBAAiB,kBAAkB;;wBAS/D,MAAM,OAAO,OAAO,iBAAiB,UAAU,OAAO;;;;;;;wBA2BtD,YAAY,OAAO,OAAO,MAAM,QAAQ,SAAQ,aAAyB;;;;;;;;;;KCtH7E,aAAa;WACV;WAAyB,MAAM;WAAmB,KAAK;WAAY,gBAAgB;;WACnF;WAA4B,MAAM;WAAiB;;WACnD;WAAgC;;WAChC;WAA2B;WAA2C;WAAwB,MAAM;;WACpG;WAA4B;;;UAG1B;WACN;WACA;;;UAIM;WACN,OAAO;WACP,OAAO;;WAEP;;;;;;;UAQM;WACN,QAAQ;EACjB,SAAS;EACT,kBAAkB;;EAElB,MAAM,iBAAiB;EACvB,IAAI,GAAG,GAAG,OAAO,MAAM,GAAG,IAAI,OAAO,GAAG,SAAS,cAAc,QAAQ,aAAa;;;wBActE,aAAa,SA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