Documentation ¶
Index ¶
- func CheckFileExists(filename string) error
- func GetTLSConfig(s *ClientTLSSettings) (*tls.Config, error)
- func GetX509KeyPair(certFile, keyFile, keyPassword string) (tls.Certificate, error)
- func NewRoundTripper(ctx context.Context, log *zap.SugaredLogger, s ClientSettings, ...) (http.RoundTripper, error)
- type BackstopError
- type Client
- type ClientAuthType
- type ClientSettings
- type ClientTLSSettings
- type Configuration
- type Errors
- type HTTP
- type SSL
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFileExists ¶
func GetTLSConfig ¶
func GetTLSConfig(s *ClientTLSSettings) (*tls.Config, error)
func GetX509KeyPair ¶
func GetX509KeyPair(certFile, keyFile, keyPassword string) (tls.Certificate, error)
func NewRoundTripper ¶ added in v1.16.1
func NewRoundTripper(ctx context.Context, log *zap.SugaredLogger, s ClientSettings, identity token.Identity) (http.RoundTripper, error)
Types ¶
type BackstopError ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type ClientAuthType ¶
type ClientAuthType string
const ( ClientAuthNone ClientAuthType = "none" ClientAuthWant ClientAuthType = "want" ClientAuthNeed ClientAuthType = "need" ClientAuthAny ClientAuthType = "any" ClientAuthRequest ClientAuthType = "request" )
type ClientSettings ¶
type ClientSettings struct { // Client base URL (e.g. https://my-service/some/path/) BaseUrl string `yaml:"baseUrl,omitempty" json:"baseUrl,omitempty"` // MaxIdleConns controls the maximum number of idle (keep-alive) // connections for the given service. Zero means no limit. // From http.Transport // Defaults to 10 MaxIdleConns int `yaml:"maxIdleConns,omitempty" json:"maxIdleConns,omitempty"` // IdleConnTimeoutSeconds is the maximum amount of time an idle // (keep-alive) connection will remain idle before closing // itself. // Zero means no limit. // From http.Transport // Defaults to 90s IdleConnTimeoutSeconds int32 `yaml:"idleConnTimeoutSeconds,omitempty" json:"idleConnTimeoutSeconds,omitempty"` // MaxConnections optionally limits the number of connections to the service. // Zero means no limit. // Defaults to zero MaxConnections int32 `yaml:"maxConnections,omitempty" json:"maxConnections,omitempty"` // TLSHandshakeTimeoutSeconds specifies the maximum amount of time waiting to // wait for a TLS handshake. Zero means no timeout. // From http.Transport // Defaults to 10s TLSHandshakeTimeoutSeconds int32 `yaml:"tlsHandshakeTimeoutSeconds,omitempty" json:"tlsHandshakeTimeoutSeconds,omitempty"` // TimeoutSeconds limits how long we wait for a response // Zero means no limit // Defaults to 30s TimeoutSeconds int32 `yaml:"timeoutSeconds,omitempty" json:"timeoutSeconds,omitempty"` // KeepAliveSeconds specifies the interval between keep-alive // probes for an active network connection. // If zero, keep-alive probes are sent with a default value // (currently 15 seconds), if supported by the protocol and operating // system. Network protocols or operating systems that do // not support keep-alives ignore this field. // If negative, keep-alive probes are disabled. // ^ from net.dial // Defaults to 30s KeepAliveSeconds int32 `yaml:"keepAliveSeconds,omitempty" json:"keepAliveSeconds,omitempty"` TLS *ClientTLSSettings `yaml:"tls,omitempty" json:"tls,omitempty"` }
func NewDefaultClientSettings ¶
func NewDefaultClientSettings() ClientSettings
type ClientTLSSettings ¶
type ClientTLSSettings struct { // Override server name to check on certificate ServerName string `yaml:"serverName,omitempty" json:"serverName,omitempty"` // Don't check server name InsecureSkipVerify bool `yaml:"insecureSkipVerify" json:"insecureSkipVerify"` // Key file if the cert file doesn't provide it ClientKeyFile string `yaml:"clientKeyFile,omitempty" json:"clientKeyFile,omitempty"` // Key password if the key is encrypted ClientKeyPassword string `yaml:"clientKeyFilePassword,omitempty" json:"clientKeyFilePassword,omitempty"` // If not provided, it will default to the system cacerts CAcertFile string `yaml:"cacertFile,omitempty" json:"cacertFile,omitempty"` // Client certificate file - useful for mTLS ClientCertFile string `yaml:"clientCertFile,omitempty" json:"clientCertFile,omitempty"` }
type Configuration ¶ added in v1.7.1
type Configuration struct {
HTTP HTTP
}
func (Configuration) GetAddr ¶ added in v1.7.1
func (s Configuration) GetAddr() string
type SSL ¶
type SSL struct { // Enable SSL Enabled bool // Certificate file, can be just a PEM of cert + key or just the cert in which case you'll also need // to provide the key file CertFile string // Key file if the cert file doesn't provide it KeyFile string // Key password if the key is encrypted KeyPassword string // when using mTLS, CA PEM. If not provided, it will default to the certificate of the server as a CA CAcertFile string // Client auth requested (none, want, need, any, request) ClientAuth ClientAuthType }
Click to show internal directories.
Click to hide internal directories.