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

Network Traversal (by asking the router nicely) - UPNP #536

Open
CMCDragonkai opened this issue Jul 25, 2023 · 2 comments
Open

Network Traversal (by asking the router nicely) - UPNP #536

CMCDragonkai opened this issue Jul 25, 2023 · 2 comments
Labels
development Standard development r&d:polykey:core activity 4 End to End Networking behind Consumer NAT Devices

Comments

@CMCDragonkai
Copy link
Member

CMCDragonkai commented Jul 25, 2023

Specification

Now that we have js-mdns doing the multicast for local network discovery.

Another backup option is PCP/PMP through the UPNP protocol.

This basically communicates with the router in order to open ports. So technically it's about doing network traversal by asking the router nicely rather than punching through or via relays.

The main library I've found that can do all of this is https://github.com/pupnp/pupnp.

There are other JS libraries that are all unmaintained such as: https://github.com/velocityzen/node-upnp - therefore, it's better to instead just rely on the native library and wrap it up like we have done with js-db and js-quic. This sort of stuff has a niche community and there's no way multiple language environments would be developing these libraries together.

Just like js-quic, it would be nice to be able to do this runtime-less. I'm not sure if pupnp offers such an API. But let's see.

Additional context

Tasks

  1. Create a specification how UPnP should be used to open up ports on the router. Which protocols should we be using?
  2. Play with the https://github.com/pupnp/pupnp and try to wrap it within the Node API, it's a C++ library.
  3. Setup the library js-upnp.
  4. Integrate it into Polykey, since this isn't really about discovery, it can be placed into network domain. It would have to be exposed as way for PolykeyAgent to request that certain ports be opened up. However the actual ports that is in-use would depend on the agent to agent QUIC network, which is currently managed in the nodes domain. Prototype the integration and ensure that the lifecycle locations make sense.
@CMCDragonkai CMCDragonkai added the development Standard development label Jul 25, 2023
@CMCDragonkai CMCDragonkai changed the title Network Traversal - UPNP Network Traversal (by asking the router nicely) - UPNP Jul 25, 2023
@tegefaulkes
Copy link
Contributor

I'm not sure uPNP is what we want exactly. I think uPNP may include NAT-PMP and PCP but we'll need to double check that.

I think NAT-PMP and PCP are simple enough to make requests in the typescript code directly. Some brief research shows that they're pretty simple request-response protocols. I can't say if that's preferable to some already made implementation though.

@CMCDragonkai
Copy link
Member Author

The library covers all those protocols as far as I'm aware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development r&d:polykey:core activity 4 End to End Networking behind Consumer NAT Devices
Development

No branches or pull requests

2 participants