Go-based FM stereo transmitter with RDS, Windows-first and cross-platform
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
675B

  1. package control
  2. import (
  3. "net/http"
  4. "time"
  5. "github.com/jan/fm-rds-tx/internal/config"
  6. )
  7. const (
  8. defaultReadTimeout = 5 * time.Second
  9. defaultWriteTimeout = 10 * time.Second
  10. defaultIdleTimeout = 60 * time.Second
  11. defaultMaxHeaderBytes = 1 << 20 // 1 MiB
  12. )
  13. // NewHTTPServer returns a configured HTTP server for the control plane.
  14. func NewHTTPServer(cfg config.Config, handler http.Handler) *http.Server {
  15. return &http.Server{
  16. Addr: cfg.Control.ListenAddress,
  17. Handler: handler,
  18. ReadTimeout: defaultReadTimeout,
  19. WriteTimeout: defaultWriteTimeout,
  20. IdleTimeout: defaultIdleTimeout,
  21. MaxHeaderBytes: defaultMaxHeaderBytes,
  22. }
  23. }