Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/client/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/google/uuid"
"github.com/gravitational/trace"

apidefaults "github.com/gravitational/teleport/api/defaults"
"github.com/gravitational/teleport/lib/auth"
"github.com/gravitational/teleport/lib/secret"
"github.com/gravitational/teleport/lib/utils"
Expand Down Expand Up @@ -148,7 +149,11 @@ func (rd *Redirector) Start() error {
}
rd.server = &httptest.Server{
Listener: listener,
Config: &http.Server{Handler: rd.mux},
Config: &http.Server{
Handler: rd.mux,
ReadHeaderTimeout: apidefaults.DefaultIOTimeout,
IdleTimeout: apidefaults.DefaultIdleTimeout,
},
}
rd.server.Start()
} else {
Expand Down
9 changes: 8 additions & 1 deletion lib/observability/tracing/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/protobuf/proto"

apidefaults "github.com/gravitational/teleport/api/defaults"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: there's only a single defaults package imported here so we can drop the alias

Suggested change
apidefaults "github.com/gravitational/teleport/api/defaults"
"github.com/gravitational/teleport/api/defaults"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current imports of this defaults all seemed to be consistently aliasing to apidefaults. So I was just trying to stay consistent to that existing usage. Let me know your thoughts

Copy link
Copy Markdown
Contributor

@rosstimothy rosstimothy Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's likely only the case when "github.com/gravitational/teleport/lib/defaults" is also imported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO having the same aliases across all files makes things simpler. Otherwise, if lib/defaults is added to these files, we may end up with libdefaults and defaults, which points to something completely different than you would expect.

)

// Collector is a simple in memory implementation of an OpenTelemetry Collector
Expand Down Expand Up @@ -80,7 +82,12 @@ func NewCollector(cfg CollectorConfig) (*Collector, error) {
exportedC: make(chan struct{}, 1),
}

c.httpServer = &http.Server{Handler: c, TLSConfig: tlsConfig.Clone()}
c.httpServer = &http.Server{
Handler: c,
ReadHeaderTimeout: apidefaults.DefaultIOTimeout,
IdleTimeout: apidefaults.DefaultIdleTimeout,
TLSConfig: tlsConfig.Clone(),
}

coltracepb.RegisterTraceServiceServer(c.grpcServer, c)

Expand Down
7 changes: 5 additions & 2 deletions lib/tbot/tbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"

apidefaults "github.com/gravitational/teleport/api/defaults"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/lib/auth"
"github.com/gravitational/teleport/lib/auth/authclient"
Expand Down Expand Up @@ -185,8 +186,10 @@ func (b *Bot) Run(ctx context.Context) error {
_, _ = w.Write([]byte(msg))
}))
srv := http.Server{
Addr: b.cfg.DiagAddr,
Handler: mux,
Addr: b.cfg.DiagAddr,
Handler: mux,
ReadHeaderTimeout: apidefaults.DefaultIOTimeout,
IdleTimeout: apidefaults.DefaultIdleTimeout,
}
go func() {
<-egCtx.Done()
Expand Down