net

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNetDialer

func NewNetDialer(connectTimeout, keepAlive time.Duration) *net.Dialer

NewNetDialer creates a new net.Dialer with the given connection timeout and keep alive duration.

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(coreDialer *net.Dialer, retryTimeout time.Duration) DialContextFunc

DialContextWithRetry retries failed dials at a fixed interval until retryTimeout expires or the parent context is cancelled.

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