Documentation ¶
Index ¶
- func CheckFileExists(filename string) error
- func GetTLSConfig(s *ClientTLSSettings) (*tls.Config, error)
- func GetX509KeyPair(certFile, keyFile, keyPassword string) (tls.Certificate, error)
- func GinClientVersionMiddleware(c *gin.Context)
- type BackstopError
- type Client
- type ClientAuthType
- type ClientSettings
- type ClientTLSSettings
- type ClientVersion
- type Errors
- type HTTP
- type SSL
- type Server
- type ServerSettings
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)
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 ClientVersion ¶
func ClientVersionFromContext ¶
func ClientVersionFromContext(ctx context.Context) ClientVersion
type SSL ¶
type SSL struct { // Enable SSL Enabled bool `yaml:"enabled"` // 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 `yaml:"certFile"` // Key file if the cert file doesn't provide it KeyFile string `yaml:"keyFile"` // Key password if the key is encrypted KeyPassword string `yaml:"keyFilePassword"` // when using mTLS, CA PEM. If not provided, it will default to the certificate of the server as a CA CAcertFile string `yaml:"cacertFile"` // Client auth requested (none, want, need, any, request) ClientAuth ClientAuthType `yaml:"clientAuth"` }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(config ServerSettings) *Server
type ServerSettings ¶
type ServerSettings struct {
HTTP HTTP `yaml:"http"`
}
func (ServerSettings) GetAddr ¶
func (s ServerSettings) GetAddr() string
Click to show internal directories.
Click to hide internal directories.