h2push

package
v0.0.0-...-109c5d9 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPHandlerPush

func HTTPHandlerPush(w http.ResponseWriter, req *http.Request)

func HTTPHandlerPushPromise

func HTTPHandlerPushPromise(w http.ResponseWriter, req *http.Request)

Used for monitoring, will send push promise messages. Messages will need to be held in a map, to be retrieved by the handler.

func InitPush

func InitPush(mux http.ServeMux)

Types

type H2Push

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

type H2SCfg

type H2SCfg struct {
	OnConnection func(s *Session)
	Handler      http.Handler
}

type H2SServer

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

func Listen

func Listen(ll net.Listener, tls *tls.Config, cfg *H2SCfg) *H2SServer

func ListenAddr

func ListenAddr(addr string, tls *tls.Config, cfg *H2SCfg) (*H2SServer, error)

func (*H2SServer) Close

func (h2s *H2SServer) Close()

type H2Stream

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

func (*H2Stream) Close

func (str *H2Stream) Close() error

func (*H2Stream) Read

func (str *H2Stream) Read(p []byte) (n int, err error)

func (*H2Stream) ReadHeader

func (str *H2Stream) ReadHeader(r *http.Request) (n int, err error)

func (*H2Stream) Write

func (str *H2Stream) Write(p []byte) (n int, err error)

func (*H2Stream) WriteHeader

func (str *H2Stream) WriteHeader(r *http.Request) (n int, err error)

type Listener

type Listener interface {
	// Close the server. All active sessions will be closed.
	Close() error
	// Addr returns the local network addr that the server is listening on.
	Addr() net.Addr
	// Accept returns new sessions. It should be called in a loop.
	Accept(context.Context) (Session, error)
}

A Listener for incoming H2 connections, acting as server. Implements a similar interface with Quic

type Session

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

func DialAddr

func DialAddr(addr string, tls *tls.Config, cfg *H2SCfg) (*Session, error)

func (*Session) AcceptStream

func (h2s *Session) AcceptStream(background context.Context) (*H2Stream, error)

func (*Session) OpenStreamSync

func (h2s *Session) OpenStreamSync(background context.Context) (*H2Stream, error)

In Quic, it's OpenStreamSync - quic returns a stream of bytes that is framed independently For H2, streams are opened using HEADER - using a http.Request to pass info

Jump to

Keyboard shortcuts

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