[Feature] Support i2p

From @oijkhg on Sun Jun 16 2019 01:59:04 GMT+0000 (UTC)

Feature: Add i2p support to DAT
Why?: Mainly for privacy and security but also to support decentralized web communications.
How?: BitTorrent already has wide usage of i2p thank to i2p-snarks and XD.


Want to support this issue? Post a bounty on it! We accept bounties via BountySource.

Bountysource

Copied from original issue: https://github.com/datproject/dat/issues/1120

From @RangerMauve on Mon Jun 17 2019 15:50:05 GMT+0000 (UTC)

I’d love to play around with this. Is there a Node.js implementation of i2p?

Getting java into our stack would be a big no-no, and I’m not sure how much effort it’d be to add a C++ library to play nice with everything.

I think once we get the Daemon and SDK set up, it’d be easier to start thinking about anonymity and stuff. Funding for such research would of course be welcome. :slight_smile:

From @DaniellMesquita on Tue Jun 18 2019 22:50:54 GMT+0000 (UTC)

Personally I’m not in favour of Dat having a Daemon version.
If you talk about i2p, eh, it could be spawned from Dat’s JS and communicate through RPC.

Had no idea :fire: :fire: :fire:

Hi, idk here, I met @rangermauve in Toronto a few weeks ago and we talked about this, I think it is an exciting idea and I’d like to help you all figure out the best way to enable Dat users to connect to eachother using I2P. There are a few ways to do it, so I’m going to try and answer some questions I see up the thread and then give my opinions on what I think are some of the options you have.

First things first, unfortunately there is not a node.js implementation of I2P. There are two main implementations at this time, both are actively developed, one is the original Java I2P project and the other is the newer C++ i2pd project.

However, these both come with an application called “SAM,” or Simple Anonymous Messaging, which presents an API for making connections using I2P from outside the I2P router, and there are already several people using I2P with Javascript, including https://github.com/redhog/node-i2p, which is a SAM Library for Javascript. I believe it supports up to SAM 3.1 which means that it supports streaming, datagrams(raw and repliable) and most of I2P’s internal options(Hop count, tunnel count, hop variance, etc).

If you use this approach, installing an I2P router might not have to be your problem, instead all you have to do is detect whether SAM is running and if it’s not, proceed without doing I2P things. If you choose this approach(Which is what I recommend) then the problem becomes providing a UI which allows your users to choose a “Connection Mode.” The best example I can think of a connection mode is in the BiglyBT bittorrent client, which has a slider that goes from “Non-Anonymous” which uses only regular connections, to “Mixed” which allows both anonymous and non-anonymous connections, and “Anonymous” which uses I2P only. This has two distinct advantages for your users as well, it allows anonymous-only users to retrieve content from the existing, non-anonymous network using “Mixed” users as bridges(I absolutely volunteer to be the first bridge if you choose this path), and it allows them to use whichever I2P router they prefer.

I have another sort of lab project as well, I call it the “Tricky Bundles” project but that will probably be changed to something like I2P SDK. Since we’re sensitive to the fact that many developers will be reluctant to include a full JVM and I2P router in their non-Java project, and that similarly many developers will be reluctant to include a big C++ dependency or create a binding to libi2pd or something, I’ve taken it upon myself to collect, collate, and if necessary, write the tools required to minimize that friction, however, this project is still very new. There are at least some configuration management tools that may be useful to us for guaranteeing that the router starts the SAM application and other important, but simple tasks common to many applications that would work with I2P. Also, should you choose to bundle an I2P router with your application(Which is still very much optional), I would like to help to overcome and document any obstacles you encounter as part of this project. Besides the hypothetical bundling of an I2P router.

1 Like

Thanks for following up! I think i2p integration is definitely something that’d be useful for the community.

I don’t know if anybody has bandwidth to tackle it right now, but here’s what I think we’d need to do to make it a thing:

  • Figure out the network options interface for the SDK based on this issue
  • Adapt hyperswarm/dht to be able to use i2p. Probably by making a custom mafintosh/dht-rpc wrapper or fork that uses SAM
  • Adapt hyperswarm/hyperswarm (or the SDK?) to make use of the i2p based peer discovery / make connections through it.
  • Figure out how to get it to work (if at all) in places like the web or react-native

I’d be happy to mentor or support anybody wanting to take this one on. :grin: Might be a cool idea for a grant application somewhere that cares about internet privacy / censorship resistance.

1 Like