portless 0.15.0 → 0.15.2

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/dist/index.d.ts CHANGED
@@ -6,6 +6,12 @@ import * as net from 'node:net';
6
6
  interface RouteInfo {
7
7
  hostname: string;
8
8
  port: number;
9
+ /**
10
+ * Public Tailscale Serve/Funnel URL for this route, when one is active
11
+ * (e.g. "https://my-device.tail1234.ts.net"). Requests whose Host header
12
+ * matches this URL's hostname are routed to the same upstream.
13
+ */
14
+ tailscaleUrl?: string;
9
15
  }
10
16
  interface ProxyServerOptions {
11
17
  /** Called on each request to get the current route table. */
@@ -14,6 +20,8 @@ interface ProxyServerOptions {
14
20
  proxyPort: number;
15
21
  /** TLD suffix used for hostnames (default: "localhost"). */
16
22
  tld?: string;
23
+ /** All TLD suffixes used for hostnames. The first one is used for examples. */
24
+ tlds?: string[];
17
25
  /**
18
26
  * When true, only exact hostname matches are used. Unregistered subdomain
19
27
  * prefixes return 404 instead of falling back to the base service.
@@ -145,6 +153,13 @@ declare class RouteStore {
145
153
  removeRoute(hostname: string, ownerPid?: number): void;
146
154
  }
147
155
 
156
+ /**
157
+ * Open a TCP connection to a local app port, trying both loopback families
158
+ * instead of hardcoding IPv4. Uses Node's Happy Eyeballs implementation
159
+ * (`autoSelectFamily`) with a fixed address list, so no DNS lookup happens:
160
+ * 127.0.0.1 is attempted first and `::1` is tried when it fails (issue #320).
161
+ */
162
+ declare function createLoopbackConnection(port: number): net.Socket;
148
163
  /**
149
164
  * When running under sudo, fix file ownership so the real user can
150
165
  * read/write the file later without sudo. No-op on Windows or when not
@@ -170,6 +185,11 @@ declare function formatUrl(hostname: string, proxyPort: number, tls?: boolean):
170
185
  * appends the TLD suffix if needed.
171
186
  */
172
187
  declare function parseHostname(input: string, tld?: string): string;
188
+ /**
189
+ * Parse a hostname input for every configured TLD. If the input already ends
190
+ * with one of those TLDs, use the stripped base name for the full set.
191
+ */
192
+ declare function parseHostnames(input: string, tlds?: readonly string[]): string[];
173
193
 
174
194
  /**
175
195
  * Extract the portless-managed block from /etc/hosts content.
@@ -212,4 +232,4 @@ declare function getManagedHostnames(): string[];
212
232
  */
213
233
  declare function checkHostResolution(hostname: string): Promise<boolean>;
214
234
 
215
- export { DIR_MODE, FILE_MODE, PORTLESS_HEADER, type ProxyServer, type ProxyServerOptions, RouteConflictError, type RouteInfo, type RouteMapping, RouteStore, buildBlock, checkHostResolution, cleanHostsFile, createHttpRedirectServer, createProxyServer, escapeHtml, extractManagedBlock, fixOwnership, formatUrl, getManagedHostnames, isErrnoException, isProcessAlive, parseHostname, removeBlock, shouldAutoSyncHosts, syncHostsFile };
235
+ export { DIR_MODE, FILE_MODE, PORTLESS_HEADER, type ProxyServer, type ProxyServerOptions, RouteConflictError, type RouteInfo, type RouteMapping, RouteStore, buildBlock, checkHostResolution, cleanHostsFile, createHttpRedirectServer, createLoopbackConnection, createProxyServer, escapeHtml, extractManagedBlock, fixOwnership, formatUrl, getManagedHostnames, isErrnoException, isProcessAlive, parseHostname, parseHostnames, removeBlock, shouldAutoSyncHosts, syncHostsFile };
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  checkHostResolution,
9
9
  cleanHostsFile,
10
10
  createHttpRedirectServer,
11
+ createLoopbackConnection,
11
12
  createProxyServer,
12
13
  escapeHtml,
13
14
  extractManagedBlock,
@@ -17,10 +18,11 @@ import {
17
18
  isErrnoException,
18
19
  isProcessAlive,
19
20
  parseHostname,
21
+ parseHostnames,
20
22
  removeBlock,
21
23
  shouldAutoSyncHosts,
22
24
  syncHostsFile
23
- } from "./chunk-PCBKLZK2.js";
25
+ } from "./chunk-T7CGCIRO.js";
24
26
  export {
25
27
  DIR_MODE,
26
28
  FILE_MODE,
@@ -31,6 +33,7 @@ export {
31
33
  checkHostResolution,
32
34
  cleanHostsFile,
33
35
  createHttpRedirectServer,
36
+ createLoopbackConnection,
34
37
  createProxyServer,
35
38
  escapeHtml,
36
39
  extractManagedBlock,
@@ -40,6 +43,7 @@ export {
40
43
  isErrnoException,
41
44
  isProcessAlive,
42
45
  parseHostname,
46
+ parseHostnames,
43
47
  removeBlock,
44
48
  shouldAutoSyncHosts,
45
49
  syncHostsFile
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portless",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Replace port numbers with stable, named .localhost URLs. For humans and agents.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",