Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

RFC: js-ipfs profiles #2148

Closed
Closed
@dirkmc

Description

@dirkmc

A profile is a shorthand name for a set of configuration options. This issue is to discuss which profiles we should have in js-ipfs and how each one should affect the behaviour of js-ipfs.

go-ipfs profiles

The profiles available for go-ipfs are documented in its configuration README and implemented in profile.go. Those that apply to js-ipfs are:

  • server / local-discovery (opposite of server)

    • Adds private / local / unrouteable addresses to
      • Addresses.NoAnnounce - prevents advertising these addresses to other peers
      • Swarm.AddrFilters - prevents dialing to these addresses
    • Sets Discovery.MDNS.Enabled to false
    • Sets Swarm.DisableNatPortMap to true
  • test / default-networking (opposite of test)

    • Sets /ip4/127.0.0.1/tcp/0 for
      • Addresses.API
      • Addresses.Gateway
      • Addresses.Swarm
    • Sets Discovery.MDNS.Enabled to false
    • Sets Swarm.DisableNatPortMap to true
    • Sets Bootstrap to [] - prevents bootstrapping with live nodes
  • lowpower

    • Sets Routing.Type to dhtclient - puts DHT in "client only" mode
    • Sets Reprovider.Interval to 0 - prevents node from advertising what content it has
    • Sets Swarm.ConnMgr parameters - maintains low connection count
      • Swarm.ConnMgr.LowWater: 20
      • Swarm.ConnMgr.HighWater: 40
      • Swarm.ConnMgr.GracePeriod: one minute
  • randomports

    • Sets Addresses.Swarm to listen on localhost at a random available port

js-ipfs profiles

In js-ipfs we already auto-detect whether the instance is running in the browser or node js and set config variables accordingly, we can refactor to use the profiles mechanism.

The corresponding ConnectionManager parameters for js-libp2p are

  • Swarm.ConnMgr.LowWater: ConnectionManager.minPeers
  • Swarm.ConnMgr.HighWater: ConnectionManager.maxPeers
  • Swarm.ConnMgr.GracePeriod: ConnectionManager.pollInterval - approximately equivalent

js-ipfs / js-libp2p do not currently support these parameters:

  • Addresses.NoAnnounce
  • Swarm.AddrFilters
  • Swarm.DisableNatPortMap - there is currently no NAT manager
  • Routing.Type - there is currently no dhtclient mode
  • Reprovider.Interval - there is currently no reproviding

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High: Likely tackled by core team if no one steps upexp/expertHaving worked on the specific codebase is importantexplorationkind/supportA question or request for supportstatus/in-progressIn progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions