httpserver

package
v0.0.0-...-4685c53 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

httpserver package provides HTTP, HTTPS and FastCGI servers

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" json:"label"`
	Router  types.Task     `hcl:"router,optional" json:"router"`
	Addr    string         `hcl:"listen,optional" json:"listen"`   // Address or path for binding HTTP server
	TLS     *TLS           `hcl:"tls,block" json:"tls"`            // TLS parameters
	Timeout types.Duration `hcl:"timeout,optional" json:"timeout"` // Read timeout on HTTP requests
}

func (Config) Label

func (c Config) Label() string

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