Skip to content

Latest commit

 

History

342 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telnet Negotiation Core

NuGet Downloads Build OpenSSF Scorecard License Discord Best Practices

Telnet Negotiation Core

A testable implementation of telnet, and as many of its RFCs as are viable, for .NET. Written with MUDs in mind: every telnet option is a plugin you opt into, the interpreter is a state machine over the byte stream, and every outgoing write is serialized for you.

dotnet add package TelnetNegotiationCore

Quick start

BuildAndStartAsync wires the connection and starts the read loop. Pass an IDuplexPipe (Kestrel's connection.Transport), a TcpClient, or a raw Stream:

var (telnet, readTask) = await new TelnetInterpreterBuilder()
    .UseMode(TelnetInterpreter.TelnetMode.Server)
    .UseLogger(logger)
    .OnSubmit(HandleSubmitAsync)
    .AddPlugin<NAWSProtocol>()
        .OnNAWS(HandleWindowSizeAsync)
    .AddPlugin<GMCPProtocol>()
        .OnGMCPMessage(HandleGMCPAsync)
    .AddPlugin<MSSPProtocol>()
        .WithMSSPConfig(() => new MSSPConfig { Name = "My Server", UTF_8 = true })
    .BuildAndStartAsync(connection.Transport);

await readTask;   // completes when the connection closes

AddDefaultMUDProtocols() registers the nine a MUD usually wants in one call, and AddTelnetServer() / AddTelnetClient() register the whole thing with the DI container. See Getting started.

What it speaks

Each row is a plugin you register, and one page in the protocol reference.

Specification Specification
RFC 855 Telnet Option Specification MSSP Mud Server Status Protocol
RFC 857 Echo MSDP Mud Server Data Protocol
RFC 858 Suppress Go-Ahead GMCP Generic Mud Communication Protocol
RFC 885 End Of Record EOR End Of Record
RFC 1073 Window Size (NAWS) MTTS Terminal type capabilities
RFC 1079 Terminal Speed MNES Mud New Environment Standard
RFC 1091 Terminal Type MCCP Compression, 2 and 3
RFC 1096 X-Display Location MXP MUD eXtension Protocol (option 91)
RFC 1184 Line Mode (MODE) MCP 2.1 MUD Client Protocol, with cords
RFC 1372 Flow Control RFC 1950 ZLIB compression
RFC 1408 Environment RFC 2066 Charset, including TTABLE
RFC 1572 New Environment RFC 2941 Authentication
RFC 2946 Encryption
Pueblo Pueblo handshake (in-band, no option)

Being a telnet negotiation library, it does not render the content layers that ride on top: ANSI, Pueblo, and MXP's own tags are the host application's to draw. MXP is negotiated and Pueblo is handshaken; neither's markup is parsed.

State

Stable. The package targets netstandard2.0, net8.0, net10.0 and net11.0. Building from source needs the .NET 11 SDK (RC1 or later), which global.json pins.

Releases are published from GitHub Actions by trusted publishing — no long-lived key exists — and carry an attestation of the workflow and commit that built them:

gh attestation verify TelnetNegotiationCore.3.0.0.nupkg --repo HarryCordewener/TelnetNegotiationCore

Contributing

Issues and pull requests are welcome — see CONTRIBUTING.md for how to build and test, and SECURITY.md for anything that should not be public.

License

Apache-2.0.

About

Library for Telnet Negotiation and interaction - with a mind towards MUDs and the like.

Topics

Resources

Contributing

Security policy

Stars

4 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages