Files
Netcatty/domain/models/portForwarding.ts
T
86d8c5279d fix(port-forwarding): add per-rule auto-reconnect on disconnect (#3328)
* fix(#3326): automated AI fix

* fix: address Codex review on PR #3328

* fix: address Codex review on PR #3328

* fix(port-forwarding): honor explicit reconnect preference

* fix(port-forwarding): save auto-start alongside reconnect preference

* fix(port-forwarding): coordinate tray starts in main window

---------

Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com>
Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
2026-09-12 13:47:34 +08:00

43 lines
1.3 KiB
TypeScript

// Port Forwarding Types
export type PortForwardingType = 'local' | 'remote' | 'dynamic';
/**
* Display / projection status for a port-forwarding rule.
* `unknown` means the authoritative main-process snapshot could not be read;
* it must never be persisted to localStorage.
*/
export type PortForwardingStatus =
| 'inactive'
| 'connecting'
| 'active'
| 'error'
| 'unknown';
export interface PortForwardingRule {
id: string;
label: string;
order?: number;
type: PortForwardingType;
// Common fields
localPort: number;
bindAddress: string; // e.g., '127.0.0.1', '0.0.0.0'
// For local and remote forwarding
remoteHost?: string;
remotePort?: number;
// Host to tunnel through
hostId?: string;
// Auto-start: if true, this rule will automatically start when the app launches
autoStart?: boolean;
// Auto-reconnect: if true, the tunnel automatically reconnects (with bounded
// retries) after an unexpected disconnect, regardless of auto-start
autoReconnect?: boolean;
/**
* Runtime projection for the UI. Authoritative phase lives in the Electron
* main-process registry; this field is rebuilt from snapshots / events and
* must not be treated as durable configuration.
*/
status: PortForwardingStatus;
error?: string;
createdAt: number;
lastUsedAt?: number;
}