Protobuf Wire Format Simulation #1
DuckSoft
started this conversation in
Mind Blown
Replies: 2 comments 1 reply
-
I've written a Proof of Concept (PoC) and validated my guess: package pkg
import (
"fmt"
"github.com/Qv2ray/gun/pkg/proto"
proto2 "github.com/golang/protobuf/proto"
"testing"
)
func Test(t *testing.T) {
message := &proto.Hunk{Data: []byte("shit")}
marshal, err := proto2.Marshal(message)
if err != nil {
panic(err)
}
fmt.Printf("%x", marshal)
} When executed, the output is:
This is to say my wild guess was correct! |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've found some library (wheels) to implement an LEB128 encoding for us: I think the Protobuf simulation theory is ready. Let's move to gRPC calling convention simulation. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In this discussion thread we are going to discuss the implementation of Protobuf simulation.
From https://developers.google.com/protocol-buffers/docs/encoding#strings we can deduce that the Protobuf binary representation for our very simple GunMessage
will become the following:
PS: This is only pure guess from documentations. Let's validate this to give more insight.
Beta Was this translation helpful? Give feedback.
All reactions