mysteriumnetwork / go-openvpn

GNU Affero General Public License v3.0
117 stars 33 forks source link

Library usage help #53

Open elgatito opened 4 years ago

elgatito commented 4 years ago

Hello guys,

I'm looking at this library and see this:

As built-in library - openvpn wraps c++ crosscompiled libary for all major oses (darwin,linux,win,ios and android), but has a limitation - can only work as client only.

So, the question is, whether this library can be used to create openvpn client from go, on a system, which does not have openvpn installed?

And another one, if client session is created, how can I do http.Client calls through that session? Is it possible?

zolia commented 4 years ago

Hello,

whether this library can be used to create openvpn client from go, on a system, which does not have openvpn installed?

Yes, this was the reason why we wrapped this library into golang. We use it in our node project for mobile build:

https://github.com/mysteriumnetwork/node/tree/master/mobile/mysterium

This library is also exposed as static-built library for android and used in our mobile application:

https://github.com/mysteriumnetwork/mysterium-vpn-mobile

And another one, if client session is created, how can I do http.Client calls through that session? Is it possible?

OpenVPN creates L3 session, meaning it creates a tunnel. You are free to launch http server on top of any side of the tunnel and establish sessions to it via http.Client. It simply a different layer of communication.

dev-ns8 commented 1 year ago

Are there by chance any examples of creating a VPN session via this library and tunneling outbound HTTP traffic through it?

I'm guessing you would need to use the TunnelSetup interface provided, but it's quite large and after studying it a bit, I'm still not sure on how to route HTTP traffic through a tunnel and thus through a newly created session.