kaiepi / p6-net-telnet Goto Github PK
View Code? Open in Web Editor NEWTelnet library for clients and servers
License: Artistic License 2.0
Telnet library for clients and servers
License: Artistic License 2.0
Debug logging of negotiations should be disabled by default. Instead, only do it if P6TELNET_DEBUG
is set
Apart from Net::Telnet::Chunk
not being very optimized, say a server sends a message like so: IAC WILL NAWS IAC SB 0 80 0 60 IAC IAC IAC IAC IAC IAC IAC IAC IAC IAC IAC IAC
. Net::Telnet::Chunk
will parse the IAC WILL NAWS
and add the rest of the message to the parser buffer. If the server keeps sending messages, two things can happen:
Grammars probably aren't suitable for parsing Telnet messages for this reason. Net::Connection.parse
should be refactored to use a more traditional method of parsing Telnet messages to prevent this from happening.
The client and server will otherwise end up repeating several hundred lines of virtually identical code otherwise. Since Telnet doesn't really have a concept of a client or a server, just peers, it might be best just to outright remove Net::Telnet::Client/Net::Telnet::Server and use Net::Telnet to provide the API to connect/listen
Most of the documentation can't be thrown in the README since using the server and the client differ so much. Run perl6 --doc=Markdown
on Net::Telnet::Client
and Net::Telnet::Server
and throw them in a doc/
directory, and add a third markdown file explaining how supported and preferred options work.
This package is also too complex for it to simply use the synopsis in the README. Make example code for using clients, servers, and using TRANSMIT-BINARY with the two of them.
Using it should look like this:
%bastille p6telnet-fetch-options telehack.com 43
Supported: ...
Preferred: ...
This will require using Net::Telnet::Client
to connect to a server using a hostname and port passed via the command line and finding a way to determine when the server is done sending its initial list of options it wishes to use. You may need to subclass Net::Telnet::Client
.
This is a huge pain in the ass but it's the last major roadblock before I can start getting to implementing subprotocols
Net::Telnet
aims to be as unopinionated as possible, therefore it should defer what should be done when this happens to the developer using the package, not deciding to close it on its own.
This is handled in Net::Telnet::Connection.parse
.
Fairly straightforward, just write support for these two options according to their RFCs. The only addendum I'd add is USER
, DISPLAY
, PRINTER
, and XAUTHORITY
must be the only user environment variables sent (these are the ones sent by OpenBSD's TELNET implementation) by default, with the option to enable/disable which environment variables get sent on top of that, so this library stays as nice and unopinionated as possible.
ECHO
is a very common Telnet option, therefore being able to support it is required before this can be uploaded to CPAN.
This is the RFC that explains how it works: https://tools.ietf.org/html/rfc857
Net::Telnet::Connection
and Net::Telnet::Chunk
are where most of the work needed will be done.
Fairly straightforward, just implement it according to its RFC. The only addendum I'd add is this should get the value of the TERM
environment variable on UNIX-like systems, rather than using the list of machines stated in the RFC, because it was written in the 80s and is completely irrelevant nowadays.
PSBot::Connection.send
is meant for sending raw data, not individual lines. This would basically be the same method, just with "\r\n"
appended to the message passed to it.
Net::Telnet::Server
will need to rely on being able to use Supply.tap
, unlike Net::Telnet::Client
. Specifically, options handling in Net::Telnet::Connection
is what's not thread-safe.
Fairly straightforward, just implement it according to its RFC.
Net::Telnet throws when you attempt to use SGA and the negotiation is accepted because of how it handles parsing. Fix this!
At the moment, if a Telnet peer chooses to send out-of-band data,it will be received out of order. Using setsockopt
with SO_OOBINLINE
fixes this, but requires using IO::Socket::INET
for now since there's no way to get the file descriptor for async sockets. Using send
with MSG_OOB
would allow the library to support GA (even though it doesn't seem to be a popular feature). Both these issues would be better off handled through changes to Rakudo though
p6telnet
should be a binary that uses Net::Telnet::Client
to connect to Telnet servers. There should be a REPL using readline
and/or linenoise
that allows users to set the hostname and port, connect to/disconnect from the server, send messages, toggle supported and preferred options, etc.
The client already knows what options to expect the server to negotiate because they're passed using the :preferred
argument on construction. It should send its initial negotiations after receiving negotiations for all preferred options, not when it first receives text from the server.
In the perl Telnet library there is a getline method
$line = $obj->getline([Binmode => $mode,]
[Errmode => $errmode,]
[Input_record_separator => $chars,]
[Rs => $chars,]
[Telnetmode => $mode,]
[Timeout => $secs,]);
What would be the equivalent in the raku library? I just need to connect to a server and then read a line when a server sends one. so basically getline in a while(1) loop.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.