github.com/cloudwego/kitex@v0.9.0/transport/keys.go (about) 1 /* 2 * Copyright 2021 CloudWeGo Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 // Package transport provides predefined transport protocol. 18 package transport 19 20 // Protocol indicates the transport protocol. 21 type Protocol int 22 23 // Predefined transport protocols. 24 const ( 25 PurePayload Protocol = 0 26 27 TTHeader Protocol = 1 << iota 28 Framed 29 HTTP 30 GRPC 31 HESSIAN2 32 33 TTHeaderFramed = TTHeader | Framed 34 ) 35 36 // Unknown indicates the protocol is unknown. 37 const Unknown = "Unknown" 38 39 // String prints human readable information. 40 func (tp Protocol) String() string { 41 switch tp { 42 case PurePayload: 43 return "PurePayload" 44 case TTHeader: 45 return "TTHeader" 46 case Framed: 47 return "Framed" 48 case HTTP: 49 return "HTTP" 50 case TTHeaderFramed: 51 return "TTHeaderFramed" 52 case GRPC: 53 return "GRPC" 54 case HESSIAN2: 55 return "Hessian2" 56 } 57 return Unknown 58 }