public override void Connecting(IServer server, ConnectingEventArgs e) { if (server.Count > Options.MaxConnections) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"HTTP ${e.Socket.RemoteEndPoint} out of max connections!"); } } IPEndPoint ipPoint = (IPEndPoint)e.Socket.RemoteEndPoint; if (!IPv4Tables.Verify(ipPoint.Address)) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"HTTP ${e.Socket.RemoteEndPoint} IPv4 tables verify no permission!"); } } if (Options.IPRpsLimit > 0) { string ip = ((IPEndPoint)e.Socket.RemoteEndPoint).Address.ToString(); var item = mIPLimit.GetItem(ip); if (item != null) { if (!item.Enabled) { e.Cancel = true; } } } HttpConnecting?.Invoke(this, e); e.Socket.NoDelay = true; }
public override void Connecting(IServer server, ConnectingEventArgs e) { if (server.Count > Options.MaxConnections) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"HTTP ${e.Socket.RemoteEndPoint} out of max connections!"); } } IPEndPoint ipPoint = (IPEndPoint)e.Socket.RemoteEndPoint; if (!IPv4Tables.Verify(ipPoint.Address)) { e.Cancel = true; if (EnableLog(LogType.Warring)) { Log(LogType.Warring, $"HTTP ${e.Socket.RemoteEndPoint} IPv4 tables verify no permission!"); } } HttpConnecting?.Invoke(this, e); e.Socket.NoDelay = true; }
/// <summary> /// Точка входа для парсинга /// </summary> internal static ProductDto GetAttr(string url) { var content = HttpConnecting.CreateHttpConnect(url); return(GetAttrProduct(content)); }