parse

Parse a ut_metadata message payload (the body of the extended message, not including the 4-byte length / id-20 / extended-id wire framing).

Faithful to on_extended: the buffer is bdecoded; it must be a dict; both msg_type and piece must be present integer keys, otherwise the message is invalid. libtorrent disconnects; we return null instead. For a data message, the appended raw bytes are everything past the end of the bencoded dict (payload[dataSection.size .. end]), and total_size is read with a default of 0.

Return

the decoded Message, or null if payload is not a well-formed ut_metadata message (not a dict, missing keys, or an unknown msg_type).