Tham chiếu API Network
Trên trang này
Namespaces: Nalix.Network.Connections, Nalix.Network.Listeners.Tcp, Nalix.Network.Listeners.Udp, Nalix.Network.Listeners.Web, Nalix.Network.Protocols, Nalix.Network.RateLimiting, Nalix.Network.Options
Assembly: Nalix.Network
Nalix.Network là bộ máy transport phía máy chủ. Nó quản lý socket TCP, UDP và WebSocket thô, thực thi kiểm soát chấp nhận nhiều lớp và backpressure của callback, duy trì registry kết nối phân mảnh, và chuyển các payload đã đóng khung vào IProtocol.
Bản đồ transport tổng thể
flowchart TD
subgraph Listeners["Layer 1: Listeners"]
TCP["TcpListenerBase"]
UDP["UdpListenerBase / UdpPassthroughListener"]
WS["WebSocketListenerBase"]
end
subgraph Core["Layer 2: Connection & Registry"]
Conn["Connection / WebSocketConnection / PassthroughConnection"]
Hub["ConnectionHub (Sharded ConnectionRegistry)"]
end
subgraph Transport["Layer 3: Framed Socket I/O"]
SC["SocketConnection (SAEA + Framing + Fragmentation)"]
STCP["SocketTcpTransport"]
SUDP["SocketUdpTransport"]
WST["WebSocketTransport"]
end
subgraph Support["Layer 4: Guards & Timers"]
TW["TimingWheel"]
Lim["ConnectionGuard / DatagramGuard"]
AC["AsyncCallback (Process / Post / High-Priority Lanes)"]
end
WS -->|Inherits| TCP
Listeners -->|Accept / Resolve| Conn
Conn -->|Registers in| Hub
Conn -->|Owns| SC
SC -->|Wrapped by| STCP
Conn -->|Optional companion| SUDP
Conn -->|WebSocket framing| WST
SC -->|Dispatches via| AC
TW -.->|Reaps idle| Conn
Lim -.->|Gatekeeps| ListenersThứ tự đọc từ đầu
- Socket Connection — Bộ máy nhận và gửi SAEA nội bộ, khung độ dài/VarInt, phân mảnh và giới hạn gói chờ ở Layer 1.
- TCP Listener và UDP Listener — Kích hoạt socket, kiểm soát chấp nhận qua
ConnectionGuard/DatagramGuard, phân tích PROXY protocol, và xác thực UDP bằng 8-byte token + 4-byte MAC. - Connection — Triển khai
IConnectionmức cao, sở hữu định danh (ConnectionId), ngữ cảnh mật mã (Secret,Algorithm),Attributesvà các cầu nối sự kiện. - Connection Hub —
ConnectionRegistryphân mảnh (băm phân mảnhMIX64), broadcast snapshot zero-allocation và telemetryIReportable. - Timing Wheel — Bộ hẹn giờ hashed wheel để thu hồi kết nối nhàn rỗi với chi phí thấp.
Các khu vực chính
Hệ thống kết nối
- Connection
- Connection Hub
- Connection Events
- Connection Extensions
- Connection Guard
- Connection Limiter
Giao thức và transport
Tùy chọn mạng
- Options Overview
- Network Socket Options
- Connection Quota Options
- Connection Guard Options
- Trusted Proxy Options
- Connection Ban Store Options
- Connection Blacklist Store Options
- Connection Hub Options
- Timing Wheel Options
- Pooling Options
- Network Callback Options
- Session Store Options
- Compression Options