@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions.Dtos | |||
{ | |||
class JTNEDefaultResultDto : JTNEResultDto<string> | |||
{ | |||
public JTNEDefaultResultDto() | |||
{ | |||
Data = "Hello,JTNE WebAPI"; | |||
Code = JTNEResultCode.Ok; | |||
} | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Net; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions.Dtos | |||
{ | |||
public class JTNEIPAddressDto | |||
{ | |||
public string Host { get; set; } | |||
public int Port { get; set; } | |||
public EndPoint endPoint; | |||
public EndPoint EndPoint | |||
{ | |||
get | |||
{ | |||
if (endPoint == null) | |||
{ | |||
if (IPAddress.TryParse(Host, out IPAddress ip)) | |||
{ | |||
endPoint = new IPEndPoint(ip, Port); | |||
} | |||
else | |||
{ | |||
endPoint = new DnsEndPoint(Host, Port); | |||
} | |||
} | |||
return endPoint; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions.Dtos | |||
{ | |||
public class JTNEResultDto<T> | |||
{ | |||
public JTNEResultDto() | |||
{ | |||
Code = JTNEResultCode.Ok; | |||
} | |||
public string Message { get; set; } | |||
public int Code { get; set; } | |||
public T Data { get; set; } | |||
} | |||
public class JTNEResultCode | |||
{ | |||
public const int Ok = 200; | |||
public const int Empty = 201; | |||
public const int NotFound = 404; | |||
public const int Fail = 400; | |||
public const int Error = 500; | |||
} | |||
} |
@@ -0,0 +1,33 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions.Dtos | |||
{ | |||
public class JTNESystemCollectInfoDto | |||
{ | |||
/// <summary> | |||
/// 进程Id | |||
/// </summary> | |||
public int ProcessId { get; set; } | |||
/// <summary> | |||
/// 进程分配内存 | |||
/// 单位MB | |||
/// </summary> | |||
public double WorkingSet64 { get; set; } | |||
/// <summary> | |||
/// 进程分配内存峰值 | |||
/// 单位MB | |||
/// </summary> | |||
public double PeakWorkingSet64 { get; set; } | |||
/// <summary> | |||
/// 进程分配私有内存 | |||
/// 单位MB | |||
/// </summary> | |||
public double PrivateMemorySize64 { get; set; } | |||
/// <summary> | |||
/// 进程执行CPU总处理时间 | |||
/// </summary> | |||
public TimeSpan CPUTotalProcessorTime { get; set; } | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions.Dtos | |||
{ | |||
public class JTNETcpSessionInfoDto | |||
{ | |||
/// <summary> | |||
/// 最后上线时间 | |||
/// </summary> | |||
public DateTime LastActiveTime { get; set; } | |||
/// <summary> | |||
/// 上线时间 | |||
/// </summary> | |||
public DateTime StartTime { get; set; } | |||
/// <summary> | |||
/// 终端VIN | |||
/// </summary> | |||
public string Vin { get; set; } | |||
/// <summary> | |||
/// 远程ip地址 | |||
/// </summary> | |||
public string RemoteAddressIP { get; set; } | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions.Dtos | |||
{ | |||
public class JTNETrafficInfoDto | |||
{ | |||
/// <summary> | |||
/// 总接收大小 | |||
/// 单位KB | |||
/// </summary> | |||
public double TotalReceiveSize { get; set; } | |||
/// <summary> | |||
/// 总发送大小 | |||
/// 单位KB | |||
/// </summary> | |||
public double TotalSendSize { get; set; } | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions.Dtos | |||
{ | |||
public class JTNEUdpSessionInfoDto | |||
{ | |||
/// <summary> | |||
/// 最后上线时间 | |||
/// </summary> | |||
public DateTime LastActiveTime { get; set; } | |||
/// <summary> | |||
/// 上线时间 | |||
/// </summary> | |||
public DateTime StartTime { get; set; } | |||
/// <summary> | |||
/// 终端VIN | |||
/// </summary> | |||
public string Vin { get; set; } | |||
/// <summary> | |||
/// 远程ip地址 | |||
/// </summary> | |||
public string RemoteAddressIP { get; set; } | |||
} | |||
} | |||
@@ -0,0 +1,16 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions.Dtos | |||
{ | |||
/// <summary> | |||
/// 统一下发请求参数 | |||
/// </summary> | |||
public class JTNEUnificationSendRequestDto | |||
{ | |||
public string Vin { get; set; } | |||
public byte[] Data { get; set; } | |||
} | |||
} | |||
@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace JTNE.DotNetty.Abstractions | |||
{ | |||
/// <summary> | |||
/// 会话通知(在线/离线) | |||
/// </summary> | |||
public interface IJTNESessionPublishing | |||
{ | |||
Task PublishAsync(string topicName, string value); | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace JTNE.DotNetty.Abstractions | |||
{ | |||
public interface IJTNESourcePackageDispatcher | |||
{ | |||
/// <summary> | |||
/// 源包分发器 | |||
/// 自定义源包分发器业务 | |||
/// ConfigureServices: | |||
/// services.Replace(new ServiceDescriptor(typeof(IJTNESourcePackageDispatcher),typeof(JTNESourcePackageDispatcherDefaultImpl),ServiceLifetime.Singleton)); | |||
/// </summary> | |||
Task SendAsync(byte[] data); | |||
} | |||
} |
@@ -0,0 +1,7 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>netstandard2.0</TargetFramework> | |||
</PropertyGroup> | |||
</Project> |
@@ -0,0 +1,88 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JTNE.DotNetty.Abstractions | |||
{ | |||
public class JTNEConstants | |||
{ | |||
public const string SessionOnline = "JTNESessionOnline"; | |||
public const string SessionOffline = "JTNESessionOffline"; | |||
public static class JTNEWebApiRouteTable | |||
{ | |||
public const string RouteTablePrefix = "/jtNEapi"; | |||
public const string SessionPrefix = "Session"; | |||
public const string TransmitPrefix = "Transmit"; | |||
public const string SystemCollectPrefix = "SystemCollect"; | |||
public const string TrafficPrefix = "Traffic"; | |||
public const string TcpPrefix = "Tcp"; | |||
public const string UdpPrefix = "Udp"; | |||
/// <summary> | |||
///获取当前系统进程使用率 | |||
/// </summary> | |||
public static string SystemCollectGet = $"{RouteTablePrefix}/{SystemCollectPrefix}/Get"; | |||
/// <summary> | |||
///基于Tcp的添加转发过滤地址 | |||
/// </summary> | |||
public static string TransmitAdd = $"{RouteTablePrefix}/{TcpPrefix}/{TransmitPrefix}/Add"; | |||
/// <summary> | |||
/// 基于Tcp的删除转发过滤地址(不能删除在网关服务器配置文件配的地址) | |||
/// </summary> | |||
public static string TransmitRemove = $"{RouteTablePrefix}/{TcpPrefix}/{TransmitPrefix}/Remove"; | |||
/// <summary> | |||
///基于Tcp的获取转发过滤地址信息集合 | |||
/// </summary> | |||
public static string TransmitGetAll = $"{RouteTablePrefix}/{TcpPrefix}/{TransmitPrefix}/GetAll"; | |||
/// <summary> | |||
/// 基于Tcp的包计数器 | |||
/// </summary> | |||
public static string GetTcpAtomicCounter = $"{RouteTablePrefix}/{TcpPrefix}/GetAtomicCounter"; | |||
/// <summary> | |||
/// 基于Tcp的会话服务集合 | |||
/// </summary> | |||
public static string SessionTcpGetAll = $"{RouteTablePrefix}/{TcpPrefix}/{SessionPrefix}/GetAll"; | |||
/// <summary> | |||
/// 基于Tcp的会话服务-通过设备终端号移除对应会话 | |||
/// </summary> | |||
public static string SessionTcpRemoveByTerminalPhoneNo = $"{RouteTablePrefix}/{TcpPrefix}/{SessionPrefix}/RemoveByTerminalPhoneNo"; | |||
/// <summary> | |||
/// 基于Tcp的统一下发信息 | |||
/// </summary> | |||
public static string UnificationTcpSend = $"{RouteTablePrefix}/{TcpPrefix}/UnificationSend"; | |||
/// <summary> | |||
/// 基于Tcp的流量服务获取 | |||
/// </summary> | |||
public static string TrafficTcpGet = $"{RouteTablePrefix}/{TcpPrefix}/{TrafficPrefix}/Get"; | |||
/// <summary> | |||
/// 获取Udp包计数器 | |||
/// </summary> | |||
public static string GetUdpAtomicCounter = $"{RouteTablePrefix}/{UdpPrefix}/GetAtomicCounter"; | |||
/// <summary> | |||
/// 基于Udp的统一下发信息 | |||
/// </summary> | |||
public static string UnificationUdpSend = $"{RouteTablePrefix}/{UdpPrefix}/UnificationSend"; | |||
/// <summary> | |||
/// 基于Udp的会话服务集合 | |||
/// </summary> | |||
public static string SessionUdpGetAll = $"{RouteTablePrefix}/{UdpPrefix}/{SessionPrefix}/GetAll"; | |||
/// <summary> | |||
/// 基于Udp的会话服务-通过设备终端号移除对应会话 | |||
/// </summary> | |||
public static string SessionUdpRemoveByTerminalPhoneNo = $"{RouteTablePrefix}/{UdpPrefix}/{SessionPrefix}/RemoveByTerminalPhoneNo"; | |||
/// <summary> | |||
/// 基于Udp的流量服务获取 | |||
/// </summary | |||
public static string TrafficUdpGet = $"{RouteTablePrefix}/{UdpPrefix}/{TrafficPrefix}/Get"; | |||
} | |||
} | |||
} |
@@ -9,13 +9,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JTNE.Protocol", "JTNE.Proto | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JTNE.DotNetty.Core", "JTNE.DotNetty.Core\JTNE.DotNetty.Core.csproj", "{045A407E-8D6B-4EDE-87F9-AD3E2531E978}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JTNE.DotNetty.Tcp", "JTNE.DotNetty.Tcp\JTNE.DotNetty.Tcp.csproj", "{2AD8F740-5468-4BF7-B37F-D98F061B9939}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JTNE.DotNetty.Tcp", "JTNE.DotNetty.Tcp\JTNE.DotNetty.Tcp.csproj", "{2AD8F740-5468-4BF7-B37F-D98F061B9939}" | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{8241ED6E-2BF2-4378-AC97-466A1CA6032C}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JTNE.DotNetty.Tcp.Test", "JTNE.DotNetty.Tests\JTNE.DotNetty.Tcp.Test\JTNE.DotNetty.Tcp.Test.csproj", "{298C5650-2DAC-40E2-9309-12A8651E0347}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JTNE.DotNetty.Tcp.Test", "JTNE.DotNetty.Tests\JTNE.DotNetty.Tcp.Test\JTNE.DotNetty.Tcp.Test.csproj", "{298C5650-2DAC-40E2-9309-12A8651E0347}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JTNE.DotNetty.Hosting", "JTNE.DotNetty.Tests\JTNE.DotNetty.Hosting\JTNE.DotNetty.Hosting.csproj", "{5BA5FC40-8A66-439F-B5C6-209E754488D9}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JTNE.DotNetty.Hosting", "JTNE.DotNetty.Tests\JTNE.DotNetty.Hosting\JTNE.DotNetty.Hosting.csproj", "{5BA5FC40-8A66-439F-B5C6-209E754488D9}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JTNE.DotNetty.Abstractions", "JTNE.DotNetty.Abstractions\JTNE.DotNetty.Abstractions.csproj", "{CF3948ED-BF18-44C6-B86C-0EE1DCC86D25}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
@@ -43,6 +45,10 @@ Global | |||
{5BA5FC40-8A66-439F-B5C6-209E754488D9}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{5BA5FC40-8A66-439F-B5C6-209E754488D9}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{5BA5FC40-8A66-439F-B5C6-209E754488D9}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{CF3948ED-BF18-44C6-B86C-0EE1DCC86D25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{CF3948ED-BF18-44C6-B86C-0EE1DCC86D25}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{CF3948ED-BF18-44C6-B86C-0EE1DCC86D25}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{CF3948ED-BF18-44C6-B86C-0EE1DCC86D25}.Release|Any CPU.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||