@impz/testing 7.12.0 → 7.13.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/dist/index.js +46 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -21782,6 +21782,29 @@ function toWholeBlocks(mib) {
21782
21782
 
21783
21783
  // packages/daemon/src/config.ts
21784
21784
  var PortSchema3 = z54.coerce.number().pipe(z54.int().min(1).max(65535));
21785
+ var HostTcpPortsSchema = z54.string().default("").transform((value, ctx) => {
21786
+ const ports = [];
21787
+ const entries = value.trim() === "" ? [] : splitList(value);
21788
+ for (const entry of entries) {
21789
+ const port = /^\d+$/u.test(entry) ? Number(entry) : Number.NaN;
21790
+ if (!Number.isInteger(port) || port < 1 || port > 65535) {
21791
+ ctx.addIssue({
21792
+ code: "custom",
21793
+ message: `IMP_HOST_TCP_PORTS must list TCP ports from 1 to 65535, got ${JSON.stringify(entry)}`
21794
+ });
21795
+ return z54.NEVER;
21796
+ }
21797
+ if (ports.includes(port)) {
21798
+ ctx.addIssue({
21799
+ code: "custom",
21800
+ message: `IMP_HOST_TCP_PORTS lists port ${String(port)} twice`
21801
+ });
21802
+ return z54.NEVER;
21803
+ }
21804
+ ports.push(port);
21805
+ }
21806
+ return ports;
21807
+ });
21785
21808
  var CountSchema3 = z54.coerce.number().pipe(z54.int().positive());
21786
21809
  var DnsServersSchema = z54.array(z54.ipv4()).min(1);
21787
21810
  var PercentSchema = z54.coerce.number().pipe(z54.int().min(0).max(100));
@@ -21797,6 +21820,7 @@ var EnvSchema = z54.object({
21797
21820
  IMP_BROKER_TEST_UPSTREAMS: z54.string().optional(),
21798
21821
  IMP_IDENTITY_ISSUER: IdentityIssuerSchema.optional(),
21799
21822
  IMP_EGRESS_DNS_PORT: PortSchema3.default(7053),
21823
+ IMP_HOST_TCP_PORTS: HostTcpPortsSchema,
21800
21824
  IMP_EGRESS_DENY: z54.string().default(""),
21801
21825
  IMP_HOST_ADDRESSES: z54.string().default(""),
21802
21826
  IMP_RAM_BUDGET_MIB: CountSchema3.default(16384),
@@ -21861,11 +21885,26 @@ var EnvSchema = z54.object({
21861
21885
  ...TailnetNamesEnvSchema.shape,
21862
21886
  ...PublicMcpEnvSchema.shape
21863
21887
  });
21888
+ function refineHostTcpPorts(parsed, ctx) {
21889
+ for (const [name, port] of [
21890
+ ["IMP_BROKER_PORT", parsed.IMP_BROKER_PORT],
21891
+ ["IMP_EGRESS_DNS_PORT", parsed.IMP_EGRESS_DNS_PORT]
21892
+ ]) {
21893
+ if (parsed.IMP_HOST_TCP_PORTS.includes(port)) {
21894
+ ctx.addIssue({
21895
+ code: "custom",
21896
+ message: `IMP_HOST_TCP_PORTS lists port ${String(port)}, which is ${name}`
21897
+ });
21898
+ }
21899
+ }
21900
+ }
21901
+ var CheckedEnvSchema = EnvSchema.superRefine(refineHostTcpPorts);
21864
21902
  var NetworkEnvSchema = EnvSchema.pick({
21865
21903
  IMP_SUBNET: true,
21866
21904
  IMP_BROKER_PORT: true,
21867
- IMP_EGRESS_DNS_PORT: true
21868
- });
21905
+ IMP_EGRESS_DNS_PORT: true,
21906
+ IMP_HOST_TCP_PORTS: true
21907
+ }).superRefine(refineHostTcpPorts);
21869
21908
  function parseCidrList(value) {
21870
21909
  return splitList(value).filter((entry) => entry !== "").map((entry) => {
21871
21910
  const cidr = formatCidr4(entry) ?? formatCidr6(entry);
@@ -21902,7 +21941,7 @@ function checkMoveSettings(testCidr, peerUrl, isE2e) {
21902
21941
  }
21903
21942
  function loadConfig(env) {
21904
21943
  const present = Object.fromEntries(Object.entries(env).filter(([, value]) => value !== ""));
21905
- const parsed = EnvSchema.parse(present);
21944
+ const parsed = CheckedEnvSchema.parse(present);
21906
21945
  const subnet = parseSubnet(parsed.IMP_SUBNET);
21907
21946
  const lastPort = parsed.IMP_PORT_BASE + countSlots(subnet) - 1;
21908
21947
  if (lastPort > 65535) {
@@ -21960,6 +21999,7 @@ function loadConfig(env) {
21960
21999
  sshAuthorizedKeys: parsed.IMP_SSH_AUTHORIZED_KEYS === "true",
21961
22000
  brokerPort: parsed.IMP_BROKER_PORT,
21962
22001
  egressDnsPort: parsed.IMP_EGRESS_DNS_PORT,
22002
+ hostTcpPorts: parsed.IMP_HOST_TCP_PORTS,
21963
22003
  egressDeny: [
21964
22004
  ...new Set([
21965
22005
  ...parseCidrList(parsed.IMP_EGRESS_DENY),
@@ -22177,7 +22217,7 @@ import { join as join49 } from "path";
22177
22217
  // packages/daemon/package.json
22178
22218
  var package_default = {
22179
22219
  name: "@impz/daemon",
22180
- version: "7.12.0",
22220
+ version: "7.13.0",
22181
22221
  private: true,
22182
22222
  description: "impd: the imp host daemon",
22183
22223
  type: "module",
@@ -41932,6 +41972,7 @@ function buildRuleset(input) {
41932
41972
  ' iifname != "imp*" accept',
41933
41973
  " meta nfproto ipv4 accept",
41934
41974
  " icmpv6 type { nd-router-solicit, nd-neighbor-solicit, nd-neighbor-advert } ip6 hoplimit 255 accept",
41975
+ ...input.hostTcpPorts.length === 0 ? [] : [` tcp dport { ${input.hostTcpPorts.join(", ")} } accept`],
41935
41976
  " drop",
41936
41977
  " }",
41937
41978
  " chain dns {",
@@ -42886,6 +42927,7 @@ function createEgressService(deps) {
42886
42927
  uplinks4: host.uplinks.ipv4,
42887
42928
  uplinks6: host.uplinks.ipv6,
42888
42929
  dnsPort: deps.config.egressDnsPort,
42930
+ hostTcpPorts: deps.config.hostTcpPorts,
42889
42931
  setSize: SET_SIZE,
42890
42932
  slots: [...views.values()].map((view) => ({
42891
42933
  slot: view.entry.slot,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/testing",
3
- "version": "7.12.0",
3
+ "version": "7.13.0",
4
4
  "description": "A real impd on stand-ins, for Bun tests of code that drives impd through @impz/client",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "ts-pattern": "^5.9.2",
48
48
  "xstate": "^5.33.3",
49
49
  "zod": "^4.6.7",
50
- "@impz/client": "7.12.0"
50
+ "@impz/client": "7.13.0"
51
51
  },
52
52
  "engines": {
53
53
  "bun": ">=1.4.3"