Best Practice For Proxying a libp2p Transport

I need to proxy another transport in Go. Essentially I need to downgrade from transport.Listener to manet.Listener to net.Listener. In my case, I have a lib that proxies a net.Listener and I want to apply it to a listener from the websocket transport package. If the websocket transport package were a bit more open, I could use the net parts without having it already upgraded with the upgrader, but alas it is not.

Is there any code to support this use case? Any suggestions? Should I make my own upgrader and pass it to the web socket transport that basically does nothing but record the manet listener in use?

Ok, I just found the issue at https://github.com/libp2p/go-libp2p/issues/286. I think Iā€™m just going to have to hack it in for my use case.

FYI, you may be interested in our proxy transport, go-libp2p-circuit. That will allow you to use any go-ipfs node as a proxy (assuming it has the circuit transport enabled).

1 Like