code.dwrz.net

Go monorepo.
Log | Files | Refs

configuration.go (1282B)


      1 package defaults
      2 
      3 import (
      4 	"time"
      5 
      6 	"github.com/aws/aws-sdk-go-v2/aws"
      7 )
      8 
      9 // Configuration is the set of SDK configuration options that are determined based
     10 // on the configured DefaultsMode.
     11 type Configuration struct {
     12 	// RetryMode is the configuration's default retry mode API clients should
     13 	// use for constructing a Retryer.
     14 	RetryMode aws.RetryMode
     15 
     16 	// ConnectTimeout is the maximum amount of time a dial will wait for
     17 	// a connect to complete.
     18 	//
     19 	// See https://pkg.go.dev/net#Dialer.Timeout
     20 	ConnectTimeout *time.Duration
     21 
     22 	// TLSNegotiationTimeout specifies the maximum amount of time waiting to
     23 	// wait for a TLS handshake.
     24 	//
     25 	// See https://pkg.go.dev/net/http#Transport.TLSHandshakeTimeout
     26 	TLSNegotiationTimeout *time.Duration
     27 }
     28 
     29 // GetConnectTimeout returns the ConnectTimeout value, returns false if the value is not set.
     30 func (c *Configuration) GetConnectTimeout() (time.Duration, bool) {
     31 	if c.ConnectTimeout == nil {
     32 		return 0, false
     33 	}
     34 	return *c.ConnectTimeout, true
     35 }
     36 
     37 // GetTLSNegotiationTimeout returns the TLSNegotiationTimeout value, returns false if the value is not set.
     38 func (c *Configuration) GetTLSNegotiationTimeout() (time.Duration, bool) {
     39 	if c.TLSNegotiationTimeout == nil {
     40 		return 0, false
     41 	}
     42 	return *c.TLSNegotiationTimeout, true
     43 }