tcptest

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	Dial(network, addr string) (net.Conn, error)
}

type RetryDialer

type RetryDialer struct {
	Dialer  net.Dialer
	Timeout time.Duration
	Sleep   time.Duration
}

RetryDialer retries the Dial function until it succeeds or the timeout has been reached. The default timeout is one second and the default sleep interval is 100ms.

func NewRetryDialer

func NewRetryDialer() *RetryDialer

func (*RetryDialer) Dial

func (d *RetryDialer) Dial(network, addr string) (c net.Conn, err error)

type Server

type Server struct {
	// Addr is the address the server is listening on in the form ipaddr:port.
	Addr     string
	Listener net.Listener

	// TLS is the optional TLS configuration, populated with a new config
	// after TLS is started. If set on an unstarted server before StartTLS
	// is called, existing fields are copied into the new config.
	TLS *tls.Config

	// Config may be changed after calling NewUnstartedServer and
	// before Start or StartTLS.
	Config *tcp.Server
	// contains filtered or unexported fields
}

Server is a TCP test server that binds to a random port.

func NewServer

func NewServer(h tcp.Handler) *Server

func NewTLSServer

func NewTLSServer(h tcp.Handler) *Server

func NewUnstartedServer

func NewUnstartedServer(h tcp.Handler) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Start

func (s *Server) Start()

func (*Server) StartTLS

func (s *Server) StartTLS()

type TLSRetryDialer

type TLSRetryDialer struct {
	TLS     *tls.Config
	Dialer  net.Dialer
	Timeout time.Duration
	Sleep   time.Duration
}

func NewTLSRetryDialer

func NewTLSRetryDialer(cfg *tls.Config) *TLSRetryDialer

func (*TLSRetryDialer) Dial

func (d *TLSRetryDialer) Dial(network, addr string) (c net.Conn, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL