Documentation ¶
Overview ¶
Package rpcmetadata contains utilities for transporting common request metadata over gRPC.
Index ¶
- func WithForwardedAuth(ctx context.Context, allowInsecure bool) (grpc.CallOption, error)
- type MD
- func (m MD) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
- func (m MD) RequireTransportSecurity() bool
- func (m MD) ToIncomingContext(ctx context.Context) context.Context
- func (m MD) ToMetadata() metadata.MD
- func (m MD) ToOutgoingContext(ctx context.Context) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithForwardedAuth ¶
WithForwardedAuth returns a grpc.CallOption with authentication from the incoming context ctx.
Types ¶
type MD ¶
type MD struct { ID string AuthType string AuthValue string ServiceType string ServiceVersion string NetAddress string AllowInsecure bool // Host is the hostname the request is directed to. Host string // URI is the URI the request is directed to. URI string // XForwardedFor is set from the X-Forwarded-For header. XForwardedFor string // UserAgent is set from the User-Agent or the grpcgateway-user-agent header. UserAgent string }
MD contains The Things Stack metadata fields
func FromIncomingContext ¶
FromIncomingContext returns The Things Stack metadata from the incoming context ctx.
func FromMetadata ¶
FromMetadata returns The Things Stack metadata from metadata.MD
func FromOutgoingContext ¶
FromOutgoingContext returns The Things Stack metadata from the outgoing context ctx.
func (MD) GetRequestMetadata ¶
GetRequestMetadata returns the request metadata with per-rpc credentials
func (MD) RequireTransportSecurity ¶
RequireTransportSecurity returns true if authentication is configured
func (MD) ToIncomingContext ¶
ToIncomingContext puts The Things Stack metadata fields in an incoming context.Context
func (MD) ToMetadata ¶
ToMetadata puts The Things Stack metadata fields in a metadata.MD