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

Support relay and hop as "config" options like Go #2667

Closed
hugomrdias opened this issue Dec 12, 2019 · 4 comments
Closed

Support relay and hop as "config" options like Go #2667

hugomrdias opened this issue Dec 12, 2019 · 4 comments
Assignees
Labels
exp/novice Someone with a little familiarity can pick up kind/wontfix-migration-available P1 High: Likely tackled by core team if no one steps up

Comments

@hugomrdias
Copy link
Member

  • Version:
  • Platform:
  • Subsystem:

Type: Enhancement

Severity: High

Description:

Correctly we dont support enabling relay and hop using the config like go https://github.com/ipfs/go-ipfs/blob/master/docs/config.md#swarm so we when using the CLI there’s no way to run a js daemon as a relay.

Steps to reproduce the error:

@hugomrdias hugomrdias added exp/novice Someone with a little familiarity can pick up P1 High: Likely tackled by core team if no one steps up labels Dec 12, 2019
@ggarri
Copy link
Contributor

ggarri commented Jan 4, 2020

I have started a little research and I have realized that js-ipfs already support relay and hops in config as we can see from the description at the example circuit-relaying about to how to setup the ipfs node.

Just as we did with go-ipfs, go ahead and edit js-ipfs config file located under ~/.jsipfs/config. Let's add the following config:

  "relay": {
    "enabled": true,
    "hop": {
      "enabled": true
    }
  }

And I got same conclusion after reading this code in core->component->libp2p

      relay: {
        enabled: get(options, 'relay.enabled',
          get(config, 'relay.enabled', true)),
        hop: {
          enabled: get(options, 'relay.hop.enabled',
            get(config, 'relay.hop.enabled', false)),
          active: get(options, 'relay.hop.active',
            get(config, 'relay.hop.active', false))
        }
      },

Aiming the best compatibility across both projects, js-ipfs and go-ipfs I am incline to tackle this issue by providing the same config map than go-ipfs, which looks like the one below:

  "Swarm": {
    "DisableRelay": false,
    "EnableRelayHop": true,
    "EnableAutoRelay": false,
...
    }

And therefore this issue will also involve an update of the circuit-relaying example as it was mentioned above or provide a backward compatible solution which bring some technical debt but it might be worthy to no affect people using it.

Please, I would appreciate some feedback in case I am heading in the wrong direction @hugomrdias

@hugomrdias
Copy link
Member Author

@ggarri first thank you for tackling this!!
Yes this is the right direction, the js-ipfs top level relay options are artefacts from times when the libp2p was lacking support for it.
So we should remove those options, add support for it in the repo config just like Go has and make sure that manually passing libp2p config overrides the repo config (@alanshaw @achingbrain do you agree with this last part about constructor config having higher precedence than repo config?)

ggarri added a commit to ggarri/js-ipfs that referenced this issue Jan 14, 2020
@achingbrain
Copy link
Member

Sounds good. I think if someone's gone to the trouble of passing constructor args in, they should override passively detected settings.

@SgtPooki
Copy link
Member

js-ipfs is being deprecated in favor of Helia. You can learn more about this deprecation and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterwards (see #4336).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/novice Someone with a little familiarity can pick up kind/wontfix-migration-available P1 High: Likely tackled by core team if no one steps up
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants