Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permanent p2p forwarding #5460

Open
Stebalien opened this issue Sep 14, 2018 · 16 comments
Open

Permanent p2p forwarding #5460

Stebalien opened this issue Sep 14, 2018 · 16 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@Stebalien
Copy link
Member

Now that we have the shiny refactored ipfs p2p command, it would be awesome if we could make forwards/listens permanent. That is, have a --save or a --sticky flag to save these mappings in either the config file or, possibly, the datastore (IMO, the config file actually makes the most sense here).

@Stebalien Stebalien added the kind/enhancement A net-new feature or improvement to an existing feature label Sep 14, 2018
@overbool
Copy link
Contributor

@Stebalien, I'm interested in this, could you explain it in more detail?

@Stebalien
Copy link
Member Author

Basically, I'd like to be able to run:

  • ipfs p2p listen --save /x/ssh /ip4/127.0.0.1/tcp/22
  • ipfs p2p forward --save /x/ssh /ip4/127.0.0.1/tcp/1234 /ipfs/Qm....

And have ipfs save these mappings in my config file. IPFS would then automatically restore them on start.

@overbool
Copy link
Contributor

@Stebalien I got it.

@overbool
Copy link
Contributor

overbool commented Sep 14, 2018

@Stebalien if save these mappings in the config file, can i save them as follow?

 "P2P": {
 	"Listens": [
 		{
 			"Protocol": "/x/one",
 			"Address": "/ip4/127.0.0.1/tcp/9898"
 		},
                ...
 	],
 	"Forwards": [
 		{
 			"Protocol": "/x/another",
 			"Address": "/ip4/127.0.0.1/tcp/6565"
 			"Peer": "/ipfs/Qm..."
 		},
                ...
 	]
 }

WDYT?

@Stebalien
Copy link
Member Author

SGTM. Thoughts @magik6k?

@magik6k
Copy link
Member

magik6k commented Sep 14, 2018

Not sure about the names, can think of anything better though, so I'd call this good enough.

@Stebalien
Copy link
Member Author

Well, we could just say Listen and Forward. We could also consider using maps. That is:

{
    "Listen": {
        "/x/one": "/ip4/127.0.0.1/tcp/1234",
    },
    "Forward": {
        "/ip4/127.0.0.1/tcp/4411": {
            "Peer": "QmId", // not sure if this should have the full multiaddr...
            "Protocol": "/x/another"
        }
    }
}

However, I really don't have any strong opinions here so I'd just say, go with whatever makes sense to you.

@overbool
Copy link
Contributor

@Stebalien I make a pr in ipfs/go-ipfs-config#8 about this issue, could you help me review it?

@ghost
Copy link

ghost commented Sep 15, 2018

Not sure we should keep adding p2p things to go-ipfs when the libp2p daemon is already on its way.

@Stebalien
Copy link
Member Author

The libp2p daemon is still a ways off and we're even further away from having go-ipfs use it. When it does, we can migrate over but I'd rather not block on that.

@raulk
Copy link
Member

raulk commented Sep 15, 2018

I don’t necessarily see this as libp2p daemon material. OTOH, it does feel well motivated to make the libp2p Host accept a configuration file. Perhaps some kind of JSON binding that maps to a subtree of the Config struct? https://github.com/libp2p/go-libp2p/blob/master/config/config.go

@overbool
Copy link
Contributor

Not sure we should keep adding p2p things to go-ipfs when the libp2p daemon is already on its way.

@Stebalien Does this issue still need to be solved? It looks like libp2p daemon did the same thing.

@Stebalien
Copy link
Member Author

At the moment, it's unclear what the libp2p daemon will handle (it doesn't currently do much of anything). IMO, the libp2p daemon should actually be extremely minimal and services like this one should be provided by external applications.

Eventually, we may migrate this functionality to a different component (maybe the libp2p daemon, maybe some daemon that uses the libp2p daemon). However, that shouldn't block this.

@Stebalien
Copy link
Member Author

Stebalien commented Sep 26, 2018

One thing that came up: #5523

IMO, we should refuse to persist "dynamic" addresses.

@Winterhuman
Copy link
Contributor

@Stebalien Any update on this issue?

@Stebalien
Copy link
Member Author

Stebalien commented Jan 28, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

5 participants