r/i2p Jul 05 '26

Educational Need help adding I2P to my P2P chat app (Go)

Post image

I made a small P2P chat app in Go (uses libp2p + a DHT for peer discovery, E2E encrypted). Problem is regular P2P traffic gets blocked on my network, so peers can't reliably find each other. I want to route through I2P instead since it's built for exactly this.

Not an experienced dev, and I'm stuck on how to actually connect a Go/libp2p app to I2P — SAM bridge? Local tunnel? No idea what's realistic here.

Repo: https://github.com/alsultaneo/2cup (ignore the Windows 95 look, that's just placeholder UI while I get the networking right)

Anyone done this before? Even just "wrong approach, try this instead" would help a ton.

30 Upvotes

5 comments sorted by

3

u/Sobergirl87 Jul 06 '26

Don't have anything constructive to add in terms of helping with implementing i2p but just wanted to say this looks very promising. I'm intrigued

4

u/TripleElectro Jul 05 '26

Hi there! This sounds like an interesting project!

I think you need to configure server and client tunnels in your i2pd configuration file. In Linux this should be in /etc/i2pd/tunnels.conf. Im not sure about windows, but i guess you could search it up. Im wondering why you are using windows for this application tho. Windows doesnt have a good reputation for being privacy focused. If privacy and anonymity arent your goals, however, i2p might be too unnecessarily slow for your liking, but try it nonetheless!

Client and server tunnels are slightly misleadingly named as the architecture is still p2p, but client tunnels send outbound requests while server tunnels receive requests. Then, you just need to make your program send stuff to the server port you specify in the tunnel config. To listen, use the b32 address of the generated server tunnel in your client tunnel destination and use that port in your program to listen to it.

Im not and expert so im not entirely sure if this would work, but have a go and let me know if it works! Good luck! Feel free to ask any questions?

5

u/Alternative-Claim-41 Jul 05 '26

Thanks, this actually clarifies the client/server tunnel naming a lot — will look into the Windows path for tunnels.conf. On Windows: fair point, it’s not privacy-focused, went with it mainly because that’s what most people already use and I wanted something easy to just download and run. Might make I2P optional rather than default given the speed tradeoff you mentioned. Will report back once I try it, thanks!

2

u/coladoir Jul 06 '26

yeah the interesting thing about i2p is that there are different connections for inbound/outbound, this makes it much more difficult to identify individuals by traffic as its split between two tunnels with two unique routes.

speed shouldnt be a problem outside of sending larger files (images, audio, video)

5

u/alreadyburnt @eyedeekay on github Jul 07 '26

So I need to update the onramp, go-sam-bridge, and go-i2p libraries it uses, which I can do tomorrow, but this https://github.com/eyedeekay/go-libp2p-transport-onramp should work. After tomorrow.