Skip to content

Ratelimits - #210

Merged
Crystalwarrior merged 3 commits into
masterfrom
ratelimits
Aug 25, 2026
Merged

Ratelimits#210
Crystalwarrior merged 3 commits into
masterfrom
ratelimits

Conversation

@Crystalwarrior

Copy link
Copy Markdown
Owner

Add global connection cap and connection age gate.

  • Global new-connections-per-second cap: server-wide limit on accepted connections, if the server is overloaded refuse new connections rather than allowing the server to die.
  • Minimum connection age gate: clients must be connected for N seconds before they can send IC messages or change characters. Mods/CMs exempt.

Add DOS protection: IC/CC flood guards, connection rate limiter, packet throttle

Bug fixes:

  • Fix WTCE flood guard reading music_change_floodguard mute_length instead of wtce_floodguard
  • Fix OOC flood guard reading music_change_floodguard mute_length instead of ooc_floodguard
  • Fix multiclient limit check (> should be >=)

New protections:

  • IC message flood guard (ic_floodguard): prevents rapid IC spam
  • Character change flood guard (cc_floodguard): prevents rapid CC spam. Also enforced on /switch and /randomchar commands
  • Per-IP connection rate limiter (connection_rate_limit): throttles rapid connect/disconnect cycles from the same IP
  • Global packet-per-second throttle (packet_rate_limit): hard per-client cap on packets/sec to prevent flooding

All configurable in config.yaml

…et throttle

Bug fixes:
- Fix WTCE flood guard reading music_change_floodguard mute_length instead of wtce_floodguard
- Fix OOC flood guard reading music_change_floodguard mute_length instead of ooc_floodguard
- Fix off-by-one in multiclient limit check (> should be >=)

New protections:
- IC message flood guard (ic_floodguard): prevents rapid IC spam
- Character change flood guard (cc_floodguard): prevents rapid CC spam
  Also enforced on /switch and /randomchar commands
- Per-IP connection rate limiter (connection_rate_limit): throttles rapid
  connect/disconnect cycles from the same IP
- Global packet-per-second throttle (packet_rate_limit): hard per-client
  cap on packets/sec to prevent wire-speed flooding

All new protections are disabled by default (0) and configurable in
config.yaml. Existing flood guard mute_length bugs caused WTCE to
mute for 180s instead of 1000s and OOC for 180s instead of 30s.
- Global new-connections-per-second cap: server-wide limit on TCP
  accepts regardless of IP. Catches distributed floods with rotating IPs.
  Config: global_connection_rate.max_per_second (default 0 = disabled,
  production recommended: 5)

- Minimum connection age gate: clients must be connected for N seconds
  before they can send IC messages or change characters. Mods/CMs exempt.
  Slows connect-spam-disconnect cycles. Config:
  min_connection_age.before_ic / before_cc (default 0 = disabled,
  production recommended: 3)

- Expanded config_sample with new protection config entries.
@Crystalwarrior
Crystalwarrior merged commit 71d9d73 into master Aug 25, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant