Skip to content

fix: give each peer a peerName and a label #6

@kerbo7

Description

@kerbo7
  • Each peer must have a peerName

  • Each peer must have a label

  • peerName is either set by the user, or if not set by the user it's set to peer.ip_hash. If peer.ip_hash is not set, set peerName to "Unknown IP"

  • label is the peerName, or if its a gateway "GW"

in app.js change
const peerName = peer.ip_hash ? state.peerNames[peer.ip_hash] : null;
to

var peerName = 'Unknown IP'
if(peer.ip_hash) peerName = #${peer.ip_hash}
if(peer.ip_hash && state.peerNames[peer.ip_hash]) peerName = state.peerNames[peer.ip_hash];
if (isGateway) peerName = 'GW'

change
const labelContent = d.label || (showInsideLabels ? (d.peerName || #${d.peer.ip_hash || d.id.substring(5, 11)}) : null);
to
const labelContent = d.label || (showInsideLabels ? (d.peerName || #${d.peer.ip_hash || d.id.substring(5, 11)}) : 'Unknown');


Since the default is to show no labels the label collision can be much more loose.
change

const MIN_LABEL_ANGLE_GAP = 0.08; // ~29 degrees between labels
const MAX_LABELS = 12;

to

const MIN_LABEL_ANGLE_GAP = 0.008;
const MAX_LABELS = 120;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions