httpserver

package
v0.1.1-dev Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

GoNetSim HTTP
=============

Documentation for the HTTP server can be found here: https://gonetsim.lachlanharris.dev/reference/http/. 
Documentation for the HTTPS server can be found here: https://gonetsim.lachlanharris.dev/reference/https/.
Unless otherwise specified, all content within this directory and any subdirectories falls under the
following copyright notice and license:

Copyright (c) Lachlan Harris 2026. All Rights Reserved.

This repository is licensed under the Apache 2.0 License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(conf Config, handler http.Handler) (*http.Server, error)

func RunHTTP

func RunHTTP(ctx context.Context, conf Config, opts RunOptions) error

func RunHTTPS

func RunHTTPS(ctx context.Context, conf Config, tlsOpts TLSOptions, opts RunOptions) error

Types

type Config

type Config struct {
	Addr string

	// if non-empty, a fixed status code returned for all requests
	// when zero, defaults to 200
	StatusCode int
}

type FakeHandler

type FakeHandler struct {
	// if non-zero, forces this status code for all responses.
	StatusCode int
}

func (FakeHandler) ServeHTTP

func (h FakeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RunOptions

type RunOptions struct {
	ShutdownTimeout time.Duration
}

type TLSOptions

type TLSOptions struct {
	CertFile string
	KeyFile  string
}

Jump to

Keyboard shortcuts

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