github.com/searKing/golang/go@v1.2.117/net/mux/matcher_grpc.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package mux 6 7 import ( 8 "strings" 9 10 "golang.org/x/net/http2/hpack" 11 ) 12 13 // GRPC parses the frame header of the first frame to detect whether the 14 // connection is an HTTP2 connection. 15 func GRPC() MatcherFunc { 16 return HTTP2HeaderFieldValue(false, strings.EqualFold, hpack.HeaderField{ 17 Name: "Content-Type", 18 Value: "application/grpc", 19 }) 20 }