feat(core): the pages of routers and home routers after Java, measured against Java
Routers and home routers start a web server on port 80 with Java's index, log and routes pages in the project's language (routerPages.ts); the firewall keeps a log per node that outlives a new start; RIP routes carry the telling router's public address. TCP counts sequence numbers and segments in Java's characters, not bytes. RouterWebRun records six stories, with firewalls now built by ScenarioNetwork. Not taken from Java: its router server sometimes never listening (a race in setAktiv), and </titel>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// message bundle says them: for comparing the core's structured lines with
|
||||
// what the Java oracle recorded (echoJava.test.ts, webJava.test.ts).
|
||||
|
||||
import type { EchoServerLogEntry, SendFailure, SimpleClientLogEntry } from '../src/index.js';
|
||||
import type { EchoServerLogEntry, SendFailure, SimpleClientLogEntry, WebBrowserLogEntry } from '../src/index.js';
|
||||
|
||||
/** Java's client and server look every 100 ms whether they are connected, or switched off; the core at once. */
|
||||
export const POLL_MILLISECONDS = 100;
|
||||
@@ -71,3 +71,20 @@ export function clientText(entry: SimpleClientLogEntry): string {
|
||||
return 'Keine Verbindung hergestellt!';
|
||||
}
|
||||
}
|
||||
|
||||
const IMAGE_TYPES = new Set(['png', 'gif', 'jpg', 'bmp']);
|
||||
|
||||
/** A browser's line as its window took it: a page (with its text only for 200), or "update" for an image. */
|
||||
export function browserText(entry: WebBrowserLogEntry): string | undefined {
|
||||
switch (entry.kind) {
|
||||
case 'page':
|
||||
return `page ${entry.statusCode} ${entry.contentType ?? 'null'}${entry.statusCode === 200 ? `\n${entry.body ?? 'null'}` : ''}`;
|
||||
case 'unreachable':
|
||||
return 'page 0 null';
|
||||
case 'image': {
|
||||
// WebBrowser.retrieveImages tells the window of an image that came, or of a status other than 200.
|
||||
const isImage = entry.contentType !== undefined && IMAGE_TYPES.has(entry.contentType.toLowerCase().replace('image/', ''));
|
||||
return entry.statusCode !== 200 || isImage ? 'update' : undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user