Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsecureSink ¶
InsecureSink returns a transport that always dials to the specified address, and skips certificate verification.
Types ¶
type DualServer ¶
type DualServer struct { HTTP *httptest.Server HTTPS *httptest.Server TLSConfigs *TLSConfigs Transport *http.Transport }
DualServer wraps two *httptest.Server's with a transport that goes to one of them base on HTTP or HTTPS.
func NewDualServer ¶
func NewDualServer(domains []string, h http.Handler) (*DualServer, error)
NewDualServer creates an HTTPS dual server for the given testing domains.
func (*DualServer) Client ¶
func (s *DualServer) Client() *http.Client
Client creates an HTTP client which transport connects directly to one of the servers base on the protocol port.
type Server ¶
type Server struct { *httptest.Server TLSConfigs *TLSConfigs Transport *http.Transport }
Server wraps a *httptest.Server with HTTP support.
func (*Server) Client ¶
Client creates an HTTP client which transport connects directly to the server.
func (*Server) SinkTransport ¶
SinkTransport sinks the transport to the server and sets the TLS client config.
type TLSConfigs ¶
TLSConfigs creates the certificate setup required for a set of domains.
func NewTLSConfigs ¶
func NewTLSConfigs(domains []string) (*TLSConfigs, error)
NewTLSConfigs creates a new setup with proper TLS config and HTTP
func (*TLSConfigs) Sink ¶
func (c *TLSConfigs) Sink(sinkAddr string) *http.Transport
Sink returns a transport where every outgoing connection dials the same sinkAddr but assumes the address is certified as the domains in the TLSConfigs.
func (*TLSConfigs) SinkHTTPS ¶
func (c *TLSConfigs) SinkHTTPS(httpAddr, httpsAddr string) *http.Transport
SinkHTTPS returns a transport where outgoing https connections dial httpsAddr and all other outgoing connections dial httpAddr. When it is HTTPS, it assumes the address is certified as the domains in TLSConfigs.