proxy

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthFunc

type AuthFunc func(context.Context, *http.Request) (map[string]string, error)

AuthFunc translates a request into headers to pass on to the remote server Errors which implement gRPC status will be returned to the client as HTTP errors, otherwise 500 with a log line

type Invoker

type Invoker interface {
	Invoke(context.Context, string, interface{}, interface{}, ...grpc.CallOption) error
}

type Method

type Method struct {
	FullName               string
	Input                  protoreflect.MessageDescriptor
	Output                 protoreflect.MessageDescriptor
	Invoker                Invoker
	HTTPMethod             string
	HTTPPath               string
	ForwardResponseHeaders map[string]bool
	ForwardRequestHeaders  map[string]bool
	CodecOptions           jsonapi.Options
	// contains filtered or unexported fields
}

func (*Method) ServeHTTP

func (mm *Method) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Router

type Router struct {
	ForwardResponseHeaders map[string]bool
	ForwardRequestHeaders  map[string]bool
	CodecOptions           jsonapi.Options

	AuthFunc AuthFunc
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(codecOptions jsonapi.Options) *Router

func (*Router) RegisterService

func (rr *Router) RegisterService(ctx context.Context, ss protoreflect.ServiceDescriptor, conn Invoker) error

func (*Router) ServeHTTP

func (rr *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Router) SetNotFoundHandler

func (rr *Router) SetNotFoundHandler(handler http.Handler)

func (*Router) StaticJSON

func (rr *Router) StaticJSON(path string, document interface{}) error

func (*Router) Use added in v0.0.6

func (rr *Router) Use(middleware func(http.Handler) http.Handler)

func (*Router) UseCORS added in v0.0.6

func (rr *Router) UseCORS(config cors.Options)

Jump to

Keyboard shortcuts

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