@caprid/relay-quic 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +25 -25
  2. package/package.json +9 -9
package/README.md CHANGED
@@ -1,20 +1,19 @@
1
1
  # @caprid/relay-quic
2
2
 
3
- The Relay SDK's transport adapter for Node. It carries MOQT straight on a QUIC connection (native QUIC, with
4
- the MOQT ALPNs the SDK offers: `moqt-22`, then `moqt-20`), through a napi-rs addon over [quinn](https://github.com/quinn-rs/quinn), so a plain Node script can publish
5
- and subscribe without a browser. It follows the transport adapter contract in
6
- [`spec/transport-adapter.md`](../../../spec/transport-adapter.md) and passes its conformance suite. The design is
7
- [ADR 0002](../../../docs/adr/0002-node-adapter-speaks-native-quic.md).
8
-
9
- The package is private for now: its prebuilt binaries are built and packed in CI, but not yet published (#195).
3
+ The Relay SDK's transport adapter for Node. It carries MOQT straight on a QUIC connection (native QUIC), offering the
4
+ ALPNs `moqt-22`, then `moqt-20`. A napi-rs addon over [quinn](https://github.com/quinn-rs/quinn) does the QUIC work, so
5
+ a plain Node script can publish and subscribe without a browser. The adapter follows the transport adapter contract in
6
+ [`spec/transport-adapter.md`](https://github.com/caprids/relay-sdks/blob/main/spec/transport-adapter.md) and passes its conformance suite. The design is
7
+ [ADR 0002](https://github.com/caprids/relay-sdks/blob/main/docs/adr/0002-node-adapter-speaks-native-quic.md).
10
8
 
11
9
  ## Use
12
10
 
13
- Most scripts need no code from this package: `@caprid/relay/node` uses it by default, and takes the trust options below
14
- (see the [SDK README](../../README.md#node)). Install it next to `@caprid/relay`.
11
+ Install it next to `@caprid/relay`. Most scripts need no code from this package: `@caprid/relay/node` uses it by
12
+ default and takes the trust options below (see the [SDK README](https://github.com/caprids/relay-sdks/blob/main/ts/README.md#node)).
15
13
 
16
- To use it with `@caprid/relay` directly, pass the factory as `createTransport`. The URL stays the same `https://` endpoint the browser uses: the adapter dials
17
- only its host and port, and the core sends the path, the token and the authority in SETUP.
14
+ To use it with `@caprid/relay` directly, pass the factory as `createTransport`. The URL is the same `https://` endpoint
15
+ the browser uses. The adapter dials only its host and port, and the core sends the path, the token, and the authority in
16
+ SETUP.
18
17
 
19
18
  ```ts
20
19
  import { connectRelayPublisher } from '@caprid/relay';
@@ -22,6 +21,7 @@ import { nativeQuicTransport } from '@caprid/relay-quic';
22
21
 
23
22
  const publisher = await connectRelayPublisher({
24
23
  url: 'https://relay.mux.global',
24
+ namespace: ['acme', 'rooms', '42'],
25
25
  getToken: () => process.env.RELAY_TOKEN,
26
26
  createTransport: nativeQuicTransport(),
27
27
  });
@@ -36,19 +36,19 @@ By default a dial trusts the platform's root certificates.
36
36
 
37
37
  - `ca`: extra trust anchors, PEM, as a string, bytes, or an array of either. They are added to the platform's roots.
38
38
  - `serverCertificateHashes`: `[{ algorithm: 'sha-256', value }]`, in the W3C WebTransport shape. The server's
39
- end-entity certificate must match one hash, and its chain is not validated. The handshake signature is still
40
- checked. Unlike a browser, the adapter does not require the certificate to be valid for 14 days or less.
39
+ end-entity certificate must match one hash, and the adapter does not validate its chain. It still checks the
40
+ handshake signature. Unlike a browser, the adapter does not require the certificate to be valid for 14 days or less.
41
41
 
42
42
  ## Process lifetime
43
43
 
44
44
  An open session keeps the Node process alive, from the start of the dial until `closed` settles. After that the
45
- adapter holds nothing: a script exits once it has closed its connections. Closing before the dial completes cancels
45
+ adapter holds nothing, so a script exits once it has closed its connections. Closing before the dial completes cancels
46
46
  the dial and releases its socket.
47
47
 
48
48
  ## Prebuilt binaries
49
49
 
50
- Each platform's binary ships in its own package, which `@caprid/relay-quic` lists as an optional dependency, the napi-rs
51
- convention. A package manager installs only the one whose `os`, `cpu` and `libc` match, so no Rust is needed.
50
+ Each platform's binary ships in its own package, which `@caprid/relay-quic` lists as an optional dependency, as napi-rs
51
+ packages do. A package manager installs only the one whose `os`, `cpu`, and `libc` match, so you need no Rust.
52
52
 
53
53
  | Platform package | Built on | Packed | Installed |
54
54
  | --- | --- | --- | --- |
@@ -66,7 +66,7 @@ needs too.
66
66
 
67
67
  `src/addon.ts` loads a local build, `native/relay-quic.<platform>.node`, first, so a build from source always wins.
68
68
  Without one it loads `@caprid/relay-quic-<platform>`. If neither is there, the error names both. A platform package that is
69
- installed but cannot load (a wrong libc, say) throws its own error rather than being skipped.
69
+ installed but cannot load, such as one built for the wrong libc, throws its own error. The loader does not skip it.
70
70
 
71
71
  The `relay-quic binaries` workflow (`.github/workflows/relay-quic-binaries.yml`) runs on each PR that touches the crate,
72
72
  the loader or the packaging. It builds every target, and `scripts/pack.mjs` packs the main package, the platform
@@ -74,21 +74,21 @@ packages and `@caprid/moq-core`, with the sizes in the job summary. `scripts/smo
74
74
  npm on each platform (musl in Alpine, arm64 Linux under QEMU, darwin-x64 under Rosetta). It checks that npm picked only
75
75
  the matching binary, that the loader finds it, and that a dial sends a QUIC Initial and can be cancelled. The
76
76
  `Release TypeScript SDK` workflow (`release-ts.yml`) calls this one and publishes the tarballs it packs, with the rest of
77
- the TypeScript packages ([releasing](../../../docs/releasing.md)).
77
+ the TypeScript packages ([releasing](https://github.com/caprids/relay-sdks/blob/main/docs/releasing.md)).
78
78
 
79
- The platform packages live in `npm/<platform>/`, generated by `napi create-npm-dirs` from `napi.targets`. The
80
- optional dependencies on them are added only when packing, so the lockfile never names unpublished packages.
81
- `pnpm check:boundaries` checks that the two agree.
79
+ The platform packages live in `npm/<platform>/`. `napi create-npm-dirs` generates them from `napi.targets` in
80
+ `package.json`. `scripts/pack.mjs` adds the optional dependencies on them only when it packs, so the lockfile never
81
+ names them. `pnpm check:boundaries`, run from `ts/`, checks that `npm/` and `napi.targets` agree.
82
82
 
83
83
  ## Stability
84
84
 
85
85
  Before 1.0, a minor version can break the API. This package and its platform packages release
86
- together with `@caprid/relay` at the same version; see the [changelog](../../CHANGELOG.md).
86
+ together with `@caprid/relay` at the same version; see the [changelog](https://github.com/caprids/relay-sdks/blob/main/ts/CHANGELOG.md).
87
87
 
88
88
  ## Building the addon
89
89
 
90
- To work on the crate, build the addon locally with Rust. The mise tasks bring the toolchain `mise.toml` pins; nothing
91
- else in the repo installs one.
90
+ To work on the crate, build the addon locally with Rust. The mise tasks bring the toolchain that `mise.toml` pins.
91
+ Nothing else in the repo installs one.
92
92
 
93
93
  ```sh
94
94
  mise run ts:test:conformance:node # builds the addon, then runs the conformance suite against it
@@ -103,7 +103,7 @@ With a Rust toolchain of your own, `cd ts && pnpm --filter @caprid/relay-quic bu
103
103
  `build:native` also regenerates `src/native.d.ts`, the addon's typings, from the Rust. Commit it with any change to
104
104
  the crate. CI checks that it matches.
105
105
 
106
- `pnpm check` builds and checks the TypeScript only, so the rest of the workspace needs no Rust.
106
+ `pnpm check`, run from `ts/`, builds and checks the TypeScript only, so the rest of the workspace needs no Rust.
107
107
 
108
108
  ## Layout
109
109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caprid/relay-quic",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Native QUIC transport adapter for the Relay SDK in Node",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -33,7 +33,7 @@
33
33
  ]
34
34
  },
35
35
  "dependencies": {
36
- "@caprid/moq-core": "0.1.0"
36
+ "@caprid/moq-core": "0.2.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@napi-rs/cli": "3.10.5",
@@ -46,13 +46,13 @@
46
46
  "access": "public"
47
47
  },
48
48
  "optionalDependencies": {
49
- "@caprid/relay-quic-darwin-arm64": "0.1.0",
50
- "@caprid/relay-quic-darwin-x64": "0.1.0",
51
- "@caprid/relay-quic-linux-arm64-gnu": "0.1.0",
52
- "@caprid/relay-quic-linux-arm64-musl": "0.1.0",
53
- "@caprid/relay-quic-linux-x64-gnu": "0.1.0",
54
- "@caprid/relay-quic-linux-x64-musl": "0.1.0",
55
- "@caprid/relay-quic-win32-x64-msvc": "0.1.0"
49
+ "@caprid/relay-quic-darwin-arm64": "0.2.0",
50
+ "@caprid/relay-quic-darwin-x64": "0.2.0",
51
+ "@caprid/relay-quic-linux-arm64-gnu": "0.2.0",
52
+ "@caprid/relay-quic-linux-arm64-musl": "0.2.0",
53
+ "@caprid/relay-quic-linux-x64-gnu": "0.2.0",
54
+ "@caprid/relay-quic-linux-x64-musl": "0.2.0",
55
+ "@caprid/relay-quic-win32-x64-msvc": "0.2.0"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsc -p tsconfig.json",