Skip to content

Commit 08d1a15

Browse files
Post standard License.
Try to create a nuget package.
1 parent 97a5f26 commit 08d1a15

File tree

12 files changed

+92
-9
lines changed

12 files changed

+92
-9
lines changed

.github/workflows/dotnet.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ jobs:
2222
- name: Build
2323
run: dotnet build --no-restore
2424
- name: Test
25-
run: dotnet test --no-build --verbosity normal
25+
run: dotnet test --no-build --verbosity normal
26+
- name: Push nuget package
27+
run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_TOKEN }}

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
## [1.0.0] - 2024-01-03
5+
6+
Initial version.
7+
8+
### Added
9+
- Initial support for RFC855 (TELOPT)
10+
- Initial support for RFC858 (GOAHEAD)
11+
- Initial support for RFC1091 (TTERM)
12+
- Initial support for MTTS
13+
- Initial support for RFC885 (EOR)
14+
- Initial support for RFC1073 (NAWS)
15+
- Initial support for RFC2066 (CHARSET)
16+
- Initial support for MSSP
17+
- Initial support for GMCP

LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright [2024] [Harry Cordewener]
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

Telnet.png

2.02 KB
Loading

TelnetNegotiationCore.TestClient/MockClient.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public MockClient(string ip, int port, ILogger? logger = null)
2525

2626
while (true)
2727
{
28-
var read = Console.ReadLine() + "\n\r" + "\r\n";
28+
var read = Console.ReadLine() + "\n\r";
2929
telnet?.SendPromptAsync(telnet?.CurrentEncoding.GetBytes(read)).GetAwaiter().GetResult();
3030
}
3131
}
@@ -35,7 +35,7 @@ public MockClient(string ip, int port, ILogger? logger = null)
3535
public Task WriteBack(byte[] writeback, Encoding encoding)
3636
{
3737
string str = encoding.GetString(writeback);
38-
_Logger.Information("Writeback: {writeBack}", str);
38+
Console.WriteLine(str);
3939
return Task.CompletedTask;
4040
}
4141

@@ -52,7 +52,7 @@ public Task SignalNAWS(int height, int width)
5252
return Task.CompletedTask;
5353
}
5454

55-
public void Handle(object obj)
55+
public void Handle(object? obj)
5656
{
5757
var client = (TcpClient)obj;
5858
int port = -1;

TelnetNegotiationCore.TestClient/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void Main()
1515
.CreateLogger();
1616

1717
Log.Logger = log;
18-
var server = new MockClient("127.0.0.1", 4201, log.ForContext<MockClient>());
18+
var _ = new MockClient("127.0.0.1", 4201, log.ForContext<MockClient>());
1919
}
2020
}
2121
}

TelnetNegotiationCore.sln

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{444703E8-4E7D-48CE-9F96-E510E3A99FA5}"
1111
ProjectSection(SolutionItems) = preProject
1212
CHANGELOG.md = CHANGELOG.md
13+
LICENSE = LICENSE
1314
README.md = README.md
1415
EndProjectSection
1516
EndProject
1617
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TelnetNegotiationCore.UnitTests", "TelnetNegotiationCore.UnitTests\TelnetNegotiationCore.UnitTests.csproj", "{0EC8EB89-8596-4426-83B0-29354F5B8938}"
1718
EndProject
18-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TelnetNegotiationCore.TestClient", "TelnetNegotiationCore.TestClient\TelnetNegotiationCore.TestClient.csproj", "{E1A76C78-8246-472F-824E-9F7F9B3778B7}"
19+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TelnetNegotiationCore.TestClient", "TelnetNegotiationCore.TestClient\TelnetNegotiationCore.TestClient.csproj", "{E1A76C78-8246-472F-824E-9F7F9B3778B7}"
1920
EndProject
2021
Global
2122
GlobalSection(SolutionConfigurationPlatforms) = preSolution

TelnetNegotiationCore/Interpreters/TelnetStandardInterpreter.cs

