lib/protocol: Use DeviceID in protocol messages, with custom marshalling
This makes the device ID a real type that can be used in the protobuf schema. That avoids the juggling back and forth from []byte in a bunch of places and simplifies the code. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3695
This commit is contained in:
committed by
Audrius Butkevicius
parent
1cdfef4d6a
commit
0296c23685
20
lib/protocol/deviceid_test.proto
Normal file
20
lib/protocol/deviceid_test.proto
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package protocol;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
option (gogoproto.sizer_all) = false;
|
||||
option (gogoproto.protosizer_all) = true;
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
|
||||
message TestOldDeviceID {
|
||||
bytes test = 1;
|
||||
}
|
||||
|
||||
message TestNewDeviceID {
|
||||
bytes test = 1 [(gogoproto.customtype) = "DeviceID", (gogoproto.nullable) = false];
|
||||
}
|
||||
Reference in New Issue
Block a user