Skip to content

Services

The codebase is organized around a single shared node package. These are not separate daemons; they are behaviors inside pkg/node that the CLI and GUI call into.

The bootstrap node:

  • listens on port 52837
  • prompts for a name
  • prints Peer ID and Full addresses
  • writes the first multiaddr to bs-nodes
  • starts the DHT in server mode

That is the seed node every peer uses to join the network.

Discovery is implemented with routing discovery on the fgov-network topic.

Behavior:

  • AdvertiseDiscovery("fgov-network") waits for routing peers before advertising
  • FindPeers() pauses briefly on startup, then loops forever
  • discovered peers are stored in DiscoveredPeers
  • already-connected peers are skipped
  • newly discovered peers are connected with a short timeout

The code currently focuses on finding and connecting peers directly. It does not implement onion routing or multi-hop paths.

The connection code handles both manual and automatic connections.

Manual connect:

  • parses a multiaddr
  • converts it to peer.AddrInfo
  • skips peers that are already connected
  • attempts the connection with a 10 second timeout

Manual disconnect:

  • resolves a peer ID
  • closes all active connections to that peer
  • removes the peer from the connected map

The CLI exposes connect, but not disconnect. The method still exists in the package for programmatic use.

When a peer connects, the node opens a stream using the /fgov protocol and exchanges names as JSON.

Example payload:

{"name":"example-node"}

The exchange is symmetrical, so both sides can update their local peer maps with the remote name.

The package also provides helpers used by the CLI and GUI:

  • IsRunning()
  • GetPeersSnapshot()
  • GetDiscoveredPeersSnapshot()
  • PrintPeers()
  • PrintDiscoveredPeers()

These are what the user-facing interfaces use to render live state.

  1. Bootstrap starts and writes bs-nodes.
  2. Peers read that file and connect.
  3. Connected peers exchange names.
  4. Discovery keeps searching for more peers.
  5. The GUI renders the same shared node state in a window.

Loading live data from GitHub...

Repository

Name: -

Description: -

Stars: -

Language: -

Last push: -

Open Issues

Count: -

    Open Milestones

    Count: -

      • Network Protocol - topics, addresses, and stream handlers
      • Deployment - how to run the current binaries outside local testing
      • GUI - the desktop client