buggyhttp

package
v1.3.18 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package buggyhttp is a webserver affected by any kind of network issues

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(port int)

Listen on the specified port using a package-level server. Deprecated: prefer New().Start() / New().StartPort() for an isolated, port configurable instance.

func ListenTLS

func ListenTLS(port int, certFile, keyFile string)

ListenTLS because buggyhttp also supports bugged TLS. Deprecated: prefer New().StartTLS().

func SecureRandomAlphaString

func SecureRandomAlphaString(length int) string

func SecureRandomBytes

func SecureRandomBytes(length int) []byte

SecureRandomBytes returns the requested number of bytes using crypto/rand

func Stop

func Stop()

Stop the package-level servers started via Listen/ListenTLS.

Types

type Server added in v1.3.16

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

Server is a configurable instance of the buggy test server. Each instance keeps its own state (so tests do not share a global counter) and can bind an ephemeral port, avoiding conflicts with other services running locally.

func New added in v1.3.16

func New() *Server

New returns a new, not yet listening, buggy server.

func (*Server) Close added in v1.3.16

func (s *Server) Close() error

Close shuts the server down.

func (*Server) Start added in v1.3.16

func (s *Server) Start() (string, error)

Start binds an ephemeral port on 127.0.0.1, serves in the background and returns the base URL (e.g. http://127.0.0.1:54321). The listener is bound before returning, so the URL is ready to receive requests.

func (*Server) StartPort added in v1.3.16

func (s *Server) StartPort(port int) error

StartPort binds the given port (all interfaces) and serves in the background.

func (*Server) StartTLS added in v1.3.16

func (s *Server) StartTLS(port int, certFile, keyFile string) error

StartTLS binds the given port for TLS and serves in the background.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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