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

Organising option flags #35

Open
raulk opened this issue Nov 29, 2018 · 4 comments
Open

Organising option flags #35

raulk opened this issue Nov 29, 2018 · 4 comments

Comments

@raulk
Copy link
Member

raulk commented Nov 29, 2018

As users demand more functionalities (e.g. #34), we're likely to see a proliferation of option flags for the daemon binary. While the daemon is marked as an experimental project, we should attempt to bring in structure to our option flags. Let's agree on an approach and lock it in.

Proposal:

  • Let's be idiomatic. I found that camelCasing flags is not really idiomatic in Go: go test uses no casing or separators, and ipfs uses hyphens. My proposal is to use hyphens.
  • Let's namespace our flags.
  • Let's strive for consistency. Consistency can look different in each namespace, e.g. for transports, we can make all flags additive (a flag adds support for a transport), and provide a single subtractive flag to disable OOTB defaults. The connection manager deals with values, so it'll look different.

For transports, this can look as follows:

-tpt-enable-quic        enables the QUIC transport
-tpt-enable-ws          enables the WebSockets transport
-tpt-enable-tcp         enables the TCP transport
-tpt-disable-defaults   disables the default transports 

So if I wanted to enable ONLY QUIC, I'd do the following:

p2pd -tpt-disable-defaults -tpt-enable-quic

WDYT? CC @vyzo @bigs @jrhea @cheatfate @mhchia

@raulk raulk mentioned this issue Nov 29, 2018
@cheatfate
Copy link

Its nice, but i think WebSockets transport could not work without TCP transport and QUIC transport could not work without UDP transport.
Also from my early experiments there not so many nodes in network which support something different from TCP, So i think this options can be useful only when network will be able to satisfy it.

@vyzo
Copy link
Collaborator

vyzo commented Nov 30, 2018

This is nice for testing. We should also have a flag that specifies the listen addresses, so that we can only listen on QUIC for example but still be able to dial tcp.

@mhchia
Copy link
Contributor

mhchia commented Dec 6, 2018

It's pretty nice to me. If there are too many combinations of the flags in a namespace, does it make sense to have something like -tpt="tcp,ws", and the argument parser handles the logic?

@jacobheun
Copy link
Contributor

I like this approach, I think it would be great to get spec'd out. When implementing the js daemon I referenced the cli parser of the go implementation, but it would be great to see that externalized as a spec. This will also ensure our interop testing is a lot easier if we can just leverage the same flags consistently.

If there are too many combinations of the flags in a namespace, does it make sense to have something like -tpt="tcp,ws", and the argument parser handles the logic?

I'd like to see us leverage something like #63 to overcome the large number of flags problem. I think it's a nice approach for running more customized nodes.

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

5 participants