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

Do not add transports to default extensions #23

Open
Kagami opened this issue Nov 19, 2014 · 4 comments
Open

Do not add transports to default extensions #23

Kagami opened this issue Nov 19, 2014 · 4 comments

Comments

@Kagami
Copy link

Kagami commented Nov 19, 2014

By running this simple mesh node creates 3 listening sockets: two for TCP and one for UDP:

var th = require("telehash");

th.generate(function(err, id) {
  th.mesh({id: id}, function(err, mesh) {
    console.log(mesh);
  });
});

That's because of the transport extensions added by default on module load.

I could unload them by calling:

delete th.extensions.udp4;
delete th.extensions.tcp4;
delete th.extensions.http;

but it looks ugly as for me. (Also little bug: extensions should be an object.)
Should it be the option to disable default extensions without manually removing them?

@quartzjer
Copy link
Member

👍 this should be easier and more obvious, good feedback. If you take a look at the tests you'll see that you can pass in a fixed list of extensions when you create a mesh that will override, is that helpful?

@Kagami
Copy link
Author

Kagami commented Nov 19, 2014

I think it's good to always have all default channel extensions (from the ext/ directory). But the one who uses the library should choose the needed transports and add them manually.

Also how about more advanced unregister/config API for extensions? E.g. to allow users to add/remove extensions by type (channel, transport, cipher), option to disable all extensions and so on.

Another note: I'm note sure it's generally good idea to listen on some port by just adding the transport. Or maybe all transports should be splitted into the client and server parts (like http-client and http-server) so the users can choose essential functionality?

@bachp
Copy link
Member

bachp commented Mar 21, 2015

I think it would make sense to have something like app.use from express.js where the user can register all required extension.

Only the registered extensions should be available. Same for ciphersets and other things.
This would also help in some deployment scenarions (sodium isn't running everywhere).

@quartzjer
Copy link
Member

Yes, I very much want to move to this model here too, it's near the top of my TODO list now so it should happen soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants