Fleebs-Logo
Details werden geladen...

Obfuscating a gRPC service without breaking the contract on the wire - DEV Community

gRPC puts two kinds of names in your assembly, and obfuscation has to treat them as opposites. The names that travel on the wire — the service path, the method path, the field numbers in a protobuf message — are a contract every peer depends on, and renaming them breaks interop as surely as changing a URL. The names that never leave the process — your C# method names, your message property names, your DI registrations — are free to disappear. The catch is that which kind a given name is depends entirely on whether you went contract-first with protoc or code-first with protobuf-net.Grpc, because code-first derives the wire identity from your .NET names by reflection, turning the free names back into load-bearing ones. This post reads the generated code and the metadata to show exactly where the wire identity lives in each style, why protobuf field numbers make message members safe to rename, and how Nebula pins the contract surface while renaming everything behind it.