portless 0.15.1 → 0.15.3
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/README.md +4 -2
- package/dist/{chunk-SD2PIWJU.js → chunk-JSJUKQRJ.js} +77 -20
- package/dist/cli.js +380 -285
- package/dist/index.d.ts +26 -1
- package/dist/index.js +5 -1
- package/package.json +1 -1
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. */
|
|
@@ -147,6 +153,25 @@ declare class RouteStore {
|
|
|
147
153
|
removeRoute(hostname: string, ownerPid?: number): void;
|
|
148
154
|
}
|
|
149
155
|
|
|
156
|
+
type UserHomeOptions = {
|
|
157
|
+
platform?: NodeJS.Platform;
|
|
158
|
+
env?: NodeJS.ProcessEnv;
|
|
159
|
+
homedir?: string;
|
|
160
|
+
passwdHome?: (username: string) => string | null;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Resolve the home directory that owns portless state. When sudo changes the
|
|
164
|
+
* effective user to root, retain the invoking user's home so elevated proxy
|
|
165
|
+
* processes and unprivileged app processes share the same route store.
|
|
166
|
+
*/
|
|
167
|
+
declare function resolveUserHome(options?: UserHomeOptions): string;
|
|
168
|
+
/**
|
|
169
|
+
* Open a TCP connection to a local app port, trying both loopback families
|
|
170
|
+
* instead of hardcoding IPv4. Uses Node's Happy Eyeballs implementation
|
|
171
|
+
* (`autoSelectFamily`) with a fixed address list, so no DNS lookup happens:
|
|
172
|
+
* 127.0.0.1 is attempted first and `::1` is tried when it fails (issue #320).
|
|
173
|
+
*/
|
|
174
|
+
declare function createLoopbackConnection(port: number): net.Socket;
|
|
150
175
|
/**
|
|
151
176
|
* When running under sudo, fix file ownership so the real user can
|
|
152
177
|
* read/write the file later without sudo. No-op on Windows or when not
|
|
@@ -219,4 +244,4 @@ declare function getManagedHostnames(): string[];
|
|
|
219
244
|
*/
|
|
220
245
|
declare function checkHostResolution(hostname: string): Promise<boolean>;
|
|
221
246
|
|
|
222
|
-
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, parseHostnames, removeBlock, shouldAutoSyncHosts, syncHostsFile };
|
|
247
|
+
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, resolveUserHome, 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,
|
|
@@ -19,9 +20,10 @@ import {
|
|
|
19
20
|
parseHostname,
|
|
20
21
|
parseHostnames,
|
|
21
22
|
removeBlock,
|
|
23
|
+
resolveUserHome,
|
|
22
24
|
shouldAutoSyncHosts,
|
|
23
25
|
syncHostsFile
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-JSJUKQRJ.js";
|
|
25
27
|
export {
|
|
26
28
|
DIR_MODE,
|
|
27
29
|
FILE_MODE,
|
|
@@ -32,6 +34,7 @@ export {
|
|
|
32
34
|
checkHostResolution,
|
|
33
35
|
cleanHostsFile,
|
|
34
36
|
createHttpRedirectServer,
|
|
37
|
+
createLoopbackConnection,
|
|
35
38
|
createProxyServer,
|
|
36
39
|
escapeHtml,
|
|
37
40
|
extractManagedBlock,
|
|
@@ -43,6 +46,7 @@ export {
|
|
|
43
46
|
parseHostname,
|
|
44
47
|
parseHostnames,
|
|
45
48
|
removeBlock,
|
|
49
|
+
resolveUserHome,
|
|
46
50
|
shouldAutoSyncHosts,
|
|
47
51
|
syncHostsFile
|
|
48
52
|
};
|