net

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartTestServer

func StartTestServer(hdl http.Handler) (*httptest.Server, *url.URL, error)

StartTestServer creates and starts an *httptest.Server in the background, then parses its URL and returns both values.

If this function returns a nil error, the caller is responsible for closing the returned server. If it returns a non-nil error, the server and URL will be nil.

Types

type DialContextFunc

type DialContextFunc func(ctx context.Context, network, addr string) (net.Conn, error)

DialContextFunc matches the signature of net.Dialer.DialContext.

func DialContextWithRetry

func DialContextWithRetry(connectTimeout time.Duration) DialContextFunc

DialContextWithRetry returns a DialContextFunc that retries failed dials at a fixed interval until the parent context is cancelled or its deadline expires. When the parent context has no deadline, retries are bounded by maxRetryDuration.

type TestHTTPHandlerWrapper

type TestHTTPHandlerWrapper struct {
	// contains filtered or unexported fields
}

func NewTestHTTPHandlerWrapper

func NewTestHTTPHandlerWrapper(hdl http.Handler) *TestHTTPHandlerWrapper

func (*TestHTTPHandlerWrapper) IncomingRequests

func (t *TestHTTPHandlerWrapper) IncomingRequests() []http.Request

IncomingRequests returns a copy slice of all the requests that have been received before this function was called.

func (*TestHTTPHandlerWrapper) ServeHTTP

Jump to

Keyboard shortcuts

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