I want to use an IP field in a proto3 message. Which type in proto3 should I use to represent the same. The field will be used by Golang and C# implementation. Should I use string? or fixed32 for IPV4 and bytes for IPV6?
message xyz {
string ip_addr = 1;
}
or
message xyz {
oneof ip_addr{
fixed32 v4 = 1;
bytes v6 = 2;
}
If it is the second one, then how to encode that in Golang implementation? Like, should I first construct a string with a valid IP address and then convert it to fixed32 format or how is it?