-
Notifications
You must be signed in to change notification settings - Fork 26
Pluggable design #7
Comments
cc @david415 |
Yup, makes sense. I2P and other overlay networks need this as well. I can see how global configuration (like the control port for Tor) can be part of the value that gets added to the "network" but would this allow for passing in configuration of connection specific parameters? |
@jbenet OK... I'd like to point out a couple of observations about your code samples in ipfs/notes#37 (comment) onion service key material isn't included in your API design sketch... also tor can be configured with control port authentication... so the tor controller api needs to have even more secret information besides the onion service key private key... and possibly other information. here's a concise working example of an onion echo server: I think it's worth mentioning that Twisted Python has a transport plugin system called Twisted "endpoints"; https://twistedmatrix.com/documents/current/core/howto/endpoints.html One notable difference is that the client versus server plugins are referenced with two different plugin name spaces, and are processed by After looking at Twisted endpoints, it's clear that the multiaddr usage is essentially equivalent to a "client endpoint descriptor string".... because it's what is announced to the world... and clients use it to connect... but it's not really enough information for a server to begin listening. Let's look at what our plugin system might look like. We don't have a server endpoint equivalent... and I don't see a compelling reason to create such monstrosities as this server side multiaddr onion: "/onion//onion-key-file//home/human/myOnionkey/tor-control-port/9151" So avoiding the ugliness of a "server" multiaddr syntax... What do you think of this?
In order for the call to MultiAddrToListener to successfully create an onion listener it first needs to have the associated onion service key material. The calling party who registers the onion plugin must also "register" their onion address before using the MultiAddrToListener function. |
@david415 you're totally right so it would really be more like: n.Add(onion.NewTransport(onion.ListenerOptions{
OnionKeyFile: "echoOnionKey",
OnionServicePort: 8080,
LocalAddr: "127.0.0.1:8080",
ControlNetwork: "tcp",
ControlAddr: "127.0.0.1:9051",
AuthCookie: "/var/lib/tor-cookie/cookie",
})
// dialing out
n.Dial("/onion/<addr>")
// and maybe
n.Listen("/onion/0") // where 0 uses the key in "Onion Key File" ? |
@jbenet I dont like that approach very much. It means that my 'network' is limited to that one set of onion options, when I should be able to specify things in my dial/listen calls. |
@whyrusleeping do you have another API in mind? this is the goal: n.Dial(ma.Multiaddr) but may not be achievable for 100% of the cases |
Yeah.. I dont have a good api in mind. I've been mulling them over and cant really come up with anything I like. |
for it to work right, all of that onion dialer information needs to be embedded into the multiaddr |
not sure if all, i can imagine putting the private key in the addr, but the proxy details still on the transport object (the proxy details are less relevant)... Unless the proxy cannot listen on more than one key. another option is to set the listener opts on a map on the transport t := onion.NewTransport()
// add transport to the network
n.Add(t)
// t keeps a map[addr]onion.ListenerOptions
t.AddProxy("<onion-addr>", onion.ListenerOptions{
OnionKeyFile: "echoOnionKey",
OnionServicePort: 8080,
LocalAddr: "127.0.0.1:8080",
ControlNetwork: "tcp",
ControlAddr: "127.0.0.1:9051",
AuthCookie: "/var/lib/tor-cookie/cookie",
})
// and than can do
n.Listen("/onion/<onion-addr>") and another option is to just forgo the nice plugging altogether :( onion.Listen(onion.ListenerOptions{
OnionKeyFile: "echoOnionKey",
OnionServicePort: 8080,
LocalAddr: "127.0.0.1:8080",
ControlNetwork: "tcp",
ControlAddr: "127.0.0.1:9051",
AuthCookie: "/var/lib/tor-cookie/cookie",
}) |
I'm with @whyrusleeping wrt Configuration. Setting up Listeners beforehand might be doable like this, but configuring outgoing dials (TOR, for instance, allows to specify in which country an exit-node is located. In I2P you can tweak tunnel length and a lot of other parameters per connection, too) beforehand sounds unwieldy, because you simply might not have all the information until user interaction or that data comes from somewhere else.. Readding the transport with new a new config to the network feels ikcy.
I don't see how this is true though... @whyrusleeping did you mean, assuming we want it as simple as this, every Param would have to be in the multiaddr? Aggreed, I wouldn't want that either. Doesn't it mix where to call with how to get there? The latter is up to the calling party IMHO. |
Yeah, thats what i was going for. After sleeping on it, I think that we might have to go with something like:
this allows us to call it as: The same goes for listener |
Agree with @cryptix and @whyrusleeping . Though, i think @whyrusleeping's point about it being in the multiaddr (or at least that being one way of making it possible) makes sense. One of the goals of multiaddr is to allow single-string configuration of transports, so that we can pass those easily from the CLI, from config files, etc, that may not understand the specialized transports at all. Maybe, what we're missing here, is that this is not just
and this makes sense for both dials out and listens. the tricky part with listens is other options, like
is starting to get long and redundant. @whyrusleeping i do like the Dial with @david415 i wonder what part of this listener config is really not meant to be part of the user configuration, but rather just a part of the "network stack implementation". what i mean by that is, the multiaddr string does not specify "for network
What about i2p? could we take a look at what connections there would look like, to get some inspiration? And DNS records? |
The length frightens me a little. Also encoding file paths in it.... (Could maybe be Though...
I just got this idea: There could be a multiaddr proxy that uses ssh intelligently to build forwarding's. Basically socks5 for the dial case but, you know.. Listen at mars from your code? I like the look of this!
For none-raw sockets, with TCP/UDP you are also at virtue of your systems kernel implementation of how it handles IP, no? I guess this is where implementation and layers rob up against?
Well... Fire away :) I2P is really toiled towards p2p. It uses a kademlia-ish dht for its netdb. You basically dial key hashes in the end, like with ipfs. You don't have numeric tcp/udp ports and just create new keys and endpoints on the go. (You can choose with stream and datagram though - there are lots of options to tweek those.. datagrams with no sender addr for instance.). |
@cryptix leaseSets sound great actually. TRTTD. on listen, wouldn't it be:
? what would other multiaddrs look like? like the ones you distribute out |
Just adding my name to the participant list. I would definitely like to see I2P support (being one of the devs 😜) and am happy to answer questions. A few points (from reading the previous two comments):
|
Having read a little more about multiaddr, I would imagine that distributable string multiaddrs for I2P would look like:
|
thanks @str4d ! and thanks for all the work on I2P. those multiaddrs LGTM. |
The interface i've been working with for the utp codebase is like this:
So you can create anything that implements the dialer interface and construct a network with it like so:
Then when you call dial on the nework, it will find a dialer that can dial the given address, and use it. The primary reason i went with this method is that for utp (and udt and friends) we need to be able to use the listener socket to dial out on, This becomes possible now:
|
What's the status? Did we settle on a multi-addr format for onion service addresses? |
It's no big deal if we only use these multiaddrs for clients to connect to... but if we want onion services to work then we must specify the key somehow. Either we put the entire key in the multiaddr or a filename containing the key. Of course in the future when tor prop 224 is resolved the key will be an ed25519 key... so it'll be much shorter. |
i think this ticket can be closed now. |
@david415 agreed |
(originally at ipfs/notes#37 (comment))
It may make sense to rework how multiaddr-net works into something like this:
"network" is a bit odd name, but does give the idea that these networks are stacked and makes more sense why mulriaddrs work the way they do. "transport" is another possible name, but may not capture the full meaning of "network".
The text was updated successfully, but these errors were encountered: