type headerFieldTable … type pairNameValue … func (t *headerFieldTable) init() { … } // len reports the number of entries in the table. func (t *headerFieldTable) len() int { … } // addEntry adds a new entry. func (t *headerFieldTable) addEntry(f HeaderField) { … } // evictOldest evicts the n oldest entries in the table. func (t *headerFieldTable) evictOldest(n int) { … } // search finds f in the table. If there is no match, i is 0. // If both name and value match, i is the matched index and nameValueMatch // becomes true. If only name matches, i points to that index and // nameValueMatch becomes false. // // The returned index is a 1-based HPACK index. For dynamic tables, HPACK says // that index 1 should be the newest entry, but t.ents[0] is the oldest entry, // meaning t.ents is reversed for dynamic tables. Hence, when t is a dynamic // table, the return value i actually refers to the entry t.ents[t.len()-i]. // // All tables are assumed to be a dynamic tables except for the global staticTable. // // See Section 2.3.3. func (t *headerFieldTable) search(f HeaderField) (i uint64, nameValueMatch bool) { … } // idToIndex converts a unique id to an HPACK index. // See Section 2.3.3. func (t *headerFieldTable) idToIndex(id uint64) uint64 { … } var huffmanCodes … var huffmanCodeLen …