Air Tower = IPFS/Peergos + Airport
Since the beginning of the Airport project the question of how to share data was outstanding. Eventually I started the automated-gateway-transit library to act as a gateway between airport instances. However overtime I came to a realization of how much work it would be to come up with a fully custom peer-to-peer solution. So, I began looking at alternatives. I started with I2P since it had was fully distributed with automatically promoting nodes based on their connectivity and bandwidth to being gateway nodes.
However I quickly changed my choice to Peergos once I've learned about it. First of all, it is based on IPFS, which is already on the way of being integrated with browsers.
Peergos secures file sharing over IPFS and also specifies how user accounts are created. And it turns out to be a really good platform for Airport since every repository can be described as a directory and all transactions in that repository can be described as files.
Here is what my first go at a Repository sharing layout looks like:
Given that two devices share a given Repository:
- Each of the devices acts as a Peergos server
- On both devices the Repository transactions are stored in a directory
- Each devices only stores the transactions it generates
- Devices maintain a write log and push it to the other device (it can just be the id of the last transaction)
- Once a device notices that there are remote changes it connects to the other device and loads the new transactions.
This setup requires all devices to be aware of all other devices where the repository exists and for devices to be able to connect to each other directly. Alternative (though more complicated) setups are possible that won't require all devices to connect to each other and check write logs via proxies.
Also it is possible for a user to only maintain one Peergos server (for instance on a desktop) and have all the rest of their devices (cell phone & tablet) connect to it to retrieve and store updates.
But to begin with I'm going with the simplest possible solution and we'll see what alternative setups will be necessary.
There is one concern with using Peergos that I have right now - it is written in Java 11+. Java will run on Android, but to the best of my understanding maximum supported version is Java 8. Currently I'm planning on getting around this by using Native Image technology in GraalVM. I'm yet to test in out but so far it appears to be low risk since it uses a standard C++ compilation toolchain.