httpserver

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package httpserver implements the HTTPServer.

Index

Constants

View Source
const (
	// Category is the category of HTTPServer.
	Category = supervisor.CategoryTrafficGate

	// Kind is the kind of HTTPServer.
	Kind = "HTTPServer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServer

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

HTTPServer is Object HTTPServer.

func (*HTTPServer) Category

func (hs *HTTPServer) Category() supervisor.ObjectCategory

Category returns the category of HTTPServer.

func (*HTTPServer) Close

func (hs *HTTPServer) Close()

Close closes HTTPServer.

func (*HTTPServer) DefaultSpec

func (hs *HTTPServer) DefaultSpec() interface{}

DefaultSpec returns the default spec of HTTPServer.

func (*HTTPServer) Inherit

func (hs *HTTPServer) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object, muxMapper context.MuxMapper)

Inherit inherits previous generation of HTTPServer.

func (*HTTPServer) Init

func (hs *HTTPServer) Init(superSpec *supervisor.Spec, muxMapper context.MuxMapper)

Init initializes HTTPServer.

func (*HTTPServer) Kind

func (hs *HTTPServer) Kind() string

Kind returns the kind of HTTPServer.

func (*HTTPServer) Status

func (hs *HTTPServer) Status() *supervisor.Status

Status is the wrapper of runtime's Status.

type ResponseFlushWriter added in v2.7.1

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

ResponseFlushWriter is a wrapper of http.ResponseWriter, which flushes the response immediately if the response needs to be flushed.

func NewResponseFlushWriter added in v2.7.1

func NewResponseFlushWriter(w http.ResponseWriter) *ResponseFlushWriter

NewResponseFlushWriter creates a ResponseFlushWriter.

func (*ResponseFlushWriter) Write added in v2.7.1

func (w *ResponseFlushWriter) Write(p []byte) (int, error)

Write writes the data to the connection as part of an HTTP reply.

type Spec

type Spec struct {
	HTTP3             bool          `json:"http3,omitempty"`
	KeepAlive         bool          `json:"keepAlive" jsonschema:"required"`
	HTTPS             bool          `json:"https" jsonschema:"required"`
	AutoCert          bool          `json:"autoCert,omitempty"`
	XForwardedFor     bool          `json:"xForwardedFor,omitempty"`
	Address           string        `json:"address,omitempty"`
	Port              uint16        `json:"port" jsonschema:"required,minimum=1"`
	ClientMaxBodySize int64         `json:"clientMaxBodySize,omitempty"`
	KeepAliveTimeout  string        `json:"keepAliveTimeout,omitempty" jsonschema:"format=duration"`
	MaxConnections    uint32        `json:"maxConnections,omitempty" jsonschema:"minimum=1"`
	CacheSize         uint32        `json:"cacheSize,omitempty"`
	Tracing           *tracing.Spec `json:"tracing,omitempty"`
	CaCertBase64      string        `json:"caCertBase64,omitempty" jsonschema:"format=base64"`

	// Support multiple certs, preserve the certbase64 and keybase64
	// for backward compatibility
	CertBase64 string `json:"certBase64,omitempty" jsonschema:"format=base64"`
	KeyBase64  string `json:"keyBase64,omitempty" jsonschema:"format=base64"`

	// Certs saved as map, key is domain name, value is cert
	Certs map[string]string `json:"certs,omitempty"`
	// Keys saved as map, key is domain name, value is secret
	Keys map[string]string `json:"keys,omitempty"`

	RouterKind string `json:"routerKind,omitempty" jsonschema:"enum=,enum=Ordered,enum=RadixTree"`

	IPFilter *ipfilter.Spec `json:"ipFilter,omitempty"`
	Rules    routers.Rules  `json:"rules,omitempty"`

	GlobalFilter string `json:"globalFilter,omitempty"`

	AccessLogFormat string `json:"accessLogFormat,omitempty"`
}

Spec describes the HTTPServer.

func (*Spec) Validate

func (spec *Spec) Validate() error

Validate validates HTTPServerSpec.

type Status

type Status struct {
	Name   string `json:"name"`
	Health string `json:"health"`

	State stateType `json:"state"`
	Error string    `json:"error,omitempty"`

	*httpstat.Status
	TopN []*httpstat.Item `json:"topN"`
}

Status contains all status generated by runtime, for displaying to users.

func (*Status) ToMetrics

func (s *Status) ToMetrics(service string) []*easemonitor.Metrics

ToMetrics implements easemonitor.Metricer.

Directories

Path Synopsis
Package routers provides the router interface and the implementation of different routing policies.
Package routers provides the router interface and the implementation of different routing policies.
ordered
Package ordered provides the router implementation of ordered routing policy.
Package ordered provides the router implementation of ordered routing policy.
radixtree
Package radixtree provides the router implementation of radix tree routing policy.
Package radixtree provides the router implementation of radix tree routing policy.

Jump to

Keyboard shortcuts

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