|
@@ -2,6 +2,7 @@
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Primitives;
|
|
using Microsoft.Extensions.Primitives;
|
|
|
|
+using System.Net;
|
|
using System.Net.WebSockets;
|
|
using System.Net.WebSockets;
|
|
using System.Text;
|
|
using System.Text;
|
|
|
|
|
|
@@ -57,9 +58,19 @@ public class WebsocketService<T> where T : WsSession
|
|
data.UriScheme = context?.Request?.Scheme;
|
|
data.UriScheme = context?.Request?.Scheme;
|
|
data.AuthHeader = context?.Request?.Headers?.Authorization;
|
|
data.AuthHeader = context?.Request?.Headers?.Authorization;
|
|
data.SessionID = context.TraceIdentifier;
|
|
data.SessionID = context.TraceIdentifier;
|
|
- data.Endpoint = null;
|
|
|
|
data.Origin = context.Request.Headers.Origin;
|
|
data.Origin = context.Request.Headers.Origin;
|
|
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ var ipaddress = context.Connection.RemoteIpAddress;
|
|
|
|
+ var port = context.Connection.RemotePort;
|
|
|
|
+ data.Endpoint = new IPEndPoint(ipaddress, port);
|
|
|
|
+ }
|
|
|
|
+ catch
|
|
|
|
+ {
|
|
|
|
+ data.Endpoint = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
var validated = ValidateHandshake == null ? false : await ValidateHandshake(data);
|
|
var validated = ValidateHandshake == null ? false : await ValidateHandshake(data);
|
|
|
|
|
|
if (!validated)
|
|
if (!validated)
|