Extracted from CommSystemFacadeImpl (2026-09-06) so the peer-render cluster, its RouterInfo/capacity caches, and its i18n state live apart from the facade core. The facade retains thin commSystem() delegators so the public API is unchanged; collaborators (country lookup, reverse-DNS) are injected rather than fetched through commSystem() round-trips.
Pure memory-independent decisions (bandwidth classification, visible-cap cleanup) are package-visible statics so they can be tested without a running router; see PeerHTMLRendererDecisionTest.
Constructor Summary
ConstructorsConstructorDescriptionPeerHTMLRenderer(RouterContext ctx, CountryLookup countryLookup, ReverseDnsLookup rdns) Create a renderer.Method Summary
Modifier and TypeMethodDescription(package private) static StringclassifyCapacity(String caps) Highest-priority bandwidth capability char present in the caps string, or "?" when none is advertised.renderPeerCaps(Hash peer, boolean inline) Renders the peer's capability HTML block.renderPeerFlag(Hash peer) Render the HTML flag image for the given peer.renderPeerHTML(Hash peer, boolean extended) Renders HTML for a peer with optional extended info.
Constructor Details
PeerHTMLRenderer
Create a renderer.- Parameters:
ctx- non-nullcountryLookup- non-nullrdns- non-null
Method Details
renderPeerHTML
Renders HTML for a peer with optional extended info. Uses cached RouterInfo, country info, and reverse lookup cache.- Parameters:
peer- the hash of the peer to renderextended- Whether to show extended capabilities- Returns:
- HTML snippet representing peer
renderPeerFlag
renderPeerCaps
Renders the peer's capability HTML block. Caches data and removes unnecessary repeated computation.- Parameters:
peer- the hash of the peer whose capabilities are being renderedinline- If true, render inline without table wrapper- Returns:
- HTML snippet of peer capabilities
classifyCapacity
Highest-priority bandwidth capability char present in the caps string, or "?" when none is advertised.Priority follows
RouterInfo.BW_CAPABILITY_CHARSorder, so a peer advertising both a high and a low class is classified at its high end. This is the decision the formergetCapacityCachedinline loop made; it is exposed so the offlinePeerHTMLRendererDecisionTestcan pin both the string and the null/empty handling without a router.- Parameters:
caps- capabilities string (never null in practice; null treated as none)- Returns:
- single bandwidth-class char or "?"