LoadAndApplyRateConfig reads a [RateConfig] from the file at path and applies it to the server via [Server.UpdateRateLimits].
(path string)
| 553 | // LoadAndApplyRateConfig reads a [RateConfig] from the file at path and |
| 554 | // applies it to the server via [Server.UpdateRateLimits]. |
| 555 | func (s *Server) LoadAndApplyRateConfig(path string) error { |
| 556 | rc, err := LoadRateConfig(path) |
| 557 | if err != nil { |
| 558 | return err |
| 559 | } |
| 560 | applied := s.UpdateRateLimits(rc) |
| 561 | s.logf("rate config applied: client-rate=%d bytes/sec, client-burst=%d bytes", |
| 562 | applied.PerClientRateLimitBytesPerSec, applied.PerClientRateBurstBytes) |
| 563 | return nil |
| 564 | } |
| 565 | |
| 566 | // UpdateRateLimits sets the receive rate limits, updating all existing client |
| 567 | // connections. It returns the applied config, which may differ from rc. If the |