@ac-kit/net-address 0.2.2 → 0.3.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/CHANGELOG.md +53 -0
- package/README.md +4 -3
- package/dist/eui/print-eui.d.ts +14 -12
- package/dist/eui/print-eui.d.ts.map +1 -1
- package/dist/eui/print-eui.js +9 -6
- package/dist/eui/print-eui.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @ac-kit/net-address
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7f9f15d: Argument shapes follow one rule: required arguments are positional, `options`
|
|
8
|
+
is optional with every field optional, and five or more parameters become one
|
|
9
|
+
`input` object.
|
|
10
|
+
|
|
11
|
+
- `core`: `truncateCore(input: TruncateCoreInput)` takes `atoms`, `measure`
|
|
12
|
+
and `maxMeasure`; `input.options` (`TruncateCoreOptions`) takes the
|
|
13
|
+
`TruncateOptions` fields with their defaults, plus `ellipsisMeasure`
|
|
14
|
+
(default `measure(ellipsisString)`).
|
|
15
|
+
- `node`: `new ProcessExitWithOutputError(input)` takes
|
|
16
|
+
`{ code, signal, killed, stdout, stderr, options? }`.
|
|
17
|
+
- `async`: `staggeredRace(candidates, attempt, options?)`; `delayMs` defaults
|
|
18
|
+
to 250, RFC 8305's Connection Attempt Delay.
|
|
19
|
+
- `crypto-mac`: `hmac({ hash, blockSizeBytes, key, message, options? })` with
|
|
20
|
+
`options.tagLengthBytes`, and
|
|
21
|
+
`hmacVerify({ hash, blockSizeBytes, key, message, tag })`.
|
|
22
|
+
- `math-grid`: `dfsPackGrid2(items, columnCount, classify, options?)`, with the
|
|
23
|
+
new `GridPackClassifier` type; `findFrontierTilings(input)` takes
|
|
24
|
+
`{ grid, items, getSize, getDedupeKey, getMoveScore, options? }`.
|
|
25
|
+
- `net-address`: `printEui(address, options?)` and
|
|
26
|
+
`printEuiOui(address, options?)` default to the IEEE Std 802 canonical
|
|
27
|
+
spelling: `notation` `"hyphen"`, `letterCase` `"upper"`.
|
|
28
|
+
- `format-monospace`: `renderTableRow(input)` takes
|
|
29
|
+
`{ row, rowIndex, columns, layout, options? }`.
|
|
30
|
+
- `format-asn1`: `module(name, types, options?)`; `ModuleOptions` no longer
|
|
31
|
+
holds `name`.
|
|
32
|
+
- `app-config`: `resolveExtendableConfig(input)` takes
|
|
33
|
+
`{ configData, configPath, configParser, configId, options? }`.
|
|
34
|
+
- `@ac-bench/core`: `new Sampler(policy, bounds, options?)`;
|
|
35
|
+
`runForkUnit(input)` takes `{ unit, signal, sink, file, parentScopeId,
|
|
36
|
+
options? }`; `runCaseOnce(input)` takes
|
|
37
|
+
`{ unit, caseTitle, signal, file, options? }`, with `options.measureOptions`
|
|
38
|
+
defaulting to `{}`.
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [7f9f15d]
|
|
43
|
+
- @ac-kit/core@0.7.0
|
|
44
|
+
- @ac-kit/algo@0.2.4
|
|
45
|
+
- @ac-kit/math-numbers@0.2.4
|
|
46
|
+
|
|
47
|
+
## 0.2.3
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [47e39a2]
|
|
52
|
+
- @ac-kit/core@0.6.0
|
|
53
|
+
- @ac-kit/algo@0.2.3
|
|
54
|
+
- @ac-kit/math-numbers@0.2.3
|
|
55
|
+
|
|
3
56
|
## 0.2.2
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -56,9 +56,10 @@ returns, never the string.
|
|
|
56
56
|
suppressed, the longest run of zero groups compressed to `::` — leftmost on a
|
|
57
57
|
tie, never for a single group — and IPv4-mapped addresses in dotted form.
|
|
58
58
|
|
|
59
|
-
`printEui`
|
|
60
|
-
|
|
61
|
-
`
|
|
59
|
+
`printEui` defaults to the IEEE Std 802 canonical spelling,
|
|
60
|
+
`00-1A-2B-3C-4D-5E`. RFC 7042 writes `00:1a:2b:3c:4d:5e` instead, so pass
|
|
61
|
+
`EUI_PRINT_IETF` when comparing against IETF-style strings; `EUI_PRINT_IEEE`
|
|
62
|
+
names the default.
|
|
62
63
|
|
|
63
64
|
See the
|
|
64
65
|
[generated API docs](https://anthochamp.pages.grenadine.io/node-essentials/api/net-address/)
|
package/dist/eui/print-eui.d.ts
CHANGED
|
@@ -12,33 +12,35 @@ export type EuiNotation =
|
|
|
12
12
|
/** Which case the hexadecimal digits are written in. */
|
|
13
13
|
export type EuiLetterCase = "lower" | "upper";
|
|
14
14
|
/**
|
|
15
|
-
* How to spell an EUI.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* 7042 prints `00:1a:2b:3c:4d:5e`, and a library that quietly picks one makes
|
|
19
|
-
* the other's consumers compare strings that never match.
|
|
15
|
+
* How to spell an EUI. Defaults to the IEEE Std 802 canonical form; RFC 7042
|
|
16
|
+
* prints `00:1a:2b:3c:4d:5e` instead, so pass {@link EUI_PRINT_IETF} when
|
|
17
|
+
* comparing against IETF-style strings.
|
|
20
18
|
*/
|
|
21
19
|
export type EuiPrintOptions = {
|
|
22
|
-
|
|
23
|
-
readonly
|
|
20
|
+
/** Default: `"hyphen"`. */
|
|
21
|
+
readonly notation?: EuiNotation;
|
|
22
|
+
/** Default: `"upper"`. */
|
|
23
|
+
readonly letterCase?: EuiLetterCase;
|
|
24
24
|
};
|
|
25
25
|
/** The IEEE Std 802 canonical spelling: hyphen-separated, uppercase. */
|
|
26
|
-
export declare const EUI_PRINT_IEEE: EuiPrintOptions
|
|
26
|
+
export declare const EUI_PRINT_IEEE: Required<EuiPrintOptions>;
|
|
27
27
|
/** The IETF spelling of RFC 7042: colon-separated, lowercase. */
|
|
28
|
-
export declare const EUI_PRINT_IETF: EuiPrintOptions
|
|
28
|
+
export declare const EUI_PRINT_IETF: Required<EuiPrintOptions>;
|
|
29
29
|
/**
|
|
30
|
-
* Prints an EUI-48 or EUI-64 in the requested notation and case
|
|
30
|
+
* Prints an EUI-48 or EUI-64 in the requested notation and case — by default
|
|
31
|
+
* the IEEE canonical `00-1A-2B-3C-4D-5E`. O(1).
|
|
31
32
|
*
|
|
32
33
|
* @throws RangeError When the address is neither 48 nor 64 bits wide.
|
|
33
34
|
*/
|
|
34
|
-
export declare function printEui(address: BitAddress, options
|
|
35
|
+
export declare function printEui(address: BitAddress, options?: EuiPrintOptions): string;
|
|
35
36
|
/**
|
|
36
37
|
* Prints the leading 24 bits — the OUI, or the CID for a locally assigned
|
|
37
38
|
* address.
|
|
38
39
|
*
|
|
39
40
|
* The Cisco dotted notation has no three-octet form, so it prints hyphenated.
|
|
41
|
+
* Defaults as {@link printEui}.
|
|
40
42
|
*
|
|
41
43
|
* @throws RangeError When the address is neither 48 nor 64 bits wide.
|
|
42
44
|
*/
|
|
43
|
-
export declare function printEuiOui(address: BitAddress, options
|
|
45
|
+
export declare function printEuiOui(address: BitAddress, options?: EuiPrintOptions): string;
|
|
44
46
|
//# sourceMappingURL=print-eui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-eui.d.ts","sourceRoot":"","sources":["../../src/eui/print-eui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,0BAA0B,CAAC;AAG9E,oCAAoC;AACpC,MAAM,MAAM,WAAW;AACtB,0BAA0B;AACxB,OAAO;AACT,0BAA0B;GACxB,QAAQ;AACV,gEAAgE;GAC9D,KAAK;AACP,qBAAqB;GACnB,MAAM,CAAC;AAEV,wDAAwD;AACxD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"print-eui.d.ts","sourceRoot":"","sources":["../../src/eui/print-eui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,0BAA0B,CAAC;AAG9E,oCAAoC;AACpC,MAAM,MAAM,WAAW;AACtB,0BAA0B;AACxB,OAAO;AACT,0BAA0B;GACxB,QAAQ;AACV,gEAAgE;GAC9D,KAAK;AACP,qBAAqB;GACnB,MAAM,CAAC;AAEV,wDAAwD;AACxD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,2BAA2B;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC;IAChC,0BAA0B;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;CACpC,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,eAAe,CAGpD,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,eAAe,CAGpD,CAAC;AA8CF;;;;;GAKG;AACH,wBAAgB,QAAQ,CACvB,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,eAAe,GACvB,MAAM,CAQR;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAC1B,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,eAAe,GACvB,MAAM,CAUR"}
|
package/dist/eui/print-eui.js
CHANGED
|
@@ -16,12 +16,12 @@ function assertEuiWidth(address) {
|
|
|
16
16
|
throw new RangeError(`expected a 48- or 64-bit EUI, got ${address.bitWidth} bits`);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function joinOctets(octets,
|
|
19
|
+
function joinOctets(octets, notation, letterCase) {
|
|
20
20
|
const digits = Array.from(octets, (byte) => {
|
|
21
21
|
const pair = byte.toString(16).padStart(2, "0");
|
|
22
|
-
return
|
|
22
|
+
return letterCase === "upper" ? pair.toUpperCase() : pair;
|
|
23
23
|
});
|
|
24
|
-
switch (
|
|
24
|
+
switch (notation) {
|
|
25
25
|
case "colon": {
|
|
26
26
|
return digits.join(":");
|
|
27
27
|
}
|
|
@@ -41,24 +41,27 @@ function joinOctets(octets, options) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Prints an EUI-48 or EUI-64 in the requested notation and case
|
|
44
|
+
* Prints an EUI-48 or EUI-64 in the requested notation and case — by default
|
|
45
|
+
* the IEEE canonical `00-1A-2B-3C-4D-5E`. O(1).
|
|
45
46
|
*
|
|
46
47
|
* @throws RangeError When the address is neither 48 nor 64 bits wide.
|
|
47
48
|
*/
|
|
48
49
|
export function printEui(address, options) {
|
|
49
50
|
assertEuiWidth(address);
|
|
50
|
-
return joinOctets(bitAddressToBytes(address), options);
|
|
51
|
+
return joinOctets(bitAddressToBytes(address), options?.notation ?? EUI_PRINT_IEEE.notation, options?.letterCase ?? EUI_PRINT_IEEE.letterCase);
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
54
|
* Prints the leading 24 bits — the OUI, or the CID for a locally assigned
|
|
54
55
|
* address.
|
|
55
56
|
*
|
|
56
57
|
* The Cisco dotted notation has no three-octet form, so it prints hyphenated.
|
|
58
|
+
* Defaults as {@link printEui}.
|
|
57
59
|
*
|
|
58
60
|
* @throws RangeError When the address is neither 48 nor 64 bits wide.
|
|
59
61
|
*/
|
|
60
62
|
export function printEuiOui(address, options) {
|
|
61
63
|
assertEuiWidth(address);
|
|
62
|
-
|
|
64
|
+
const notation = options?.notation ?? EUI_PRINT_IEEE.notation;
|
|
65
|
+
return joinOctets(bitAddressToBytes(address).subarray(0, 3), notation === "dot" ? "hyphen" : notation, options?.letterCase ?? EUI_PRINT_IEEE.letterCase);
|
|
63
66
|
}
|
|
64
67
|
//# sourceMappingURL=print-eui.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-eui.js","sourceRoot":"","sources":["../../src/eui/print-eui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAA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AAC,CAAC,QAAQ,EACxC,OAAO,EAAE,UAAU,IAAI,cAAc,CAAC,UAAU,CAChD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/net-address",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Network addresses: IPv4, IPv6, EUI-48/EUI-64 and ports, over one fixed-width prefix core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cidr",
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"prepack": "yarn build"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@ac-kit/algo": "^0.2.
|
|
50
|
-
"@ac-kit/core": "^0.
|
|
51
|
-
"@ac-kit/math-numbers": "^0.2.
|
|
52
|
-
"@types/web": "^0.0.
|
|
49
|
+
"@ac-kit/algo": "^0.2.4",
|
|
50
|
+
"@ac-kit/core": "^0.7.0",
|
|
51
|
+
"@ac-kit/math-numbers": "^0.2.4",
|
|
52
|
+
"@types/web": "^0.0.362"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@ac-kit/tsconfig": "0.1.0",
|
|
56
56
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
57
57
|
"@ac-kit/vitest-config": "0.1.1",
|
|
58
58
|
"@typescript/native": "typescript@7.0.2",
|
|
59
|
-
"rimraf": "6.1.
|
|
59
|
+
"rimraf": "6.1.4",
|
|
60
60
|
"typedoc": "0.28.20",
|
|
61
61
|
"typescript": "@typescript/typescript6@6.0.2"
|
|
62
62
|
},
|