Hello, people!
I’m writing a decentralized and federated [anti-]social network with Ada.
Connections (both client-server and server-server) are supposed to happen through SSH – the server-side application is to be executed as a command inside a SSH session.
The implementation of the reference server application is almost complete.
I also wrote a bunch of dependencies (localization and internalization, logging, versioning, etc.).
I have incredible doubts about using SSH for this; not that it can’t be done, but that this is not a good way to do this: you’re doubling the dependency on ‘text’, and probably building in dependency to the OS. — Of course, this could just be my misunderstanding what you mean, but it is far better to think first about the data and structure, and then consider the ‘textuality’ of any of it. (That is to say, if you were making a microblogging service like twitter or gab, your concerns would not be about String, but about the structures and protocols [even the concerns about things like script-injection are can be prevented by viewing user-submitted strings and stored-message strings as separate things]. As to the “unix-way”, it forces repeated ad hoc processing precisely because it is ‘plain text’, especially when it is not.)
Sockets would have the same problem: they’re platform dependent. Furthermore, there are different library implementations for them. That’s precisely why I didn’t use them – I would be dependent on a specific library (e.g. GNAT.Sockets).
I decided to go for the SSH instead because the server would be a normal application running on a remote host.
The client would use SSH to connect to it, run the command and give parameters to it (like the contents of a post).
SSH is present even on Windows these days, so I don’t worry about it.
I f I understood your doubts correctly, that’s how I’m passing data to it: CLI parameters.
Except for files, which are to be handled by SFTP – not the protocol itself.
Sockets are far less platform-dependent than SSH. Each modern OS have a socket implementation with Berkeley sockets interface. GNAT.Sockets is not necessary, though it is a de-facto standard for Ada.
P.S. A text/message-oriented approach is highly non-Ada. The core idea of engineering software in Ada is deploying strong typing.
The parameters would be converted before actually being used.
I used proper type-safety in the implementation, as well as in the specification: despite being texts, some parameters are expected to be valid images of other types so they can be properly converted to their correct types.
Before SSH, I thought of using Sockets, but I ran into multiple problems, including the extremely raised complexity that it entailed.
And using sockets wouldn’t really fix the type safety thing, as I was thinking of using JSON to transmit data (which is still just text in the end of the day).
Please, refer to protocol.ada to see what I’m talking about. Even string types are their own new types (e.g. Username) and there are plenty of dynamic predicates to check for their validity.
I just didn’t create these checks for bounded strings and bounded code-point sequences – but that was an oversight on my part which I will fix as soon as I have the time. I was trying to get around this issue through other means, like converting the env var USER to a username, and then back to a string, just to check if it’s valid; this works, but is suboptimal and prone to error, and I intend to undo this madness as soon as possible.
For starters, the base protocol has nothing like a feed that pushes mediocre content to you.
You just download the posts and comments of people you’re following and other stuff that interests you, but there’s no algorithm dictating what you’ll see.
There’s also limited data collection – though you’ll need to see if your provider is trustworthy.
There’s another thing on normal social networks that makes me angry, but I can’t really put my finger on it… maybe it’s how people are constantly trying to “fit in”, becoming just another brick on the wall in the process? I don’t know for sure…
More or less. The thought passed through my mind, but ultimately, I decided that DSA would make federation difficult (if not impossible) without the use of complex configurations or Sockets themselves.
But all its dependencies are properly categorized for use in DSA (pure, remote type, etc.).
*I was also trying to avoid the use of Ada-specific tools.