fix and improve envelope stuff again, deal with messages as strings on all envelope parsing steps.

This commit is contained in:
fiatjaf
2025-03-12 00:17:01 -03:00
parent 42a2243b72
commit cecc71cd81
11 changed files with 151 additions and 140 deletions

View File

@@ -551,11 +551,11 @@ func (smp *sonicMessageParser) doneWithIntSlice(slice []int) {
// When an unexpected message (like ["NEG-OPEN", ...]) is found, the error UnknownLabel will be
// returned. Other errors will be returned if the JSON is malformed or the objects are not exactly
// as they should.
func (smp sonicMessageParser) ParseMessage(message []byte) (Envelope, error) {
func (smp sonicMessageParser) ParseMessage(message string) (Envelope, error) {
sv := &sonicVisitor{smp: &smp}
sv.whereWeAre = inEnvelope
err := ast.Preorder(unsafe.String(unsafe.SliceData(message), len(message)), sv, nil)
err := ast.Preorder(message, sv, nil)
return sv.mainEnvelope, err
}