SERVICE_CLASSESconstconst SERVICE_CLASSES: readonly ["web", "management", "data", "mail", "directory", "file", "name", "time", "orchestration"]The class of a service, in the estate's own words: what reaching it lets someone do.
The common services: the well known network services an estate has endpoints for, by name, with the transport and the port each is usually found on, what kind of service it is, and whether it speaks in the clear. An endpoint names its service from this catalog, so that a passive check, a scope or a query can say "every management service that is open to the internet" and mean the same thing every time. The data is ours: ports and protocols are facts of the standards, the classes are the estate's own words.
import { serviceByName } from "./services.ts";
serviceByName("postgres")?.port; // 5432SERVICE_CLASSESconstconst SERVICE_CLASSES: readonly ["web", "management", "data", "mail", "directory", "file", "name", "time", "orchestration"]The class of a service, in the estate's own words: what reaching it lets someone do.
ServiceClasstypeno test imports ittype ServiceClass = (typeof SERVICE_CLASSES)[number];A class of service.
ServiceSpectypeno test imports ittype ServiceSpec = {
readonly name: string;
readonly transport: "tcp" | "udp";
readonly port: number;
readonly class: ServiceClass;
/** Whether the service, spoken on this port as it stands, carries its traffic in the clear. */
readonly cleartext: boolean;
readonly summary: string;
};A common service.
SERVICESconstconst SERVICES: readonly ServiceSpec[]The common services, by name.
serviceByNamefunctionfunction serviceByName(name: string): ServiceSpec | undefinedA service by its name.
servicesOnPortfunctionfunction servicesOnPort(port: number, transport: "tcp" | "udp"): readonly ServiceSpec[]The services found on a port and transport (more than one where a port is shared, such as ssh and sftp).