WithDecoderDictRaw registers a dictionary that may be used by the decoder. The slice content can be arbitrary data. Can be changed with ResetWithOptions.
(id uint32, content []byte)
| 129 | // The slice content can be arbitrary data. |
| 130 | // Can be changed with ResetWithOptions. |
| 131 | func WithDecoderDictRaw(id uint32, content []byte) DOption { |
| 132 | return func(o *decoderOptions) error { |
| 133 | if bits.UintSize > 32 && uint(len(content)) > dictMaxLength { |
| 134 | return fmt.Errorf("dictionary of size %d > 2GiB too large", len(content)) |
| 135 | } |
| 136 | if o.dicts == nil { |
| 137 | o.dicts = make(map[uint32]*dict) |
| 138 | } |
| 139 | o.dicts[id] = &dict{id: id, content: content, offsets: [3]int{1, 4, 8}} |
| 140 | return nil |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | // WithDecoderMaxWindow allows to set a maximum window size for decodes. |
| 145 | // This allows rejecting packets that will cause big memory usage. |
no outgoing calls
searching dependent graphs…