httpserver

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultLabel   = "httpserver"
	DefaultTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

func NewWithConfig

func NewWithConfig(c Config) (*httpserver, error)

Create the server

Types

type Config

type Config struct {
	Label   string        `hcl:"label,label"`
	Router  Task          `hcl:"router,optional"`
	Addr    string        `hcl:"listen,optional"`  // Address or path for binding HTTP server
	TLS     *TLS          `hcl:"tls,block"`        // TLS parameters
	Timeout time.Duration `hcl:"timeout,optional"` // Read timeout on HTTP requests
}

func (Config) Name

func (c Config) Name() string

func (Config) New

func (c Config) New(ctx context.Context, provider Provider) (Task, error)

Return a new task. Label for the task can be retrieved from context

type TLS

type TLS struct {
	Key  string `hcl:"key"`  // Path to TLS Private Key
	Cert string `hcl:"cert"` // Path to TLS Certificate
}

Jump to

Keyboard shortcuts

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