Refine error codes into TOR or TGEN errors.
With this change we include more detailed error codes in visualization output. In order to do so we map TGen transfers/streams to TorCtl STREAM event details based on source ports and unix_ts_end timestamps. This code reuses some concepts used in metrics-lib.
This change prepares future changes like #33260 (closed) where we need to map TGen transfers/streams via TorCtl STREAM events to TorCtl CIRC events.
This change also refactors the visualization code a little bit to avoid repeating ourselves too much.
Implements tpo/metrics/onionperf#34218.