Skip to content

Getting Started

Harry Cordewener edited this page Jan 30, 2024 · 5 revisions

Installing from NuGet

The core package is TelnetNegotiationCore. It targets .NET 8.

dotnet add package TelnetNegotiationCore

Setup

The main body of code lives in the TelnetNegotiationCore.Interpreters namespace. There also exist a few pre-written handlers for MSDP in the TelnetNegotiationCore.Handlers namespace, and models for MSSP in TelnetNegotiationCore.Models.

using TelnetNegotiationCore.Interpreters;
using TelnetNegotiationCore.Handlers;
using TelnetNegotiationCore.Models;

Example Application

Creating a Server

See: Example

Creating a Client

See: Example

Configuring Logging

For production code, it is wise to turn Logging to a separate file, or to turn off any logging outside of Error & Fatal. It is recommended to use a library like Serilog to inject into the Microsoft Logger in order to more easily support custom workflows.

// An example from our Test Client - modified to set the Minimum Level to Error and above (Fatal).
var log = new LoggerConfiguration()
  .Enrich.FromLogContext()
  .WriteTo.Console()
  .CreateLogger();

Log.Logger = log;

var builder = Host.CreateDefaultBuilder(args)
    .ConfigureServices(services =>
    {
      services.AddTransient<MockPipelineClient>();
    });

var host = builder.ConfigureLogging(logging =>
{
  logging.ClearProviders();
  logging.AddSerilog();
  logging.SetMinimumLevel(LogLevel.Error);
}).Build();
Clone this wiki locally