gRPC Let's implement remote calls just like local calls , For every time rpc call , There may be some useful data , And these data can be passed through metadata To pass on .metadata In order to key-value Storage of data in the form of , among key yes string type , and value yes string, That is, a string slice type .metadata bring client and server It can provide the other party with some information about this call , Just once http Requested RequestHeader and ResponseHeaader equally .http in header The declaration cycle of is once http request , that metadata The life cycle of is once rpc call .
- Source code address ：https://github.com/grpc/grpc-go/tree/master/metadata
- Document address ：https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md
MD The type is actually map,key yes string,value yes string The section of
type MD map