package metadata

import "google.golang.org/grpc/internal/metadata"

Package metadata contains functions to set and get metadata from addresses.

This package is experimental.

Index

Functions

func Get

func Get(addr resolver.Address) metadata.MD

Get returns the metadata of addr.

func Set

Set sets (overrides) the metadata in addr.

When a SubConn is created with this address, the RPCs sent on it will all have this metadata.

func Validate

func Validate(md metadata.MD) error

Validate validates every pair in md with ValidatePair.

func ValidateKey

func ValidateKey(key string) error

ValidateKey validates a key with the following rules (pseudo-headers are skipped): - the key must contain one or more characters. - the characters in the key must be in [0-9 a-z _ - .].

func ValidatePair

func ValidatePair(key string, vals ...string) error

ValidatePair validates a key-value pair with the following rules (pseudo-header are skipped):

Source Files

metadata.go

Version
v1.74.0-dev
Published
May 15, 2025
Platform
js/wasm
Imports
4 packages
Last checked
41 seconds ago

Tools for package owners.