feat(fls): import DHCP, port forwarding and modem settings
importProject carries the DHCP client switch and server settings (hosts and home routers), a home router's port forwarding rows and a modem's pairing into the model; the core gains the types, ported from Swift. The Swift oracle writes them too, and they match on the 13 files Swift reads completely. Configuration text is now trimmed throughout, as Swift trims every value it reads (routes and firewall rules included). Outside those files Swift switches every DHCP server of the Internet examples off: their "aktiv" refers to a shared Boolean it cannot follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -90,6 +90,65 @@ export interface HostWirelessConfiguration {
|
||||
readonly ssid: string;
|
||||
}
|
||||
|
||||
// ── DHCP (Java filius.software.dhcp) ─────────────────────────────────────────
|
||||
|
||||
export interface DhcpClientConfiguration {
|
||||
readonly isEnabled: boolean;
|
||||
}
|
||||
|
||||
export interface DhcpStaticAssignment {
|
||||
readonly id: Id;
|
||||
readonly macAddress: string;
|
||||
readonly ipAddress: string;
|
||||
}
|
||||
|
||||
export interface DhcpServerConfiguration {
|
||||
readonly isActive: boolean;
|
||||
readonly lowerBoundIPAddress: string;
|
||||
readonly upperBoundIPAddress: string;
|
||||
readonly gatewayIPAddress: string;
|
||||
readonly dnsServerIPAddress: string;
|
||||
/** Hand out the gateway and DNS server set here instead of the server's own. */
|
||||
readonly useOwnSettings: boolean;
|
||||
readonly staticAssignments: readonly DhcpStaticAssignment[];
|
||||
}
|
||||
|
||||
/** Java's DHCPServer as its constructor leaves it: off, all addresses 0.0.0.0. */
|
||||
export function dhcpServerConfiguration(fields: Partial<DhcpServerConfiguration> = {}): DhcpServerConfiguration {
|
||||
return {
|
||||
isActive: fields.isActive ?? false,
|
||||
lowerBoundIPAddress: fields.lowerBoundIPAddress ?? '0.0.0.0',
|
||||
upperBoundIPAddress: fields.upperBoundIPAddress ?? '0.0.0.0',
|
||||
gatewayIPAddress: fields.gatewayIPAddress ?? '0.0.0.0',
|
||||
dnsServerIPAddress: fields.dnsServerIPAddress ?? '0.0.0.0',
|
||||
useOwnSettings: fields.useOwnSettings ?? false,
|
||||
staticAssignments: fields.staticAssignments ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
// ── Gateway NAT and remote links ────────────────────────────────────────────
|
||||
|
||||
/** A row of a home router's port forwarding (Java GatewayFirmware.staticNAT), as text. */
|
||||
export interface GatewayPortForwardingRow {
|
||||
readonly protocolValue: string;
|
||||
readonly publicPortValue: string;
|
||||
readonly lanIPAddress: string;
|
||||
readonly lanPortValue: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The in-project pairing of two remote links (Java Modem). Swift's LAN
|
||||
* transport settings belong to its Network-framework controller and are not
|
||||
* part of the port.
|
||||
*/
|
||||
export interface RemoteLinkConfiguration {
|
||||
readonly pairIdentifier: string;
|
||||
readonly latencyMilliseconds: number;
|
||||
readonly isEnabled: boolean;
|
||||
}
|
||||
|
||||
export const DEFAULT_REMOTE_LINK_LATENCY_MILLISECONDS = 20;
|
||||
|
||||
// ── Firewall (Java filius.software.firewall.Firewall, FirewallRule) ─────────
|
||||
|
||||
export const FIREWALL_PROTOCOL = { all: -1, icmp: 1, tcp: 6, udp: 17 } as const;
|
||||
|
||||
Reference in New Issue
Block a user