server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConnectorIdHttp  = ConnectorId("http")
	DefaultConnectorIdHttps = ConnectorId("https")

	ConnectorKey = "lingress.server.connector"
)

Variables

View Source
var (
	ErrIllegalConnectorId = errors.New("illegal connector-id")
)

Functions

func ContextWithConnector

func ContextWithConnector(ctx context.Context, connector Connector) context.Context

Types

type AnnotatedAddr added in v0.2.4

type AnnotatedAddr interface {
	net.Addr
	GetState() *http.ConnState
	SetState(*http.ConnState)
}

type Connector

type Connector interface {
	GetId() ConnectorId
}

func GetConnectorOfContext

func GetConnectorOfContext(ctx context.Context) Connector

type ConnectorHandler

type ConnectorHandler interface {
	ServeHTTP(Connector, http.ResponseWriter, *http.Request)
	OnConnState(Connector, net.Conn, http.ConnState)
}

type ConnectorId

type ConnectorId string

func (ConnectorId) MarshalText

func (instance ConnectorId) MarshalText() (text []byte, err error)

func (*ConnectorId) Set

func (instance *ConnectorId) Set(plain string) error

func (ConnectorId) String

func (instance ConnectorId) String() string

func (*ConnectorId) UnmarshalText

func (instance *ConnectorId) UnmarshalText(text []byte) error

type HttpConnector

type HttpConnector struct {
	Id      ConnectorId
	Handler ConnectorHandler

	SoLinger       int16
	MaxConnections uint16

	// See https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt
	RespectProxyProtocol bool

	Server       http.Server
	ListenConfig net.ListenConfig
}

func NewHttpConnector

func NewHttpConnector(id ConnectorId) (*HttpConnector, error)

func (*HttpConnector) GetId

func (instance *HttpConnector) GetId() ConnectorId

func (*HttpConnector) RegisterFlag

func (instance *HttpConnector) RegisterFlag(fe support.FlagEnabled, appPrefix string) error

func (*HttpConnector) Serve

func (instance *HttpConnector) Serve(stop support.Channel) error

func (*HttpConnector) Shutdown

func (instance *HttpConnector) Shutdown()

Jump to

Keyboard shortcuts

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