@ai-ecoverse/slicc-kernel 1.18.1 → 1.20.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.
@@ -1643,6 +1643,24 @@ var init_process_children = __esm({
1643
1643
  }
1644
1644
  });
1645
1645
 
1646
+ // src/kernel/net/loopback-names.ts
1647
+ function hostsFile() {
1648
+ return `127.0.0.1 localhost
1649
+ ::1 localhost ip6-localhost
1650
+ ${HOST_LOOPBACK_ADDRESS.join(".")} ${HOST_LOOPBACK}
1651
+ `;
1652
+ }
1653
+ var HOST_LOOPBACK, HOST_LOOPBACK_ADDRESS, PAGE_LOOPBACK, PAGE_LOOPBACK_URL;
1654
+ var init_loopback_names = __esm({
1655
+ "src/kernel/net/loopback-names.ts"() {
1656
+ "use strict";
1657
+ HOST_LOOPBACK = "host.slicc.internal";
1658
+ HOST_LOOPBACK_ADDRESS = [10, 0, 2, 2];
1659
+ PAGE_LOOPBACK = "kernel.localhost";
1660
+ PAGE_LOOPBACK_URL = `http://{port}.${PAGE_LOOPBACK}`;
1661
+ }
1662
+ });
1663
+
1646
1664
  // src/process/process-pty.ts
1647
1665
  function failed(e) {
1648
1666
  const code2 = e?.code;
@@ -2063,8 +2081,10 @@ function useMounts(Fs, env = {}, live = false) {
2063
2081
  mkdirTree.call(Fs, "/dev/.etc");
2064
2082
  writeFile.call(Fs, "/dev/.etc/passwd", passwd);
2065
2083
  writeFile.call(Fs, "/dev/.etc/group", group);
2084
+ writeFile.call(Fs, "/dev/.etc/hosts", hostsFile());
2066
2085
  backing["/etc/passwd"] = "/dev/.etc/passwd";
2067
2086
  backing["/etc/group"] = "/dev/.etc/group";
2087
+ backing["/etc/hosts"] = "/dev/.etc/hosts";
2068
2088
  } catch {
2069
2089
  }
2070
2090
  const open = Fs.open.bind(Fs);
@@ -2083,6 +2103,7 @@ var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC,
2083
2103
  var init_process_fds = __esm({
2084
2104
  "src/process/process-fds.ts"() {
2085
2105
  "use strict";
2106
+ init_loopback_names();
2086
2107
  init_process_pty();
2087
2108
  init_wasi_errno();
2088
2109
  O_CLOEXEC = 524288;
@@ -6002,6 +6023,7 @@ function resolveName(name) {
6002
6023
  return [127, 0, 0, 1];
6003
6024
  }
6004
6025
  if (name === "::1") return [127, 0, 0, 1];
6026
+ if (name.toLowerCase() === HOST_LOOPBACK) return [...HOST_LOOPBACK_ADDRESS];
6005
6027
  return ipv4(name);
6006
6028
  }
6007
6029
  function wasixSocketImports(host, preview1) {
@@ -6110,6 +6132,7 @@ var INET4, INET6, UNIX, STREAM, ADDR_IP_SIZE, LOOPBACK, OPTIONS;
6110
6132
  var init_wasix_sockets = __esm({
6111
6133
  "src/process/wasi/wasix-sockets.ts"() {
6112
6134
  "use strict";
6135
+ init_loopback_names();
6113
6136
  init_wasi_abi();
6114
6137
  init_wasi_files();
6115
6138
  INET4 = 1;