suite

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// must be the same with the ALPN nextProto values
	HTTP1 = "http/1.1"
	HTTP2 = "h2"
	// HTTP3Draft29 is the ALPN protocol negotiated during the TLS handshake, for QUIC draft 29.
	HTTP3Draft29 = "h3-29"
	// HTTP3 is the ALPN protocol negotiated during the TLS handshake, for QUIC v1 and v2.
	HTTP3 = "h3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory

type ClientFactory interface {
	NewHostClient() (hc client.HostClient, err error)
}

type Config

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

func New

func New() *Config

New return an empty Config suite, use .Add() to add protocol impl

func (*Config) Add

func (c *Config) Add(protocol string, factory interface{})

func (*Config) Delete

func (c *Config) Delete(protocol string)

func (*Config) Get

func (c *Config) Get(name string) ServerFactory

func (*Config) Load

func (c *Config) Load(core Core, protocol string) (server protocol.Server, err error)

func (*Config) LoadAll

func (c *Config) LoadAll(core Core) (serverMap ServerMap, streamServerMap StreamServerMap, err error)

func (*Config) SetAltHeader

func (c *Config) SetAltHeader(target, altHeader string)

SetAltHeader will set response header "Alt-Svc" for the target protocol, altHeader will be the value of the header. Protocols other than the target protocol will carry the altHeader in the request header.

type Core

type Core interface {
	// IsRunning Check whether engine is running or not
	IsRunning() bool
	// A RequestContext pool ready for protocol server impl
	GetCtxPool() *sync.Pool
	// Business logic entrance
	// After pre-read works, protocol server may call this method
	// to introduce the middlewares and handlers
	ServeHTTP(c context.Context, ctx *app.RequestContext)
	// GetTracer for tracing requirement
	GetTracer() tracer.Controller
}

Core is the core interface that promises to be provided for the protocol layer extensions

type ServerFactory

type ServerFactory interface {
	New(core Core) (server protocol.Server, err error)
}

type ServerMap

type ServerMap map[string]protocol.Server

type StreamServerFactory

type StreamServerFactory interface {
	New(core Core) (server protocol.StreamServer, err error)
}

type StreamServerMap

type StreamServerMap map[string]protocol.StreamServer

Jump to

Keyboard shortcuts

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