How does one go about creating a P2P Javascript VPN like Hola VPN does?

1

13

I've been trying to build a P2P VPN that works entirely in the browser, mainly Javascript but mostly an addon such as the ones in Firefox and Chrome. The same thing like Hola VPN basically.

What is baffling me is since xmlhttprequest's don't lend themselves to cross domain requests without explicit authorization by the accessing server/website and it's the only way I could conceivably redirect/proxy a request from another peer. How does Hola VPN possibly circumvent this? Is anyone aware?

Mind you I'm not trying to open an open ended question but there is only one or two answers to this dilemma, but let me know if I should edit to make it less so if you think so.

turkey

Posted 2018-04-08T13:25:45.273

Reputation: 11

The remote end of your P2P connection would also be an instance of your VPN service, so a proper CORS setup is not a problem though? – Daniel B – 2018-04-08T18:22:51.410

Answers

0

I'm not sure what Hola does, but what I think is probably the best option is to add your VPN domain to the extension permissions, then use chrome.webRequest and xmlhttprequest to send your request there.

This lets you send a request, but the other side of the P2P VPN would not be doable in the same way due to CORS and permissions issues. Chrome apps used to support raw sockets but have been deprecated.

With current browser apis, you will have make a native app. You could keep a browser extension which communicates via native messaging, or just ditch the extension completely and have both parts together in the app (that's what we did for our P2P VPN, PenguinProxy).

foresteri

Posted 2018-04-08T13:25:45.273

Reputation: 1