gateway

package
v0.0.0-...-7b61e9d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryCodec

type BinaryCodec struct{}

BinaryCodec is a encoding.Codec that acts as an identity transform for raw binary inputs and outputs.

When marshaling, it simply returns the input byte slice. When unmarshaling, it expects a pointer to a byte slice as an input, so it can point it at the raw byte slice.

func (*BinaryCodec) Marshal

func (bc *BinaryCodec) Marshal(value interface{}) ([]byte, error)

func (*BinaryCodec) Name

func (bc *BinaryCodec) Name() string

func (*BinaryCodec) Unmarshal

func (bc *BinaryCodec) Unmarshal(data []byte, value interface{}) error

type Mux

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

Mux serves HTTP and Websocket endpoints that re-routes

func New

func New(serv *grpc.Server, cc *grpc.ClientConn, opts ...MuxOption) *Mux

New creates a new Mux that loads all registered services in the gRPC server and sets up corresponding routes.

Unary requests are set up as basic HTTP/1.1 requests. Streaming requests are set up as Websocket connections.

func (*Mux) ListenAndServeHTTP

func (m *Mux) ListenAndServeHTTP(listenAddr string) error

ServeHTTP listens on the specified address, and forwards requests to the gRPC server.

func (*Mux) ServeHTTP

func (m *Mux) ServeHTTP(l net.Listener) error

ServeHTTP serves HTTP on the provided listener, forwarding requests to the gRPC server.

type MuxOption

type MuxOption func(*Mux)

MuxOption configures the mux.

func WithRouter

func WithRouter(router *mux.Router) MuxOption

WithRouter provides an alternative mux.Router to use.

func WithUpgrader

func WithUpgrader(upgrader websocket.Upgrader) MuxOption

WithUpgrader provides an alternative websocket.Upgrader to use.

Jump to

Keyboard shortcuts

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