server

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ErrCertificate errors.ErrorCode = "CERTIFICATE_FAILURE"
)
View Source
const (
	// At time of writing, the version argument is required to be 1.
	// See https://github.com/grpc-ecosystem/grpc-gateway/blob/69669120b0e010b88291cd9d24761297c2a17582/runtime/pattern.go#L53
	GrpcGatewayPatternVersion = 1
)

Variables

This section is empty.

Functions

func GetGlobPattern

func GetGlobPattern() runtime.Pattern

This is a function used for CORS support. It produces a Pattern object that can be attached to the grpc-gateway ServeMux object. It should match any and all URLs. The two op codes say, push the entire path to the stack 'OpPushM', and then ignore the result, 'OpNop'.

func GetSslCredentials

func GetSslCredentials(ctx context.Context, certFile, keyFile string) (*x509.CertPool, *tls.Certificate, error)

Types

type ForwardResponseOptionHandler

type ForwardResponseOptionHandler func(i context.Context, writer http.ResponseWriter, message proto.Message) error

This is just a type alias because the grpc-gateway library did not define one.

func GetForwardResponseOptionHandler

func GetForwardResponseOptionHandler(allowedOrigins []string) ForwardResponseOptionHandler

This returns a handler to be used with the runtime.WithForwardResponseOption() function. This is middleware that will add the CORS header below to all requests. Certain requests like GET will not trigger a preflight request and instead the browser expects this header to be present in the response.

Jump to

Keyboard shortcuts

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