Skip to content

Commit

Permalink
moved http timeouts to const values
Browse files Browse the repository at this point in the history
  • Loading branch information
mosajjal committed Dec 30, 2024
1 parent cf2e889 commit e17a31e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pkg/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ const (
DNSBootstrapIPv6 = "2606:4700:4700::1111"
// DNSTimeout is the default timeout for DNS queries
DNSTimeout = 10 * time.Second
// HTTPReadTimeout is the default timeout for HTTP requests
HTTPReadTimeout = 10 * time.Second
// HTTPWriteTimeout is the default timeout for HTTP responses
HTTPWriteTimeout = 10 * time.Second
)

// below are some functions to help populating some config fields based on other config fields
Expand Down
5 changes: 2 additions & 3 deletions pkg/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net"
"net/http"
"strings"
"time"

"github.com/mosajjal/sniproxy/v2/pkg/acl"
"github.com/rs/zerolog"
Expand Down Expand Up @@ -45,8 +44,8 @@ func RunHTTP(c *Config, bind string, l zerolog.Logger) {
s := &http.Server{
Addr: bind,
Handler: handler,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
ReadTimeout: HTTPReadTimeout,
WriteTimeout: HTTPWriteTimeout,
MaxHeaderBytes: 1 << 20,
}

Expand Down

0 comments on commit e17a31e

Please sign in to comment.