grpcutil

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedOrigins

type AllowedOrigins []string

AllowedOrigins is used to register de Allowed Origins.

type GrpcProxy

type GrpcProxy struct {
	GrpcServices        map[string][]string `json:"grpc_services"`
	IsTransparentServer bool                `json:"is_transparent_server"`
	Authority           string              `json:"authority"`
}

GrpcProxy is the object responsible to create a communication gRPC Server that calls other gRPC Server.

func (*GrpcProxy) CreateClientConn

func (grpcProxy *GrpcProxy) CreateClientConn(clientCertificate *certs.CertificateDefs, host string) *grpc.ClientConn

CreateClientConn return a Client for a gRPC server.

func (*GrpcProxy) NewServer

func (grpcProxy *GrpcProxy) NewServer(clientConn *grpc.ClientConn) *grpc.Server

NewServer returns a grpc Server

type GrpcWebProxy

type GrpcWebProxy struct {
	GrpcProxy
	AllowAllOrigins bool           `json:"allow_all_origins"`
	AllowedOrigins  AllowedOrigins `json:"allowed_origins"`
	UseWebSockets   bool           `json:"use_web_sockets"`
	AllowedHeaders  []string       `json:"allowed_header"`
	// contains filtered or unexported fields
}

GrpcWebProxy is the object responsible to create a communication gRPC Web Server that calls other gRPC Server.

func (*GrpcWebProxy) WrappedGrpcServer

func (grpcWebProxy *GrpcWebProxy) WrappedGrpcServer(clientConn *grpc.ClientConn) *grpcweb.WrappedGrpcServer

WrappedGrpcServer returns a gRPC Web wrapped server.

type JSON

type JSON struct {
	jsonpb.Marshaler
	jsonpb.Unmarshaler
}

JSON structure is used to marshall or unmarshal a protobuffer messsage.

func (JSON) Marshal

func (json JSON) Marshal(v interface{}) (out []byte, err error)

Marshal returns proto message from json format.

func (JSON) Name

func (JSON) Name() string

Name returns "json"

func (JSON) Unmarshal

func (json JSON) Unmarshal(data []byte, v interface{}) (err error)

Unmarshal returns a json message from protobuffer.

type TransportJson

type TransportJson struct {
	TlsDefs *certs.CertificateDefs
}

TransportJson is used to transport the communication between a grpc server and a web client (json).

func NewTransportJson

func NewTransportJson(tlsDefs *certs.CertificateDefs) *TransportJson

NewTransportJson returns a TransportJson

func (*TransportJson) RoundTrip

func (transportJson *TransportJson) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip return the response in json format.

Jump to

Keyboard shortcuts

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