freedomjs / freedom-port-control

Opens ports through a NAT with NAT-PMP, PCP, and UPnP
11 stars 3 forks source link

add support for running as a directly node required module #9

Open willscott opened 8 years ago

willscott commented 8 years ago

Address #7

With this change to make alternate checks if freedom isn't around, you can run in node directly:

var PortControl = require('freedom-port-control');
var controller = new PortControl();
controller.probeProtocolSupport().then(function(result) {
  console.log(result);
});

This change is Reviewable

agallant commented 8 years ago

If this works, it'd be good to get it in and cut a new release - been trying to get simple-socks and zork working in node and dug deep enough to hit this issue.

kennysong commented 8 years ago

Thanks for doing this, Will! In addition to the socket wrappers, I think the URL object and the XMLHttpRequest lines might also need to be modified to work in node.

willscott commented 8 years ago

it'll take me a bit to get back to this. I remember when i looked at this in march i was able to run it with reasonable output, but don't have the diversity of nat types to test against, so don't know if functionality is complete at this point. What i remember is that with this change is can be required and doesn't throw errors, so this might be an acceptable merge with a subsequent ticket to clean up those behaviors.

On Fri, Jun 3, 2016 at 3:09 PM, Kenny Song notifications@github.com wrote:

Thanks for doing this, Will! In addition to the socket wrappers, I think the URL object https://github.com/freedomjs/freedom-port-control/blob/willscott-node/src/upnp.js#L60 and the XMLHttpRequest https://github.com/freedomjs/freedom-port-control/blob/willscott-node/src/upnp.js#L295 lines might also need to be modified to work in node.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/freedomjs/freedom-port-control/pull/9#issuecomment-223706674, or mute the thread https://github.com/notifications/unsubscribe/AAaIp3oVXc6uA4z2ejZUvFaR1YFDyQ_xks5qIKYkgaJpZM4H3mve .