nettest

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Package nettest provides a test server to test network listener handlers, similar to how net/http/httptest provides HTTP handler testing.

Index

Constants

This section is empty.

Variables

View Source
var ClientTLS *tls.Config

ClientTLS is a client TLS config which trusts the localhost nettest server.

Functions

This section is empty.

Types

type Server

type Server struct {
	Addr string
	// contains filtered or unexported fields
}

func NewTLSServer

func NewTLSServer(handler func(lis net.Listener)) *Server

NewTLSServer creates a TLS TCP server listening on 127.0.0.1:0 and runs handler with the listener. The listen address with the chosen port can be read from the server's Addr field. Clients should tls.Dial using ClientTLS as the TLS config.

func (*Server) Close

func (s *Server) Close() error

Jump to

Keyboard shortcuts

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