github.com/zhyoulun/cilium@v1.6.12/proxylib/memcached/meta/meta.go (about) 1 // Copyright 2018 Authors of Cilium 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // text memcache protocol parser based on https://github.com/memcached/memcached/blob/master/doc/protocol.txt 16 17 package meta 18 19 // MemcacheMeta gathers information about memcache frame for L7 rules matching 20 type MemcacheMeta struct { 21 // for text protocol 22 Command string 23 // for binary protocol 24 Opcode byte 25 Keys [][]byte 26 } 27 28 // IsBinary tells whether meta instance is for text or binary protocol 29 func (m *MemcacheMeta) IsBinary() bool { 30 return len(m.Command) == 0 31 }