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 ¶
- func Get(addr resolver.Address) metadata.MD
- func Set(addr resolver.Address, md metadata.MD) resolver.Address
- func Validate(md metadata.MD) error
- func ValidateKey(key string) error
- func ValidatePair(key string, vals ...string) error
Functions ¶
func Get ¶
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 ¶
Validate validates every pair in md with ValidatePair.
func ValidateKey ¶
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 ¶
ValidatePair validates a key-value pair with the following rules (pseudo-header are skipped):
- the key must contain one or more characters.
- the characters in the key must be in [0-9 a-z _ - .].
- if the key ends with a "-bin" suffix, no validation of the corresponding value is performed.
- the characters in every value must be printable (in [%x20-%x7E]).
Source Files ¶
metadata.go
- Version
- v1.72.0 (latest)
- Published
- Apr 21, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 hour ago –
Tools for package owners.