+7
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ private StateMachine<State, Trigger> SetupStandardProtocol(StateMachine<State, T
156156
.Permit(Trigger.SB, State.SubNegotiation)
157157
.OnEntry(x => _Logger.Debug("Connection: {connectionState}", "Starting Negotiation"));
158158

159+
tsm.Configure(State.StartNegotiation)
160+
.Permit(Trigger.NOP, State.DoNothing);
161+
162+
tsm.Configure(State.DoNothing)
163+
.SubstateOf(State.Accepting)
164+
.OnEntry(() => _Logger.Debug("Connection: {connectionState}", "NOP call. Do nothing."));
165+
159166
// As a general documentation, negotiation means a Do followed by a Will, or a Will followed by a Do.
160167
// Do followed by Refusing or Will followed by Don't indicate negative negotiation.
161168
tsm.Configure(State.Willing);

TelnetNegotiationCore/Models/MSSPConfig.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Text.Json.Serialization;
43

54
namespace TelnetNegotiationCore.Models
65
{

TelnetNegotiationCore/Models/State.cs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public enum State : sbyte
99
EndNegotiation,
1010
SubNegotiation,
1111
EndSubNegotiation,
12+
DoNothing,
1213
Do,
1314
Dont,
1415
Willing,

TelnetNegotiationCore/Models/Trigger.cs

+17-1
Original file line numberDiff line numberDiff line change
@@ -61,58 +61,74 @@ public enum Trigger : short
6161
/// Sub-negotiation SEND command
6262
/// ECHO negotiation (Unsupported)
6363
/// Sub-negotiation MSSP_VAR
64+
/// Sub-negotiation MSDP_VAR
6465
/// </summary>
6566
/// <remarks>
6667
/// RFC 855: http://www.faqs.org/rfcs/rfc855.html
6768
/// RFC 857: http://www.faqs.org/rfcs/rfc857.html
6869
/// RFC 2066: http://www.faqs.org/rfcs/rfc2066.html
6970
/// MSSP: https://tintin.mudhalla.net/protocols/mssp/
71+
/// MSDP: https://tintin.mudhalla.net/protocols/msdp/
7072
/// </remarks>
7173
ECHO = 1,
7274
MSSP_VAR = 1,
75+
MSDP_VAR = 1,
7376
SEND = 1,
7477
REQUEST = 1,
7578
/// <summary>
7679
/// Sub-negotiation ACCEPTED command.
77-
/// Sub-negotiation MSSP_VAR
80+
/// Sub-negotiation MSSP_VAL
81+
/// Sub-negotiation MSDP_VAL
7882
/// </summary>
7983
/// <remarks>
8084
/// MSSP: https://tintin.mudhalla.net/protocols/mssp/
8185
/// RFC 2066: http://www.faqs.org/rfcs/rfc2066.html
86+
/// MSDP: https://tintin.mudhalla.net/protocols/msdp/
8287
/// </remarks>
8388
MSSP_VAL = 2,
89+
MSDP_VAL = 2,
8490
ACCEPTED = 2,
8591
/// <summary>
8692
/// Sub-negotiation REJECTED command.
8793
/// Suppress Go Ahead
94+
/// Sub-negotiation MSDP_TABLE_OPEN
8895
/// </summary>
8996
/// <remarks>
9097
/// RFC 858: http://www.faqs.org/rfcs/rfc858.html
9198
/// RFC 2066: http://www.faqs.org/rfcs/rfc2066.html
99+
/// MSDP: https://tintin.mudhalla.net/protocols/msdp/
92100
/// </remarks>
93101
SUPPRESSGOAHEAD = 3,
94102
REJECTED = 3,
103+
MSDP_TABLE_OPEN = 3,
95104
/// <summary>
96105
/// Sub-negotiation TTABLE-IS command. (Unsupported)
106+
/// Sub-negotiation MSDP_TABLE_CLOSE
97107
/// </summary>
98108
/// <remarks>
99109
/// RFC 2066: http://www.faqs.org/rfcs/rfc2066.html
110+
/// MSDP: https://tintin.mudhalla.net/protocols/msdp/
100111
/// </remarks>
101112
TTABLE_IS = 4,
113+
MSDP_TABLE_CLOSE = 4,
102114
/// <summary>
103115
/// Sub-negotiation TTABLE_REJECTED command. (Unsupported)
116+
/// Sub-negotiation MSDP_ARRAY_OPEN
104117
/// </summary>
105118
/// <remarks>
106119
/// RFC 2066: http://www.faqs.org/rfcs/rfc2066.html
107120
/// </remarks>
108121
TTABLE_REJECTED = 5,
122+
MSDP_ARRAY_OPEN = 5,
109123
/// <summary>
110124
/// Sub-negotiation TTABLE_ACK command. (Unsupported)
125+
/// Sub-negotiation MSDP_ARRAY_CLOSE
111126
/// </summary>
112127
/// <remarks>
113128
/// RFC 2066: http://www.faqs.org/rfcs/rfc2066.html
114129
/// </remarks>
115130
TTABLE_ACK = 6,
131+
MSDP_ARRAY_CLOSE = 6,
116132
/// <summary>
117133
/// Sub-negotiation TTABLE_NAK command. (Unsupported)
118134
/// </summary>

TelnetNegotiationCore/TelnetNegotiationCore.csproj

+28-1
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,47 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<Version>1.0.0</Version>
7+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
8+
<Title>Telnet Negotiation Core</Title>
9+
<PackageId>$(AssemblyName)</PackageId>
10+
<Authors>harrycordewener</Authors>
11+
<Description>A Client and Server compatible library to create telnet applications, with a mind to MUDs.</Description>
12+
<PackageProjectUrl>https://github.com/HarryCordewener/TelnetNegotiationCore/wiki</PackageProjectUrl>
13+
<PackageIcon>Telnet.png</PackageIcon>
14+
<PackageReadmeFile>README.md</PackageReadmeFile>
15+
<RepositoryUrl>https://github.com/HarryCordewener/TelnetNegotiationCore</RepositoryUrl>
16+
<RepositoryType>git</RepositoryType>
17+
<PackageTags>telnet</PackageTags>
18+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
19+
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("CHANGELOG.md"))</PackageReleaseNotes>
720
</PropertyGroup>
821

922
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
1023
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1124
</PropertyGroup>
1225

26+
<ItemGroup>
27+
<None Include="..\README.md">
28+
<Pack>True</Pack>
29+
<PackagePath>\</PackagePath>
30+
</None>
31+
<None Include="..\Telnet.png">
32+
<Pack>True</Pack>
33+
<PackagePath>\</PackagePath>
34+
</None>
35+
</ItemGroup>
36+
<ItemGroup>
37+
<None Include="..\LICENSE" Pack="true" PackagePath=""/>
38+
</ItemGroup>
39+
1340
<ItemGroup>
1441
<PackageReference Include="morelinq" Version="3.4.2" />
1542
<PackageReference Include="OneOf" Version="3.0.255" />
1643
<PackageReference Include="Serilog" Version="3.0.1" />
1744
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
1845
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
1946
<PackageReference Include="stateless" Version="5.13.0" />
20-
<PackageReference Include="System.Collections.Immutable" Version="8.0.0-preview.7.23375.6" />
47+
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
2148
</ItemGroup>
2249

2350
</Project>

0 commit comments

Comments
 (0)