Nim's Internet protocols library is surprisingly complete. It covers most common protocols. However I did not see in there an equivalent to python's telnet lib. Is there some popular non standard alternative library"
EDIT: Fix typo
telnet is basically socket hooked up to stdin/stdout
It uses in-channel signalling (with escape sequences) so it may look that way most of the time, but then it doesn't and then you must handle the escape sequences, commands, etc.
You can write that in less than 100 lines. Maybe even less than 50.
I found that hard to believe so I just had a look at Python's telnetlib and decided to indulge in a harmless little exercise (which I hope you will excuse as it is not meant to be offensive in any way):
The module is 788 lines, including docstrings, comments and some test code. Removing those it shrinks to 512 lines. Also removing all empty lines brings it down to 456.
The module has a bunch of very similar read modes (read_eager, read_very_eager, etc). Removing all of those except the main one (read_eager) gets it to 377 lines.
There are also some read_until methods that are not essential. Without them we get to 304 lines. If we also get rid of the "expect" methods get to a final count of 206 lines very compact Python code.
However, this still includes definitions of 74 constants, many of which are used in the code. Even if we got rid of all of them (breaking the code, mind) we would still have 132 lines of the most compact Python code I have ever seen. This is not huge by any means but it is definitely not negligible. I doubt that any idiomatic nim code could do what that code does in 100 lines, much less 50 (although I would love to be proved wrong).
The point of this little silly Saturday morning exercise is that writing your own nim telnet module may look easy but it probably is not as much as one could think.
Would a telnet lib (perhaps ported from Python's) have its place in nim's standard lib (specially considering that there is already an irc module in there, for example)? It might be a nice exercise that would let me learn and actually write some nim code... :-)
The IRC module has been removed from the stdlib and has its own repo now. I'd say your module should live as a nimble package too.
Make sure to use async await in your implementation :)