type mdKeyType … const mdKey … type mdValue … func (m mdValue) Equal(o any) bool { … } // Get returns the metadata of addr. func Get(addr resolver.Address) metadata.MD { … } // 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 Set(addr resolver.Address, md metadata.MD) resolver.Address { … } // Validate validates every pair in md with ValidatePair. func Validate(md metadata.MD) error { … } // hasNotPrintable return true if msg contains any characters which are not in %x20-%x7E func hasNotPrintable(msg string) bool { … } // ValidatePair validate a key-value pair with the following rules (the pseudo-header will be skipped) : // // - key must contain one or more characters. // - the characters in the key must be contained in [0-9 a-z _ - .]. // - if the key ends with a "-bin" suffix, no validation of the corresponding value is performed. // - the characters in the every value must be printable (in [%x20-%x7E]). func ValidatePair(key string, vals ...string) error { … }