This example is extension over the original libp2p http-proxy sample to support HTTP/HTTPS tunneling over internet:
This program tunnels HTTP/HTTPS traffic over libp2p between two machines. First machine is the sharer to which the HTTP/HTTPS traffic is sent from second machine. First is called as local & second one as the remote here. Local machine will acts as proxy server to the remote machine. Using this program, you can access your home HTTP servers from a remote machine. You can also access internet using your hosted VPS server.
From the directory run the following:
> cargo build
First run the program as follows to the machine where you need to run the proxy server (first machine).
cargo run -- --forwarder
Then run the program in second machine which will need to use the proxy server in above program. Wait for the machine to show up "Found other peer, proxy active" message before browsing internet over this channel.
>cargo run -- --topic <topic-id-from-first-machine>
Now you can see the proxy setting of your browser to 127.0.0.1:8080. All the requests will be sent to first machine & it will send back the response.
Using a randomly generated UUID as a topic name so that it is not easily accesible to others.