File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 Use : "dss" ,
2727 Short : "Scan a domain's DNS records." ,
2828 Long : "Scan a domain's DNS records.\n https://github.com/GlobalCyberAlliance/domain-security-scanner" ,
29- Version : "3.0.11 " ,
29+ Version : "3.0.12 " ,
3030 PersistentPreRun : func (cmd * cobra.Command , args []string ) {
3131 var logWriter io.Writer
3232
Original file line number Diff line number Diff line change 6464 log .Fatal ().Err (err ).Msg ("could not create domain scanner" )
6565 }
6666
67- server := http .NewServer (log , cmd .Version )
67+ server := http .NewServer (log , timeout , cmd .Version )
6868 if advise {
6969 server .Advisor = advisor .NewAdvisor (timeout , cache , checkTLS )
7070 }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module github.com/GlobalCyberAlliance/domain-security-scanner
33go 1.22.0
44
55require (
6- github.com/danielgtaylor/huma/v2 v2.13.1
6+ github.com/danielgtaylor/huma/v2 v2.14.0
77 github.com/emersion/go-imap v1.2.1
88 github.com/go-chi/chi/v5 v5.0.12
99 github.com/go-chi/cors v1.2.1
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
22github.qkg1.top/cespare/xxhash/v2 v2.3.0 /go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs =
33github.qkg1.top/coreos/go-systemd/v22 v22.5.0 /go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc =
44github.qkg1.top/cpuguy83/go-md2man/v2 v2.0.3 /go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o =
5- github.com/danielgtaylor/huma/v2 v2.13.1 h1:6smKeXGMddUY6PhBPeWHf/Z/aS4YLq0mq3tK0iWUuPc =
6- github.com/danielgtaylor/huma/v2 v2.13.1 /go.mod h1:bIRg+KyQETiMJmtfOHy2AOBTyx3zXBgppIAgIOMllAg =
5+ github.com/danielgtaylor/huma/v2 v2.14.0 h1:lRuhQQPZhePvJ4B/m4kfIUYfD8ZPy5BKq/oktLFmB50 =
6+ github.com/danielgtaylor/huma/v2 v2.14.0 /go.mod h1:OdHC/JliXtOrnvHLQTU5qV7WvYRQXwWY1tkl5rLXmuE =
77github.qkg1.top/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
88github.qkg1.top/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
99github.qkg1.top/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ type Server struct {
2424 apiPath string
2525 logger zerolog.Logger
2626 router huma.API
27+ timeout time.Duration
2728
2829 Addr string
2930 CheckTLS bool
@@ -34,10 +35,11 @@ type Server struct {
3435}
3536
3637// NewServer returns a new instance of Server.
37- func NewServer (logger zerolog.Logger , version string ) * Server {
38+ func NewServer (logger zerolog.Logger , timeout time. Duration , version string ) * Server {
3839 server := Server {
3940 apiPath : "/api/v1" ,
4041 logger : logger ,
42+ timeout : timeout ,
4143 }
4244
4345 config := huma .DefaultConfig ("Domain Security Scanner" , version )
@@ -103,9 +105,14 @@ func (s *Server) Serve(port int) {
103105 }
104106
105107 portString := cast .ToString (port )
108+ httpServer := & http.Server {
109+ Addr : "0.0.0.0:" + portString ,
110+ Handler : s .router .Adapter (),
111+ WriteTimeout : 4 * s .timeout , // timeout is used by the scanner per request, so multiply it by 4 to allow for bulk requests
112+ }
106113
107114 s .logger .Info ().Msg ("Starting api server on port " + portString )
108- s .logger .Fatal ().Err (http .ListenAndServe ("0.0.0.0:" + portString , s . router . Adapter () )).Msg ("an error occurred while hosting the api server" )
115+ s .logger .Fatal ().Err (httpServer .ListenAndServe ()).Msg ("an error occurred while hosting the api server" )
109116}
110117
111118func (s * Server ) registerVersionRoute (version string ) {
You can’t perform that action at this time.
0 commit comments