Documentation ¶
Index ¶
- Variables
- func CanCreateSCTPConnection(address string, config *Config) bool
- func CanCreateTCPConnection(address string, config *Config) bool
- func CanCreateUDPConnection(address string, config *Config) bool
- func CanPerformStartTLS(address string, config *Config) (connected bool, certificate *x509.Certificate, err error)
- func CanPerformTLS(address string, config *Config) (connected bool, certificate *x509.Certificate, err error)
- func GetDomainExpiration(hostname string) (domainExpiration time.Duration, err error)
- func GetHTTPClient(config *Config) *http.Client
- func InjectHTTPClient(httpClient *http.Client)
- func Ping(address string, config *Config) (bool, time.Duration)
- type Config
- type DNSResolverConfig
- type OAuth2Config
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidDNSResolver = errors.New("invalid DNS resolver specified. Required format is {proto}://{ip}:{port}") ErrInvalidDNSResolverPort = errors.New("invalid DNS resolver port") ErrInvalidClientOAuth2Config = errors.New("invalid oauth2 configuration: must define all fields for client credentials flow (token-url, client-id, client-secret, scopes)") )
Functions ¶
func CanCreateSCTPConnection ¶
CanCreateSCTPConnection checks whether a connection can be established with a SCTP endpoint
func CanCreateTCPConnection ¶
CanCreateTCPConnection checks whether a connection can be established with a TCP endpoint
func CanCreateUDPConnection ¶
CanCreateUDPConnection checks whether a connection can be established with a UDP endpoint
func CanPerformStartTLS ¶
func CanPerformStartTLS(address string, config *Config) (connected bool, certificate *x509.Certificate, err error)
CanPerformStartTLS checks whether a connection can be established to an address using the STARTTLS protocol
func CanPerformTLS ¶
func CanPerformTLS(address string, config *Config) (connected bool, certificate *x509.Certificate, err error)
CanPerformTLS checks whether a connection can be established to an address using the TLS protocol
func GetDomainExpiration ¶
GetDomainExpiration retrieves the duration until the domain provided expires
func GetHTTPClient ¶
GetHTTPClient returns the shared HTTP client, or the client from the configuration passed
func InjectHTTPClient ¶
InjectHTTPClient is used to inject a custom HTTP client for testing purposes
Types ¶
type Config ¶
type Config struct { // Insecure determines whether to skip verifying the server's certificate chain and host name Insecure bool `yaml:"insecure,omitempty"` // IgnoreRedirect determines whether to ignore redirects (true) or follow them (false, default) IgnoreRedirect bool `yaml:"ignore-redirect,omitempty"` // Timeout for the client Timeout time.Duration `yaml:"timeout"` // DNSResolver override for the HTTP client // Expected format is {protocol}://{host}:{port}, e.g. tcp://8.8.8.8:53 DNSResolver string `yaml:"dns-resolver,omitempty"` // OAuth2Config is the OAuth2 configuration used for the client. // // If non-nil, the http.Client returned by getHTTPClient will automatically retrieve a token if necessary. // See configureOAuth2 for more details. OAuth2Config *OAuth2Config `yaml:"oauth2,omitempty"` // contains filtered or unexported fields }
Config is the configuration for clients
func GetDefaultConfig ¶
func GetDefaultConfig() *Config
GetDefaultConfig returns a copy of the default configuration
func (*Config) HasCustomDNSResolver ¶
HasCustomDNSResolver returns whether a custom DNSResolver is configured
func (*Config) HasOAuth2Config ¶
HasOAuth2Config returns true if the client has OAuth2 configuration parameters
func (*Config) ValidateAndSetDefaults ¶
ValidateAndSetDefaults validates the client configuration and sets the default values if necessary
type DNSResolverConfig ¶
DNSResolverConfig is the parsed configuration from the DNSResolver config string.
type OAuth2Config ¶
type OAuth2Config struct { TokenURL string `yaml:"token-url"` // e.g. https://dev-12345678.okta.com/token ClientID string `yaml:"client-id"` ClientSecret string `yaml:"client-secret"` Scopes []string `yaml:"scopes"` // e.g. ["openid"] }
OAuth2Config is the configuration for the OAuth2 client credentials flow