51 lines
1.8 KiB
C#
51 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IPMeow.Lib.Server;
|
|
|
|
public static class Protocols
|
|
{
|
|
private static readonly HashSet<Endpoint> _protos = new()
|
|
{
|
|
Http,
|
|
Dns,
|
|
DnsOverTls,
|
|
DnsOverHttps,
|
|
Ntp,
|
|
Ssh,
|
|
Snmp,
|
|
Ldap,
|
|
Kerberos,
|
|
Radius,
|
|
Smtp,
|
|
Pop3,
|
|
Imap
|
|
};
|
|
|
|
public static readonly Endpoint Http = new() { Name = "HTTP", Port = 80 };
|
|
public static readonly Endpoint Dns = new() { Name = "DNS", Port = 53 };
|
|
public static readonly Endpoint DnsOverTls = new() { Name = "DNS-over-TLS", Port = 853 };
|
|
public static readonly Endpoint DnsOverHttps = new() { Name = "DNS-over-HTTPS", Port = 443 };
|
|
public static readonly Endpoint Ntp = new() { Name = "NTP", Port = 123 };
|
|
public static readonly Endpoint Ssh = new() { Name = "SSH", Port = 22 };
|
|
public static readonly Endpoint Snmp = new() { Name = "SNMP", Port = 161 };
|
|
public static readonly Endpoint Ldap = new() { Name = "LDAP", Port = 389 };
|
|
public static readonly Endpoint Kerberos = new() { Name = "Kerberos", Port = 88 };
|
|
public static readonly Endpoint Radius = new() { Name = "RADIUS", Port = 1812 };
|
|
public static readonly Endpoint Smtp = new() { Name = "SMTP", Port = 25 };
|
|
public static readonly Endpoint Pop3 = new() { Name = "POP3", Port = 110 };
|
|
public static readonly Endpoint Imap = new() { Name = "IMAP", Port = 143 };
|
|
|
|
public static Endpoint? GetByPort(short port)
|
|
{
|
|
return _protos.SingleOrDefault(s => s.Port == port);
|
|
}
|
|
|
|
public static Endpoint? GetByName(string name)
|
|
{
|
|
return _protos.SingleOrDefault(s => s.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
}
|
|
|