http3

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

README

Http3 server for FNS

Install

go get github.com/aacfactory/fns-contrib/http/http3

Usage

Make sure tls is used.

app := fns.New(
    fns.Server(http3.Server()),
)

Setup config, see quic for more quic config detail.

http:
  tls:
    kind: "SSC"
    options:
      ca: "{path of ca}"
      caKey: "{path of ca key}"
  options:
    enableDatagrams: true
    maxHeaderBytes: "4K"
    quic:
      handshakeIdleTimeout: "2s"
      maxIdleTimeout: "60s"
      keepAlivePeriod: "60s"
    client:
      maxConnsPerHost: 64
      maxResponseHeaderBytes: "4K"
      timeout: "2s"

Enable announce that this server supports HTTP/3.

app := fns.New(
    fns.Server(http3.Compatible(&service.FastHttp{})), // any other service.Http 
)
http:
  tls:
    kind: "SSC"
    options:
      ca: "{path of ca}"
      caKey: "{path of ca key}"
  options:
    enableDatagrams: true
    maxHeaderBytes: "4K"
    quic:
      handshakeIdleTimeout: "2s"
      maxIdleTimeout: "60s"
      keepAlivePeriod: "60s"
    client:
      maxConnsPerHost: 64
      maxResponseHeaderBytes: "4K"
      timeout: "2s"
    compatible: # compatible http server config
      foo: "bar" 

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compatible added in v1.0.3

func Compatible(compatible service.Http) service.Http

func Server

func Server() service.Http

Types

type Client

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

func NewClient added in v1.0.1

func NewClient(address string, roundTripper *http3.RoundTripper, timeout time.Duration) (client *Client)

func (Client) Close

func (c Client) Close()

func (Client) Get added in v1.0.1

func (c Client) Get(ctx context.Context, path string, header http.Header) (status int, respHeader http.Header, respBody []byte, err error)

func (Client) Key added in v1.0.1

func (c Client) Key() (key string)

func (Client) Post added in v1.0.1

func (c Client) Post(ctx context.Context, path string, header http.Header, body []byte) (status int, respHeader http.Header, respBody []byte, err error)

type ClientConfig added in v1.0.1

type ClientConfig struct {
	MaxConnsPerHost        int    `json:"maxConnsPerHost"`
	MaxResponseHeaderBytes string `json:"maxResponseHeaderBytes"`
	Timeout                string `json:"timeout"`
}

func (*ClientConfig) MaxConnectionsPerHost added in v1.0.1

func (config *ClientConfig) MaxConnectionsPerHost() (n int)

func (*ClientConfig) MaxResponseHeaderByteSize added in v1.0.1

func (config *ClientConfig) MaxResponseHeaderByteSize() (n uint64, err error)

func (*ClientConfig) TimeoutDuration added in v1.0.1

func (config *ClientConfig) TimeoutDuration() (n time.Duration, err error)

type Config added in v1.0.1

type Config struct {
	EnableDatagrams    bool              `json:"enableDatagrams"`
	MaxHeaderBytes     string            `json:"maxHeaderBytes"`
	AdditionalSettings map[uint64]uint64 `json:"additionalSettings"`
	Quic               *QuicConfig       `json:"quic"`
	Client             *ClientConfig     `json:"client"`
	Compatible         json.RawMessage   `json:"compatible"`
}

func (*Config) ClientConfig added in v1.0.1

func (config *Config) ClientConfig() (clientConfig *ClientConfig)

func (*Config) QuicConfig added in v1.0.1

func (config *Config) QuicConfig() (quicConfig *quic.Config, err error)

type ConnectionIDGenerator added in v1.0.1

type ConnectionIDGenerator struct {
}

func (*ConnectionIDGenerator) ConnectionIDLen added in v1.0.1

func (generator *ConnectionIDGenerator) ConnectionIDLen() int

func (*ConnectionIDGenerator) GenerateConnectionID added in v1.0.1

func (generator *ConnectionIDGenerator) GenerateConnectionID() (id quic.ConnectionID, err error)

type Dialer added in v1.0.1

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

func NewDialer added in v1.0.1

func NewDialer(cliTLS *tls.Config, clientConfig *ClientConfig, enableDatagrams bool, quicConfig *quic.Config, additionalSettings map[uint64]uint64) (dialer *Dialer, err error)

func (*Dialer) Close added in v1.0.1

func (dialer *Dialer) Close()

func (*Dialer) Dial added in v1.0.1

func (dialer *Dialer) Dial(address string) (client service.HttpClient, err error)

type Printf

type Printf struct {
	Core logs.Logger
}

func (*Printf) Printf

func (p *Printf) Printf(layout string, v ...interface{})

func (*Printf) Write

func (p *Printf) Write(b []byte) (n int, err error)

type QuicConfig added in v1.0.1

type QuicConfig struct {
	Versions                         []string `json:"versions"`
	HandshakeIdleTimeout             string   `json:"handshakeIdleTimeout"`
	MaxIdleTimeout                   string   `json:"maxIdleTimeout"`
	MaxRetryTokenAge                 string   `json:"maxRetryTokenAge"`
	MaxTokenAge                      string   `json:"maxTokenAge"`
	InitialStreamReceiveWindow       string   `json:"initialStreamReceiveWindow"`
	MaxStreamReceiveWindow           string   `json:"maxStreamReceiveWindow"`
	InitialConnectionReceiveWindow   string   `json:"initialConnectionReceiveWindow"`
	MaxConnectionReceiveWindow       string   `json:"maxConnectionReceiveWindow"`
	MaxIncomingStreams               int64    `json:"maxIncomingStreams"`
	MaxIncomingUniStreams            int64    `json:"maxIncomingUniStreams"`
	StatelessResetKey                string   `json:"statelessResetKey"`
	KeepAlivePeriod                  string   `json:"keepAlivePeriod"`
	DisablePathMTUDiscovery          bool     `json:"disablePathMtuDiscovery"`
	DisableVersionNegotiationPackets bool     `json:"disableVersionNegotiationPackets"`
}

func (*QuicConfig) Convert added in v1.0.1

func (config *QuicConfig) Convert(EnableDatagrams bool) (quicConfig *quic.Config, err error)

Jump to

Keyboard shortcuts

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