Open CMCDragonkai opened 11 months ago
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.
The library covers all those protocols as far as I'm aware.
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
andjs-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
js-upnp
.network
domain. It would have to be exposed as way forPolykeyAgent
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 thenodes
domain. Prototype the integration and ensure that the lifecycle locations make sense.