I had a go at implementing this as a POC in sn_httpd: sn_httpd/src/main.rs at 4bab513e7b43178e9fd7d16034d7c3e2d927e2e3 · traktion/sn_httpd · GitHub
It’s rudimentary atm and you can only ‘edit’ the DNS registry with the CLI (no append/history exposed yet), but it does work.
Here is an example URL: http://vader:8080/traktion/blog/traktion/article/blogging-with-imim-and-safe-network#article
(some info here - sorry it’s scrappy atm! https://forum.autonomi.community/t/04-19-2024-community-testnet/39641/145?u=traktion)
Note that the base ‘traktion’ is used for the DNS lookup in this context and it could be pushed into the domain name, instead of the root directory in the URL. The latter was just easier to test/experiment with.
Essentially, it sn_httpd
is launched with a specific (i.e. ‘dns1’) public register specified. It then does a lookup for the name (‘traktion’) to retrieve an associated private ‘site register’. When there is a change to the site, the ‘site register’ is pointed to the latest XOR for the data map for the site.
The data map is an enhancement of what I was using to define a site in IMIM, but made more generic (but preserving old as an ‘imim’ sub-definition). I’ve added some docs here with an example here.
So, adding an article, changing a file/route, etc, all means a new XOR for the config.json. This XOR is then pushed (appended when possible) to the ‘site register’.
It works pretty well. It’s slower than raw XOR, as caching must be less aggressive and register lookups are also needed, but not unbearable. I’d like to add caching TTLs to the fileMap entries too, as some of those are essentially ‘immutable’ in nature and could be kept forever by the client (e.g. Angular / IMIM source files, in this context).
Note, the file maps are used for direct lookups within sn_httpd
, rather than register lookups. It allows ‘friendly’ file names to be resolved to XOR addresses as we discussed within these pages too. I wanted to experiment with that also!
Anyway, I wanted to share my experimentation. I suspect a similar need will present for an Autonomi browser or any other app that wants to perform lookups.