4 "golang.org/x/net/context"
10 versionKey contextKey = "9p.version"
13 func withVersion(ctx context.Context, version string) context.Context {
14 return context.WithValue(ctx, versionKey, version)
17 // GetVersion returns the protocol version from the context. If the version is
18 // not known, an empty string is returned. This is typically set on the
19 // context passed into function calls in a server implementation.
20 func GetVersion(ctx context.Context) string {
21 v, ok := ctx.Value(versionKey).(string)