ModernUO/Projects/Server
Kamron Batman 4cd668ef61
feat: Moves TcpServer to another thread. Rewrites Firewall (#1660)
## Breaking Changes
* The Firewall and IP Limiter have been rewritten. Please read the notes carefully!
* `TcpServer.Instances` moved back to `NetState.Instances` - sorry - it was stupid to move it to begin with.

> [!Note]
> Sockets that fail the IP Limiter or Firewall will be immediately and forcibly disconnected.
> This means they will be stuck at "Verifying account..." if it was a real client.

### Summary
- Removes firewall wildcard support.
- Removes `AccessRestrictions`.
- Moves Firewall/IPLimiter to the core.
- Moves `TcpServer` to its own thread.
- Removes the `SocketConnect` and `SocketDisconnect` event sinks.
- Moves `Instances` back to `NetState.Instances`.
- Fixes a long standing bug with bad handling of duplicate listener addresses.

#### Firewall
The firewall has been completely rewritten. There is now an "Admin Firewall" which saves to the config file. Secondarily, there is an internal firewall used exclusively by the TcpServer while processing sockets. The Admin firewall mirrors it's additions/deletions to the internal firewall by adding requests to a queue.

> [!IMPORTANT]  
> **Wildcard firewall entries, such as `X`, `*`, `?` are not allowed.**
> **Ranges in between IP classes or sextets are not allowed.**
> **Please make sure to use one of the following:**
> * IP Address - `192.168.1.1`
> * CIDR - `192.168.1.0/24`
> * Range - `192.168.1.1-192.168.1.100`

#### IP Limiter
The IP Limiter has been completely rewritten. The available configurations are:
```json
"ipLimiter.enable": "True",
"ipLimiter.maxConnectionsPerIP": 10,
"ipLimiter.clearConnectionAttemptsDuration": "00:00:00:10",
"ipLimiter.clearThrottledDuration": "00:00:02:00",
```

The IP Limiter is set up to prevent spamming connections from the same IP. Every time an IP connects, it is added to a connection list. After 10 attempts, the IP is added to the throttle list. To keep the system fast, the connection list is entirely wiped every 10 seconds, and the throttle list is entirely wiped every 2 minutes.
2024-01-20 14:25:12 -08:00
..
Buffers feat: Updates to .NET 8. (#1542) 2023-11-14 17:08:09 -08:00
Client feat: Adds KR/EC client versions (No actual support yet). (#1506) 2023-09-18 23:53:18 -07:00
Collections fix: Fixes pooled ref collections dispose on defaults (#1638) 2023-12-15 13:46:52 -08:00
Comparers chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Configuration feat: Adds configurable skill and stat gain (#1489) 2023-10-14 12:02:36 -07:00
ContextMenus fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Diagnostics fix: Fixes PainSpike, ManaVampire, Evil Omen, and Curse (#1622) 2023-12-02 09:59:42 -08:00
Events feat: Moves TcpServer to another thread. Rewrites Firewall (#1660) 2024-01-20 14:25:12 -08:00
Exceptions chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
GarbageCollection fix: Adds Gen2 callback for each STArrayPool (#971) 2022-03-26 13:57:42 -07:00
Geometry fix: Changes Map.Sector.Items to link list. (#1547) 2023-10-16 20:51:02 -07:00
Gumps chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Items fix: Fixes default GumpID and DropSound serialization for containers (#1631) 2023-12-08 16:02:23 -08:00
Json fix: Codegens BaseMulti, Container, and VirtualCheck (#1624) 2023-12-02 10:00:02 -08:00
Localization chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Logging chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Maps fix: Fixes GetItemsAt, GetMobilesAt, and GetClientsAt (#1653) 2023-12-30 09:47:21 -08:00
Menus fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Migrations fix: Adds missing migration files. (#1642) 2023-12-20 13:02:01 -08:00
Mobiles fix: Codegens boats (#1625) 2023-12-02 12:55:38 -08:00
Network feat: Moves TcpServer to another thread. Rewrites Firewall (#1660) 2024-01-20 14:25:12 -08:00
PropertyList chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Random fix: Use built-in RNG (#1599) 2023-11-17 17:45:18 -08:00
Regions fix: Adds required changes for Advanced Search feature (#1650) 2023-12-28 18:16:58 -08:00
Serialization fix: Codegens BaseMulti, Container, and VirtualCheck (#1624) 2023-12-02 10:00:02 -08:00
Targeting Adds hue support to StaticTile (#1321) 2023-01-21 11:19:11 -08:00
Text fix: Adds required changes for Advanced Search feature (#1650) 2023-12-28 18:16:58 -08:00
TileMatrix fix: Fixes wrong sector shift for tilematrix iteration (#1623) 2023-12-01 18:09:26 -06:00
Timer chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
TimeZones chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Utilities feat: Moves TcpServer to another thread. Rewrites Firewall (#1660) 2024-01-20 14:25:12 -08:00
World feat: Moves TcpServer to another thread. Rewrites Firewall (#1660) 2024-01-20 14:25:12 -08:00
AssemblyHandler.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Attributes.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
CityInfo.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Commands.cs fix: Fixes crafter deserialize, cleans up bandages, and codegens misc items (#1350) 2023-02-25 00:54:12 -08:00
Effects.cs fix: Adds GetClients to map iterators (#1574) 2023-10-30 18:49:00 -07:00
EventLoopTasks.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
ExpansionInfo.cs feat: Adds KR/EC client versions (No actual support yet). (#1506) 2023-09-18 23:53:18 -07:00
Guild.cs fix: Fixes serialization threading, moves world save to end of loop, and eliminates Parallel.ForEach. (#1530) 2023-10-03 00:42:49 -07:00
HuePicker.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
IAccount.cs fix: Reverts GetAccount to use IAccount. Adds IAccount to serialization. (#1565) 2023-10-25 19:17:57 -07:00
IEntity.cs fix: Fixes map iterators for Items (#1564) 2023-10-26 17:49:15 -07:00
Interfaces.cs fix: Fixes casting by sending ParalyzeFlag to client while animating (#1397) 2023-04-27 23:12:07 -07:00
KeywordList.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Main.cs feat: Moves TcpServer to another thread. Rewrites Firewall (#1660) 2024-01-20 14:25:12 -08:00
MessageType.cs fix: Moves the rest of the Incoming packets (#1338) 2023-02-10 22:59:36 -08:00
Module.cs fix: Fixes sending packets and sidesteps a major issue with stackalloc and PGO in .NET 8 (#1607) 2023-11-21 12:18:20 -08:00
MultiData.cs fix: Refactors getting static tiles to use enumerators (#1611) 2023-11-26 09:39:46 -08:00
MUO.ico Adds MUO Logo (#52) 2019-09-12 13:13:13 -07:00
Party.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Poison.cs fix: Adds ISpanParsable and fixes command conditionals (#1241) 2022-11-12 00:26:02 -08:00
Prompt.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Race.cs fix: Fixes TryParse for Race (#1244) 2022-11-12 00:31:25 -08:00
SecureTrade.cs fix: Update LabelTo, SendMessage, etc to Interpolated Strings (#1283) 2022-11-28 19:58:12 -08:00
Serial.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Server.csproj fix: Adds missing migration files. (#1642) 2023-12-20 13:02:01 -08:00
Skills.cs feat: Adds configurable skill and stat gain (#1489) 2023-10-14 12:02:36 -07:00
TileData.cs fix: Cleans up FindItems and removes allocations (#1516) 2023-09-28 22:20:36 -07:00
TileList.cs fix: Refactors getting static tiles to use enumerators (#1611) 2023-11-26 09:39:46 -08:00