libp2p / go-libp2p-examples

Example libp2p applications
MIT License
339 stars 145 forks source link

Modifying http_proxy/proxy.go to make the remote proxy to act as an egress gateway to connect to a non-p2p real server. #207

Open askquestions opened 3 years ago

askquestions commented 3 years ago

I have been trying to find a solution to customize http_proxy/proxy.go to meet my requirement as follows.

In the illustration of http_proxy, it has been said that a non-p2p client can connect to a non-p2p server (such as an ordinary HTTP server) by going through 2 p2p proxies. The client sends HTTP requests to the first p2p proxy (called local proxy in http_proxy) which forwards the request to the second p2p proxy (called remote proxy). In proxy.go, the remote proxy uses a dummy server to serve the HTTP request locally and sends the response back to the first proxy.

Now, I want the second p2p proxy (remote proxy) to forward the HTTP request to a non-p2p real HTTP server. I run into the problem that I could not create a multiaddr for the non-p2p real real server in order to make the second p2p proxy (remote proxy) to connect to the non-p2p real server.

I have made extensive search for a solution to my requirement and failed in finding any. Does anyone have a solution or suggestion to make my desired configuration to work?

Thank you.

askquestions commented 3 years ago

A similar question: Is there a libp2p wrapper to turn a shell command into a p2p node. For example, a http server program will be used as the core functionality of a p2p node. In this case, the p2p node will be able to connect to an existing p2p cluster while it can embed a non-p2p server in the p2p cluster.