Closed leggewie closed 7 years ago
One way could be to allow a shell command to be set in config file that would run the upnp function.
For example using the PortMapper can be a simple multi-platform solution:
java -jar PortMapper.jar -add -externalPort 1200 -internalPort 1200 [-ip <ip-addr>] -description desc
The libminiupnpc (C library) is portable on GNU/Linux, macOS and Windows so it can be a good candidate.
The code to add a mapping does not seems too much complicated: https://stackoverflow.com/a/25789141.
I begin an initial implementation for UPnP support with libminiupnpc. You can follow/test with the upnp branch.
@s-vincent Terrific news ! You seem unstoppable these days ! I like that ;)
Great news. Thanks, Sebastien.
I especially like the fact that miniupnp is maintained already in Debian. Even if it seems to be using a pretty old upstream version (from 2014).
@ereOn Thanks ;).
And here is the PR #144! Feel free to review and test.
PR merged.
It would be nice if freelan had a way to request via upnp for routers to open a port for incoming communications. To keep the maintenance burden low on freelan it would be good to try and identify an external tool that does the job.
I believe tribler and transmission already do this. I didn't find a dependency on an external package, maybe there ought to be one. But in any case it might be possible to learn how they do this and mimic it.
Debian seems to have a lot of libraries to choose from