mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 21:36:26 +00:00
proto/p2p: rename PEX messages and fields (#5974)
Fixes #5899 by renaming a bunch of P2P Protobuf entities (while maintaining wire compatibility): * `Message` to `PexMessage` (as it's only used for PEX messages). * `PexAddrs` to `PexResponse`. * `PexResponse.Addrs` to `PexResponse.Addresses`. * `NetAddress` to `PexAddress` (as it's only used by PEX).
This commit is contained in:
@@ -139,8 +139,8 @@ func NewNetAddressIPPort(ip net.IP, port uint16) *NetAddress {
|
||||
}
|
||||
}
|
||||
|
||||
// NetAddressFromProto converts a Protobuf NetAddress into a native struct.
|
||||
func NetAddressFromProto(pb tmp2p.NetAddress) (*NetAddress, error) {
|
||||
// NetAddressFromProto converts a Protobuf PexAddress into a native struct.
|
||||
func NetAddressFromProto(pb tmp2p.PexAddress) (*NetAddress, error) {
|
||||
ip := net.ParseIP(pb.IP)
|
||||
if ip == nil {
|
||||
return nil, fmt.Errorf("invalid IP address %v", pb.IP)
|
||||
@@ -155,8 +155,8 @@ func NetAddressFromProto(pb tmp2p.NetAddress) (*NetAddress, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NetAddressesFromProto converts a slice of Protobuf NetAddresses into a native slice.
|
||||
func NetAddressesFromProto(pbs []tmp2p.NetAddress) ([]*NetAddress, error) {
|
||||
// NetAddressesFromProto converts a slice of Protobuf PexAddresses into a native slice.
|
||||
func NetAddressesFromProto(pbs []tmp2p.PexAddress) ([]*NetAddress, error) {
|
||||
nas := make([]*NetAddress, 0, len(pbs))
|
||||
for _, pb := range pbs {
|
||||
na, err := NetAddressFromProto(pb)
|
||||
@@ -168,9 +168,9 @@ func NetAddressesFromProto(pbs []tmp2p.NetAddress) ([]*NetAddress, error) {
|
||||
return nas, nil
|
||||
}
|
||||
|
||||
// NetAddressesToProto converts a slice of NetAddresses into a Protobuf slice.
|
||||
func NetAddressesToProto(nas []*NetAddress) []tmp2p.NetAddress {
|
||||
pbs := make([]tmp2p.NetAddress, 0, len(nas))
|
||||
// NetAddressesToProto converts a slice of NetAddresses into a Protobuf PexAddress slice.
|
||||
func NetAddressesToProto(nas []*NetAddress) []tmp2p.PexAddress {
|
||||
pbs := make([]tmp2p.PexAddress, 0, len(nas))
|
||||
for _, na := range nas {
|
||||
if na != nil {
|
||||
pbs = append(pbs, na.ToProto())
|
||||
@@ -179,9 +179,9 @@ func NetAddressesToProto(nas []*NetAddress) []tmp2p.NetAddress {
|
||||
return pbs
|
||||
}
|
||||
|
||||
// ToProto converts a NetAddress to Protobuf.
|
||||
func (na *NetAddress) ToProto() tmp2p.NetAddress {
|
||||
return tmp2p.NetAddress{
|
||||
// ToProto converts a NetAddress to a Protobuf PexAddress.
|
||||
func (na *NetAddress) ToProto() tmp2p.PexAddress {
|
||||
return tmp2p.PexAddress{
|
||||
ID: string(na.ID),
|
||||
IP: na.IP.String(),
|
||||
Port: uint32(na.Port),
|
||||
|
||||
@@ -285,9 +285,9 @@ func (r *Reactor) Receive(chID byte, src Peer, msgBytes []byte) {
|
||||
r.SendAddrs(src, r.book.GetSelection())
|
||||
}
|
||||
|
||||
case *tmp2p.PexAddrs:
|
||||
case *tmp2p.PexResponse:
|
||||
// If we asked for addresses, add them to the book
|
||||
addrs, err := p2p.NetAddressesFromProto(msg.Addrs)
|
||||
addrs, err := p2p.NetAddressesFromProto(msg.Addresses)
|
||||
if err != nil {
|
||||
r.Switch.StopPeerForError(src, err)
|
||||
r.book.MarkBad(src.SocketAddr(), defaultBanTime)
|
||||
@@ -409,7 +409,7 @@ func (r *Reactor) ReceiveAddrs(addrs []*p2p.NetAddress, src Peer) error {
|
||||
|
||||
// SendAddrs sends addrs to the peer.
|
||||
func (r *Reactor) SendAddrs(p Peer, netAddrs []*p2p.NetAddress) {
|
||||
p.Send(PexChannel, mustEncode(&tmp2p.PexAddrs{Addrs: p2p.NetAddressesToProto(netAddrs)}))
|
||||
p.Send(PexChannel, mustEncode(&tmp2p.PexResponse{Addresses: p2p.NetAddressesToProto(netAddrs)}))
|
||||
}
|
||||
|
||||
// SetEnsurePeersPeriod sets period to ensure peers connected.
|
||||
@@ -773,12 +773,12 @@ func markAddrInBookBasedOnErr(addr *p2p.NetAddress, book AddrBook, err error) {
|
||||
|
||||
// mustEncode proto encodes a tmp2p.Message
|
||||
func mustEncode(pb proto.Message) []byte {
|
||||
msg := tmp2p.Message{}
|
||||
msg := tmp2p.PexMessage{}
|
||||
switch pb := pb.(type) {
|
||||
case *tmp2p.PexRequest:
|
||||
msg.Sum = &tmp2p.Message_PexRequest{PexRequest: pb}
|
||||
case *tmp2p.PexAddrs:
|
||||
msg.Sum = &tmp2p.Message_PexAddrs{PexAddrs: pb}
|
||||
msg.Sum = &tmp2p.PexMessage_PexRequest{PexRequest: pb}
|
||||
case *tmp2p.PexResponse:
|
||||
msg.Sum = &tmp2p.PexMessage_PexResponse{PexResponse: pb}
|
||||
default:
|
||||
panic(fmt.Sprintf("Unknown message type %T", pb))
|
||||
}
|
||||
@@ -791,7 +791,7 @@ func mustEncode(pb proto.Message) []byte {
|
||||
}
|
||||
|
||||
func decodeMsg(bz []byte) (proto.Message, error) {
|
||||
pb := &tmp2p.Message{}
|
||||
pb := &tmp2p.PexMessage{}
|
||||
|
||||
err := pb.Unmarshal(bz)
|
||||
if err != nil {
|
||||
@@ -799,10 +799,10 @@ func decodeMsg(bz []byte) (proto.Message, error) {
|
||||
}
|
||||
|
||||
switch msg := pb.Sum.(type) {
|
||||
case *tmp2p.Message_PexRequest:
|
||||
case *tmp2p.PexMessage_PexRequest:
|
||||
return msg.PexRequest, nil
|
||||
case *tmp2p.Message_PexAddrs:
|
||||
return msg.PexAddrs, nil
|
||||
case *tmp2p.PexMessage_PexResponse:
|
||||
return msg.PexResponse, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown message: %T", msg)
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ func TestPEXReactorReceive(t *testing.T) {
|
||||
size := book.Size()
|
||||
na, err := peer.NodeInfo().NetAddress()
|
||||
require.NoError(t, err)
|
||||
msg := mustEncode(&tmp2p.PexAddrs{Addrs: []tmp2p.NetAddress{na.ToProto()}})
|
||||
msg := mustEncode(&tmp2p.PexResponse{Addresses: []tmp2p.PexAddress{na.ToProto()}})
|
||||
r.Receive(PexChannel, peer, msg)
|
||||
assert.Equal(t, size+1, book.Size())
|
||||
|
||||
@@ -185,7 +185,7 @@ func TestPEXReactorAddrsMessageAbuse(t *testing.T) {
|
||||
assert.True(t, r.requestsSent.Has(id))
|
||||
assert.True(t, sw.Peers().Has(peer.ID()))
|
||||
|
||||
msg := mustEncode(&tmp2p.PexAddrs{Addrs: []tmp2p.NetAddress{peer.SocketAddr().ToProto()}})
|
||||
msg := mustEncode(&tmp2p.PexResponse{Addresses: []tmp2p.PexAddress{peer.SocketAddr().ToProto()}})
|
||||
|
||||
// receive some addrs. should clear the request
|
||||
r.Receive(PexChannel, peer, msg)
|
||||
@@ -456,7 +456,7 @@ func TestPEXReactorDoesNotAddPrivatePeersToAddrBook(t *testing.T) {
|
||||
size := book.Size()
|
||||
na, err := peer.NodeInfo().NetAddress()
|
||||
require.NoError(t, err)
|
||||
msg := mustEncode(&tmp2p.PexAddrs{Addrs: []tmp2p.NetAddress{na.ToProto()}})
|
||||
msg := mustEncode(&tmp2p.PexResponse{Addresses: []tmp2p.PexAddress{na.ToProto()}})
|
||||
pexR.Receive(PexChannel, peer, msg)
|
||||
assert.Equal(t, size, book.Size())
|
||||
|
||||
@@ -634,7 +634,7 @@ func createSwitchAndAddReactors(reactors ...p2p.Reactor) *p2p.Switch {
|
||||
}
|
||||
|
||||
func TestPexVectors(t *testing.T) {
|
||||
addr := tmp2p.NetAddress{
|
||||
addr := tmp2p.PexAddress{
|
||||
ID: "1",
|
||||
IP: "127.0.0.1",
|
||||
Port: 9090,
|
||||
@@ -646,7 +646,7 @@ func TestPexVectors(t *testing.T) {
|
||||
expBytes string
|
||||
}{
|
||||
{"PexRequest", &tmp2p.PexRequest{}, "0a00"},
|
||||
{"PexAddrs", &tmp2p.PexAddrs{Addrs: []tmp2p.NetAddress{addr}}, "12130a110a013112093132372e302e302e31188247"},
|
||||
{"PexAddrs", &tmp2p.PexResponse{Addresses: []tmp2p.PexAddress{addr}}, "12130a110a013112093132372e302e302e31188247"},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
var (
|
||||
_ service.Service = (*ReactorV2)(nil)
|
||||
_ p2p.Wrapper = (*protop2p.Message)(nil)
|
||||
_ p2p.Wrapper = (*protop2p.PexMessage)(nil)
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -82,15 +82,15 @@ func (r *ReactorV2) handlePexMessage(envelope p2p.Envelope) error {
|
||||
switch msg := envelope.Message.(type) {
|
||||
case *protop2p.PexRequest:
|
||||
endpoints := r.peerManager.Advertise(envelope.From, maxAddresses)
|
||||
resp := &protop2p.PexAddrs{Addrs: make([]protop2p.NetAddress, 0, len(endpoints))}
|
||||
resp := &protop2p.PexResponse{Addresses: make([]protop2p.PexAddress, 0, len(endpoints))}
|
||||
for _, endpoint := range endpoints {
|
||||
// FIXME: This shouldn't rely on NetAddress.
|
||||
resp.Addrs = append(resp.Addrs, endpoint.NetAddress().ToProto())
|
||||
resp.Addresses = append(resp.Addresses, endpoint.NetAddress().ToProto())
|
||||
}
|
||||
r.pexCh.Out() <- p2p.Envelope{To: envelope.From, Message: resp}
|
||||
|
||||
case *protop2p.PexAddrs:
|
||||
for _, pbAddr := range msg.Addrs {
|
||||
case *protop2p.PexResponse:
|
||||
for _, pbAddr := range msg.Addresses {
|
||||
// FIXME: This shouldn't rely on NetAddress.
|
||||
netaddr, err := p2p.NetAddressFromProto(pbAddr)
|
||||
if err != nil {
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
)
|
||||
|
||||
// Wrap implements the p2p Wrapper interface and wraps a PEX message.
|
||||
func (m *Message) Wrap(pb proto.Message) error {
|
||||
func (m *PexMessage) Wrap(pb proto.Message) error {
|
||||
switch msg := pb.(type) {
|
||||
case *PexRequest:
|
||||
m.Sum = &Message_PexRequest{PexRequest: msg}
|
||||
case *PexAddrs:
|
||||
m.Sum = &Message_PexAddrs{PexAddrs: msg}
|
||||
m.Sum = &PexMessage_PexRequest{PexRequest: msg}
|
||||
case *PexResponse:
|
||||
m.Sum = &PexMessage_PexResponse{PexResponse: msg}
|
||||
default:
|
||||
return fmt.Errorf("unknown message: %T", msg)
|
||||
}
|
||||
@@ -21,12 +21,12 @@ func (m *Message) Wrap(pb proto.Message) error {
|
||||
|
||||
// Unwrap implements the p2p Wrapper interface and unwraps a wrapped PEX
|
||||
// message.
|
||||
func (m *Message) Unwrap() (proto.Message, error) {
|
||||
func (m *PexMessage) Unwrap() (proto.Message, error) {
|
||||
switch msg := m.Sum.(type) {
|
||||
case *Message_PexRequest:
|
||||
case *PexMessage_PexRequest:
|
||||
return msg.PexRequest, nil
|
||||
case *Message_PexAddrs:
|
||||
return msg.PexAddrs, nil
|
||||
case *PexMessage_PexResponse:
|
||||
return msg.PexResponse, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown message: %T", msg)
|
||||
}
|
||||
|
||||
@@ -23,6 +23,66 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type PexAddress struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
IP string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
Port uint32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PexAddress) Reset() { *m = PexAddress{} }
|
||||
func (m *PexAddress) String() string { return proto.CompactTextString(m) }
|
||||
func (*PexAddress) ProtoMessage() {}
|
||||
func (*PexAddress) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_81c2f011fd13be57, []int{0}
|
||||
}
|
||||
func (m *PexAddress) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *PexAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_PexAddress.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *PexAddress) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PexAddress.Merge(m, src)
|
||||
}
|
||||
func (m *PexAddress) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *PexAddress) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PexAddress.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PexAddress proto.InternalMessageInfo
|
||||
|
||||
func (m *PexAddress) GetID() string {
|
||||
if m != nil {
|
||||
return m.ID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PexAddress) GetIP() string {
|
||||
if m != nil {
|
||||
return m.IP
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PexAddress) GetPort() uint32 {
|
||||
if m != nil {
|
||||
return m.Port
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type PexRequest struct {
|
||||
}
|
||||
|
||||
@@ -30,7 +90,7 @@ func (m *PexRequest) Reset() { *m = PexRequest{} }
|
||||
func (m *PexRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*PexRequest) ProtoMessage() {}
|
||||
func (*PexRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_81c2f011fd13be57, []int{0}
|
||||
return fileDescriptor_81c2f011fd13be57, []int{1}
|
||||
}
|
||||
func (m *PexRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -59,22 +119,22 @@ func (m *PexRequest) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_PexRequest proto.InternalMessageInfo
|
||||
|
||||
type PexAddrs struct {
|
||||
Addrs []NetAddress `protobuf:"bytes,1,rep,name=addrs,proto3" json:"addrs"`
|
||||
type PexResponse struct {
|
||||
Addresses []PexAddress `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses"`
|
||||
}
|
||||
|
||||
func (m *PexAddrs) Reset() { *m = PexAddrs{} }
|
||||
func (m *PexAddrs) String() string { return proto.CompactTextString(m) }
|
||||
func (*PexAddrs) ProtoMessage() {}
|
||||
func (*PexAddrs) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_81c2f011fd13be57, []int{1}
|
||||
func (m *PexResponse) Reset() { *m = PexResponse{} }
|
||||
func (m *PexResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*PexResponse) ProtoMessage() {}
|
||||
func (*PexResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_81c2f011fd13be57, []int{2}
|
||||
}
|
||||
func (m *PexAddrs) XXX_Unmarshal(b []byte) error {
|
||||
func (m *PexResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *PexAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
func (m *PexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_PexAddrs.Marshal(b, m, deterministic)
|
||||
return xxx_messageInfo_PexResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
@@ -84,44 +144,44 @@ func (m *PexAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *PexAddrs) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PexAddrs.Merge(m, src)
|
||||
func (m *PexResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PexResponse.Merge(m, src)
|
||||
}
|
||||
func (m *PexAddrs) XXX_Size() int {
|
||||
func (m *PexResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *PexAddrs) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PexAddrs.DiscardUnknown(m)
|
||||
func (m *PexResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PexResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PexAddrs proto.InternalMessageInfo
|
||||
var xxx_messageInfo_PexResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *PexAddrs) GetAddrs() []NetAddress {
|
||||
func (m *PexResponse) GetAddresses() []PexAddress {
|
||||
if m != nil {
|
||||
return m.Addrs
|
||||
return m.Addresses
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
type PexMessage struct {
|
||||
// Types that are valid to be assigned to Sum:
|
||||
// *Message_PexRequest
|
||||
// *Message_PexAddrs
|
||||
Sum isMessage_Sum `protobuf_oneof:"sum"`
|
||||
// *PexMessage_PexRequest
|
||||
// *PexMessage_PexResponse
|
||||
Sum isPexMessage_Sum `protobuf_oneof:"sum"`
|
||||
}
|
||||
|
||||
func (m *Message) Reset() { *m = Message{} }
|
||||
func (m *Message) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message) ProtoMessage() {}
|
||||
func (*Message) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_81c2f011fd13be57, []int{2}
|
||||
func (m *PexMessage) Reset() { *m = PexMessage{} }
|
||||
func (m *PexMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*PexMessage) ProtoMessage() {}
|
||||
func (*PexMessage) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_81c2f011fd13be57, []int{3}
|
||||
}
|
||||
func (m *Message) XXX_Unmarshal(b []byte) error {
|
||||
func (m *PexMessage) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
func (m *PexMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Message.Marshal(b, m, deterministic)
|
||||
return xxx_messageInfo_PexMessage.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
@@ -131,90 +191,136 @@ func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *Message) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Message.Merge(m, src)
|
||||
func (m *PexMessage) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PexMessage.Merge(m, src)
|
||||
}
|
||||
func (m *Message) XXX_Size() int {
|
||||
func (m *PexMessage) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Message) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Message.DiscardUnknown(m)
|
||||
func (m *PexMessage) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PexMessage.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Message proto.InternalMessageInfo
|
||||
var xxx_messageInfo_PexMessage proto.InternalMessageInfo
|
||||
|
||||
type isMessage_Sum interface {
|
||||
isMessage_Sum()
|
||||
type isPexMessage_Sum interface {
|
||||
isPexMessage_Sum()
|
||||
MarshalTo([]byte) (int, error)
|
||||
Size() int
|
||||
}
|
||||
|
||||
type Message_PexRequest struct {
|
||||
type PexMessage_PexRequest struct {
|
||||
PexRequest *PexRequest `protobuf:"bytes,1,opt,name=pex_request,json=pexRequest,proto3,oneof" json:"pex_request,omitempty"`
|
||||
}
|
||||
type Message_PexAddrs struct {
|
||||
PexAddrs *PexAddrs `protobuf:"bytes,2,opt,name=pex_addrs,json=pexAddrs,proto3,oneof" json:"pex_addrs,omitempty"`
|
||||
type PexMessage_PexResponse struct {
|
||||
PexResponse *PexResponse `protobuf:"bytes,2,opt,name=pex_response,json=pexResponse,proto3,oneof" json:"pex_response,omitempty"`
|
||||
}
|
||||
|
||||
func (*Message_PexRequest) isMessage_Sum() {}
|
||||
func (*Message_PexAddrs) isMessage_Sum() {}
|
||||
func (*PexMessage_PexRequest) isPexMessage_Sum() {}
|
||||
func (*PexMessage_PexResponse) isPexMessage_Sum() {}
|
||||
|
||||
func (m *Message) GetSum() isMessage_Sum {
|
||||
func (m *PexMessage) GetSum() isPexMessage_Sum {
|
||||
if m != nil {
|
||||
return m.Sum
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message) GetPexRequest() *PexRequest {
|
||||
if x, ok := m.GetSum().(*Message_PexRequest); ok {
|
||||
func (m *PexMessage) GetPexRequest() *PexRequest {
|
||||
if x, ok := m.GetSum().(*PexMessage_PexRequest); ok {
|
||||
return x.PexRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message) GetPexAddrs() *PexAddrs {
|
||||
if x, ok := m.GetSum().(*Message_PexAddrs); ok {
|
||||
return x.PexAddrs
|
||||
func (m *PexMessage) GetPexResponse() *PexResponse {
|
||||
if x, ok := m.GetSum().(*PexMessage_PexResponse); ok {
|
||||
return x.PexResponse
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofWrappers is for the internal use of the proto package.
|
||||
func (*Message) XXX_OneofWrappers() []interface{} {
|
||||
func (*PexMessage) XXX_OneofWrappers() []interface{} {
|
||||
return []interface{}{
|
||||
(*Message_PexRequest)(nil),
|
||||
(*Message_PexAddrs)(nil),
|
||||
(*PexMessage_PexRequest)(nil),
|
||||
(*PexMessage_PexResponse)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*PexAddress)(nil), "tendermint.p2p.PexAddress")
|
||||
proto.RegisterType((*PexRequest)(nil), "tendermint.p2p.PexRequest")
|
||||
proto.RegisterType((*PexAddrs)(nil), "tendermint.p2p.PexAddrs")
|
||||
proto.RegisterType((*Message)(nil), "tendermint.p2p.Message")
|
||||
proto.RegisterType((*PexResponse)(nil), "tendermint.p2p.PexResponse")
|
||||
proto.RegisterType((*PexMessage)(nil), "tendermint.p2p.PexMessage")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("tendermint/p2p/pex.proto", fileDescriptor_81c2f011fd13be57) }
|
||||
|
||||
var fileDescriptor_81c2f011fd13be57 = []byte{
|
||||
// 268 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x49, 0xcd, 0x4b,
|
||||
0x49, 0x2d, 0xca, 0xcd, 0xcc, 0x2b, 0xd1, 0x2f, 0x30, 0x2a, 0xd0, 0x2f, 0x48, 0xad, 0xd0, 0x2b,
|
||||
0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x43, 0xc8, 0xe8, 0x15, 0x18, 0x15, 0x48, 0x49, 0xa1, 0xa9,
|
||||
0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0x86, 0xa8, 0x95, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x33, 0xf5,
|
||||
0x41, 0x2c, 0x88, 0xa8, 0x12, 0x0f, 0x17, 0x57, 0x40, 0x6a, 0x45, 0x50, 0x6a, 0x61, 0x69, 0x6a,
|
||||
0x71, 0x89, 0x92, 0x13, 0x17, 0x47, 0x40, 0x6a, 0x85, 0x63, 0x4a, 0x4a, 0x51, 0xb1, 0x90, 0x19,
|
||||
0x17, 0x6b, 0x22, 0x88, 0x21, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0x24, 0xa5, 0x87, 0x6a, 0x97,
|
||||
0x9e, 0x5f, 0x6a, 0x09, 0x48, 0x61, 0x6a, 0x71, 0xb1, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41,
|
||||
0x10, 0xe5, 0x4a, 0x1d, 0x8c, 0x5c, 0xec, 0xbe, 0xa9, 0xc5, 0xc5, 0x89, 0xe9, 0xa9, 0x42, 0xb6,
|
||||
0x5c, 0xdc, 0x05, 0xa9, 0x15, 0xf1, 0x45, 0x10, 0xe3, 0x25, 0x18, 0x15, 0x18, 0xb1, 0x99, 0x84,
|
||||
0x70, 0x80, 0x07, 0x43, 0x10, 0x57, 0x01, 0x9c, 0x27, 0x64, 0xce, 0xc5, 0x09, 0xd2, 0x0e, 0x71,
|
||||
0x06, 0x13, 0x58, 0xb3, 0x04, 0x16, 0xcd, 0x60, 0xf7, 0x7a, 0x30, 0x04, 0x71, 0x14, 0x40, 0xd9,
|
||||
0x4e, 0xac, 0x5c, 0xcc, 0xc5, 0xa5, 0xb9, 0x4e, 0xfe, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24,
|
||||
0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78,
|
||||
0x2c, 0xc7, 0x10, 0x65, 0x9a, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f,
|
||||
0x14, 0x66, 0xc8, 0xc1, 0x07, 0x0e, 0x29, 0xd4, 0xf0, 0x4c, 0x62, 0x03, 0x8b, 0x1a, 0x03, 0x02,
|
||||
0x00, 0x00, 0xff, 0xff, 0x3c, 0x0b, 0xcb, 0x40, 0x92, 0x01, 0x00, 0x00,
|
||||
// 310 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0x31, 0x4b, 0xc3, 0x40,
|
||||
0x18, 0xbd, 0x4b, 0x6b, 0xa1, 0x97, 0xea, 0x70, 0x88, 0x84, 0x0a, 0xd7, 0x92, 0xa9, 0x53, 0x02,
|
||||
0x11, 0x47, 0x45, 0x83, 0x43, 0x1d, 0x8a, 0xe5, 0x46, 0x17, 0x69, 0xcd, 0x47, 0xcc, 0xd0, 0xde,
|
||||
0x67, 0xee, 0x0a, 0xfd, 0x19, 0x0e, 0xfe, 0xa8, 0x8e, 0x1d, 0x9d, 0x8a, 0xa4, 0x7f, 0x44, 0xbc,
|
||||
0x13, 0x93, 0x42, 0xb7, 0x7b, 0xef, 0xfb, 0xde, 0xfb, 0xde, 0xf1, 0x58, 0x60, 0x60, 0x99, 0x41,
|
||||
0xb9, 0x28, 0x96, 0x26, 0xc6, 0x04, 0x63, 0x84, 0x75, 0x84, 0xa5, 0x32, 0x8a, 0x9f, 0xd5, 0x93,
|
||||
0x08, 0x13, 0xec, 0x9f, 0xe7, 0x2a, 0x57, 0x76, 0x14, 0xff, 0xbe, 0xdc, 0x56, 0x38, 0x65, 0x6c,
|
||||
0x0a, 0xeb, 0xfb, 0x2c, 0x2b, 0x41, 0x6b, 0x7e, 0xc1, 0xbc, 0x22, 0x0b, 0xe8, 0x90, 0x8e, 0xba,
|
||||
0x69, 0xa7, 0xda, 0x0d, 0xbc, 0xc7, 0x07, 0xe9, 0x15, 0x99, 0xe5, 0x31, 0xf0, 0x1a, 0xfc, 0x54,
|
||||
0x7a, 0x05, 0x72, 0xce, 0xda, 0xa8, 0x4a, 0x13, 0xb4, 0x86, 0x74, 0x74, 0x2a, 0xed, 0x3b, 0xec,
|
||||
0x59, 0x47, 0x09, 0xef, 0x2b, 0xd0, 0x26, 0x9c, 0x30, 0xdf, 0x22, 0x8d, 0x6a, 0xa9, 0x81, 0xdf,
|
||||
0xb2, 0xee, 0xcc, 0xdd, 0x02, 0x1d, 0xd0, 0x61, 0x6b, 0xe4, 0x27, 0xfd, 0xe8, 0x30, 0x68, 0x54,
|
||||
0xe7, 0x49, 0xdb, 0x9b, 0xdd, 0x80, 0xc8, 0x5a, 0x12, 0x7e, 0x52, 0xeb, 0x3e, 0x01, 0xad, 0x67,
|
||||
0x39, 0xf0, 0x1b, 0xe6, 0x23, 0xac, 0x5f, 0x4a, 0x77, 0xcc, 0x06, 0x3f, 0x6e, 0xf8, 0x17, 0x67,
|
||||
0x4c, 0x24, 0xc3, 0x7f, 0xc4, 0xef, 0x58, 0xcf, 0xc9, 0x5d, 0x3a, 0xfb, 0x41, 0x3f, 0xb9, 0x3c,
|
||||
0xaa, 0x77, 0x2b, 0x63, 0x22, 0x7d, 0xac, 0x61, 0x7a, 0xc2, 0x5a, 0x7a, 0xb5, 0x48, 0x9f, 0x36,
|
||||
0x95, 0xa0, 0xdb, 0x4a, 0xd0, 0xef, 0x4a, 0xd0, 0x8f, 0xbd, 0x20, 0xdb, 0xbd, 0x20, 0x5f, 0x7b,
|
||||
0x41, 0x9e, 0xaf, 0xf3, 0xc2, 0xbc, 0xad, 0xe6, 0xd1, 0xab, 0x5a, 0xc4, 0x8d, 0xaa, 0x9a, 0xad,
|
||||
0xd9, 0x4a, 0x0e, 0x6b, 0x9c, 0x77, 0x2c, 0x7b, 0xf5, 0x13, 0x00, 0x00, 0xff, 0xff, 0xa6, 0xa1,
|
||||
0x59, 0x3c, 0xdf, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *PexAddress) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *PexAddress) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *PexAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Port != 0 {
|
||||
i = encodeVarintPex(dAtA, i, uint64(m.Port))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if len(m.IP) > 0 {
|
||||
i -= len(m.IP)
|
||||
copy(dAtA[i:], m.IP)
|
||||
i = encodeVarintPex(dAtA, i, uint64(len(m.IP)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.ID) > 0 {
|
||||
i -= len(m.ID)
|
||||
copy(dAtA[i:], m.ID)
|
||||
i = encodeVarintPex(dAtA, i, uint64(len(m.ID)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *PexRequest) Marshal() (dAtA []byte, err error) {
|
||||
@@ -240,7 +346,7 @@ func (m *PexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *PexAddrs) Marshal() (dAtA []byte, err error) {
|
||||
func (m *PexResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
@@ -250,20 +356,20 @@ func (m *PexAddrs) Marshal() (dAtA []byte, err error) {
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *PexAddrs) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *PexResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *PexAddrs) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *PexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Addrs) > 0 {
|
||||
for iNdEx := len(m.Addrs) - 1; iNdEx >= 0; iNdEx-- {
|
||||
if len(m.Addresses) > 0 {
|
||||
for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Addrs[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
size, err := m.Addresses[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -277,7 +383,7 @@ func (m *PexAddrs) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *Message) Marshal() (dAtA []byte, err error) {
|
||||
func (m *PexMessage) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
@@ -287,12 +393,12 @@ func (m *Message) Marshal() (dAtA []byte, err error) {
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Message) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *PexMessage) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *PexMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
@@ -309,12 +415,12 @@ func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *Message_PexRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *PexMessage_PexRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Message_PexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *PexMessage_PexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
if m.PexRequest != nil {
|
||||
{
|
||||
@@ -330,16 +436,16 @@ func (m *Message_PexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
func (m *Message_PexAddrs) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *PexMessage_PexResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Message_PexAddrs) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *PexMessage_PexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
if m.PexAddrs != nil {
|
||||
if m.PexResponse != nil {
|
||||
{
|
||||
size, err := m.PexAddrs.MarshalToSizedBuffer(dAtA[:i])
|
||||
size, err := m.PexResponse.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -362,6 +468,26 @@ func encodeVarintPex(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *PexAddress) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.ID)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovPex(uint64(l))
|
||||
}
|
||||
l = len(m.IP)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovPex(uint64(l))
|
||||
}
|
||||
if m.Port != 0 {
|
||||
n += 1 + sovPex(uint64(m.Port))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *PexRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@@ -371,14 +497,14 @@ func (m *PexRequest) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *PexAddrs) Size() (n int) {
|
||||
func (m *PexResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Addrs) > 0 {
|
||||
for _, e := range m.Addrs {
|
||||
if len(m.Addresses) > 0 {
|
||||
for _, e := range m.Addresses {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovPex(uint64(l))
|
||||
}
|
||||
@@ -386,7 +512,7 @@ func (m *PexAddrs) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Message) Size() (n int) {
|
||||
func (m *PexMessage) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
@@ -398,7 +524,7 @@ func (m *Message) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Message_PexRequest) Size() (n int) {
|
||||
func (m *PexMessage_PexRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
@@ -410,14 +536,14 @@ func (m *Message_PexRequest) Size() (n int) {
|
||||
}
|
||||
return n
|
||||
}
|
||||
func (m *Message_PexAddrs) Size() (n int) {
|
||||
func (m *PexMessage_PexResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.PexAddrs != nil {
|
||||
l = m.PexAddrs.Size()
|
||||
if m.PexResponse != nil {
|
||||
l = m.PexResponse.Size()
|
||||
n += 1 + l + sovPex(uint64(l))
|
||||
}
|
||||
return n
|
||||
@@ -429,6 +555,139 @@ func sovPex(x uint64) (n int) {
|
||||
func sozPex(x uint64) (n int) {
|
||||
return sovPex(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *PexAddress) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPex
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PexAddress: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PexAddress: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPex
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthPex
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthPex
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ID = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field IP", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPex
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthPex
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthPex
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.IP = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType)
|
||||
}
|
||||
m.Port = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPex
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Port |= uint32(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipPex(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthPex
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PexRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
@@ -479,7 +738,7 @@ func (m *PexRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PexAddrs) Unmarshal(dAtA []byte) error {
|
||||
func (m *PexResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
@@ -502,15 +761,15 @@ func (m *PexAddrs) Unmarshal(dAtA []byte) error {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PexAddrs: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: PexResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PexAddrs: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: PexResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@@ -537,8 +796,8 @@ func (m *PexAddrs) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Addrs = append(m.Addrs, NetAddress{})
|
||||
if err := m.Addrs[len(m.Addrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
m.Addresses = append(m.Addresses, PexAddress{})
|
||||
if err := m.Addresses[len(m.Addresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
@@ -563,7 +822,7 @@ func (m *PexAddrs) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) Unmarshal(dAtA []byte) error {
|
||||
func (m *PexMessage) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
@@ -586,10 +845,10 @@ func (m *Message) Unmarshal(dAtA []byte) error {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Message: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: PexMessage: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: PexMessage: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
@@ -625,11 +884,11 @@ func (m *Message) Unmarshal(dAtA []byte) error {
|
||||
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
m.Sum = &Message_PexRequest{v}
|
||||
m.Sum = &PexMessage_PexRequest{v}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field PexAddrs", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field PexResponse", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@@ -656,11 +915,11 @@ func (m *Message) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v := &PexAddrs{}
|
||||
v := &PexResponse{}
|
||||
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
m.Sum = &Message_PexAddrs{v}
|
||||
m.Sum = &PexMessage_PexResponse{v}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
||||
@@ -3,18 +3,23 @@ package tendermint.p2p;
|
||||
|
||||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p";
|
||||
|
||||
import "tendermint/p2p/types.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
message PexAddress {
|
||||
string id = 1 [(gogoproto.customname) = "ID"];
|
||||
string ip = 2 [(gogoproto.customname) = "IP"];
|
||||
uint32 port = 3;
|
||||
}
|
||||
|
||||
message PexRequest {}
|
||||
|
||||
message PexAddrs {
|
||||
repeated NetAddress addrs = 1 [(gogoproto.nullable) = false];
|
||||
message PexResponse {
|
||||
repeated PexAddress addresses = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Message {
|
||||
message PexMessage {
|
||||
oneof sum {
|
||||
PexRequest pex_request = 1;
|
||||
PexAddrs pex_addrs = 2;
|
||||
PexRequest pex_request = 1;
|
||||
PexResponse pex_response = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,66 +27,6 @@ var _ = time.Kitchen
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type NetAddress struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
IP string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
Port uint32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
|
||||
}
|
||||
|
||||
func (m *NetAddress) Reset() { *m = NetAddress{} }
|
||||
func (m *NetAddress) String() string { return proto.CompactTextString(m) }
|
||||
func (*NetAddress) ProtoMessage() {}
|
||||
func (*NetAddress) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c8a29e659aeca578, []int{0}
|
||||
}
|
||||
func (m *NetAddress) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *NetAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_NetAddress.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *NetAddress) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_NetAddress.Merge(m, src)
|
||||
}
|
||||
func (m *NetAddress) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *NetAddress) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_NetAddress.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_NetAddress proto.InternalMessageInfo
|
||||
|
||||
func (m *NetAddress) GetID() string {
|
||||
if m != nil {
|
||||
return m.ID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NetAddress) GetIP() string {
|
||||
if m != nil {
|
||||
return m.IP
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NetAddress) GetPort() uint32 {
|
||||
if m != nil {
|
||||
return m.Port
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ProtocolVersion struct {
|
||||
P2P uint64 `protobuf:"varint,1,opt,name=p2p,proto3" json:"p2p,omitempty"`
|
||||
Block uint64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"`
|
||||
@@ -97,7 +37,7 @@ func (m *ProtocolVersion) Reset() { *m = ProtocolVersion{} }
|
||||
func (m *ProtocolVersion) String() string { return proto.CompactTextString(m) }
|
||||
func (*ProtocolVersion) ProtoMessage() {}
|
||||
func (*ProtocolVersion) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c8a29e659aeca578, []int{1}
|
||||
return fileDescriptor_c8a29e659aeca578, []int{0}
|
||||
}
|
||||
func (m *ProtocolVersion) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -162,7 +102,7 @@ func (m *NodeInfo) Reset() { *m = NodeInfo{} }
|
||||
func (m *NodeInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*NodeInfo) ProtoMessage() {}
|
||||
func (*NodeInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c8a29e659aeca578, []int{2}
|
||||
return fileDescriptor_c8a29e659aeca578, []int{1}
|
||||
}
|
||||
func (m *NodeInfo) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -256,7 +196,7 @@ func (m *NodeInfoOther) Reset() { *m = NodeInfoOther{} }
|
||||
func (m *NodeInfoOther) String() string { return proto.CompactTextString(m) }
|
||||
func (*NodeInfoOther) ProtoMessage() {}
|
||||
func (*NodeInfoOther) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c8a29e659aeca578, []int{3}
|
||||
return fileDescriptor_c8a29e659aeca578, []int{2}
|
||||
}
|
||||
func (m *NodeInfoOther) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -309,7 +249,7 @@ func (m *PeerInfo) Reset() { *m = PeerInfo{} }
|
||||
func (m *PeerInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*PeerInfo) ProtoMessage() {}
|
||||
func (*PeerInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c8a29e659aeca578, []int{4}
|
||||
return fileDescriptor_c8a29e659aeca578, []int{3}
|
||||
}
|
||||
func (m *PeerInfo) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -370,7 +310,7 @@ func (m *PeerAddressInfo) Reset() { *m = PeerAddressInfo{} }
|
||||
func (m *PeerAddressInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*PeerAddressInfo) ProtoMessage() {}
|
||||
func (*PeerAddressInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c8a29e659aeca578, []int{5}
|
||||
return fileDescriptor_c8a29e659aeca578, []int{4}
|
||||
}
|
||||
func (m *PeerAddressInfo) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -428,7 +368,6 @@ func (m *PeerAddressInfo) GetDialFailures() uint32 {
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*NetAddress)(nil), "tendermint.p2p.NetAddress")
|
||||
proto.RegisterType((*ProtocolVersion)(nil), "tendermint.p2p.ProtocolVersion")
|
||||
proto.RegisterType((*NodeInfo)(nil), "tendermint.p2p.NodeInfo")
|
||||
proto.RegisterType((*NodeInfoOther)(nil), "tendermint.p2p.NodeInfoOther")
|
||||
@@ -439,90 +378,46 @@ func init() {
|
||||
func init() { proto.RegisterFile("tendermint/p2p/types.proto", fileDescriptor_c8a29e659aeca578) }
|
||||
|
||||
var fileDescriptor_c8a29e659aeca578 = []byte{
|
||||
// 641 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0x1a, 0x3b,
|
||||
0x14, 0x66, 0x80, 0x00, 0x39, 0x84, 0x90, 0x6b, 0x45, 0x57, 0x13, 0xa4, 0xcb, 0x20, 0xb2, 0xc9,
|
||||
0x6a, 0x90, 0xb8, 0xea, 0xa2, 0xcb, 0x92, 0xa8, 0x15, 0x52, 0x95, 0x8c, 0xdc, 0xa8, 0x8b, 0x76,
|
||||
0x81, 0x86, 0xb1, 0x21, 0x56, 0x06, 0xdb, 0xf2, 0x98, 0x36, 0x7d, 0x8b, 0xbc, 0x49, 0x1f, 0xa3,
|
||||
0x59, 0x66, 0xd9, 0x15, 0xad, 0x26, 0xdb, 0x3e, 0x44, 0x65, 0xcf, 0x4c, 0x02, 0xa8, 0x95, 0xb2,
|
||||
0xf3, 0x77, 0x8e, 0xbf, 0xef, 0xfc, 0xea, 0x40, 0x47, 0x53, 0x4e, 0xa8, 0x5a, 0x30, 0xae, 0x07,
|
||||
0x72, 0x28, 0x07, 0xfa, 0x8b, 0xa4, 0x89, 0x2f, 0x95, 0xd0, 0x02, 0xed, 0x3f, 0xf9, 0x7c, 0x39,
|
||||
0x94, 0x9d, 0xc3, 0xb9, 0x98, 0x0b, 0xeb, 0x1a, 0x98, 0x57, 0xf6, 0xab, 0xe3, 0xcd, 0x85, 0x98,
|
||||
0xc7, 0x74, 0x60, 0xd1, 0x74, 0x39, 0x1b, 0x68, 0xb6, 0xa0, 0x89, 0x0e, 0x17, 0x32, 0xfb, 0xd0,
|
||||
0x0f, 0x00, 0xce, 0xa9, 0x7e, 0x45, 0x88, 0xa2, 0x49, 0x82, 0xfe, 0x85, 0x32, 0x23, 0xae, 0xd3,
|
||||
0x73, 0x4e, 0x76, 0x47, 0xb5, 0x74, 0xe5, 0x95, 0xc7, 0x67, 0xb8, 0xcc, 0x88, 0xb5, 0x4b, 0xb7,
|
||||
0xbc, 0x66, 0x0f, 0x70, 0x99, 0x49, 0x84, 0xa0, 0x2a, 0x85, 0xd2, 0x6e, 0xa5, 0xe7, 0x9c, 0xb4,
|
||||
0xb0, 0x7d, 0xf7, 0x2f, 0xa1, 0x1d, 0x18, 0xe9, 0x48, 0xc4, 0xef, 0xa9, 0x4a, 0x98, 0xe0, 0xe8,
|
||||
0x08, 0x2a, 0x72, 0x28, 0xad, 0x6e, 0x75, 0x54, 0x4f, 0x57, 0x5e, 0x25, 0x18, 0x06, 0xd8, 0xd8,
|
||||
0xd0, 0x21, 0xec, 0x4c, 0x63, 0x11, 0x5d, 0x5b, 0xf1, 0x2a, 0xce, 0x00, 0x3a, 0x80, 0x4a, 0x28,
|
||||
0xa5, 0x95, 0xad, 0x62, 0xf3, 0xec, 0x7f, 0x2b, 0x43, 0xe3, 0x5c, 0x10, 0x3a, 0xe6, 0x33, 0x81,
|
||||
0x02, 0x38, 0x90, 0x79, 0x88, 0xc9, 0xa7, 0x2c, 0x86, 0x15, 0x6f, 0x0e, 0x3d, 0x7f, 0xb3, 0x2d,
|
||||
0xfe, 0x56, 0x2a, 0xa3, 0xea, 0xdd, 0xca, 0x2b, 0xe1, 0xb6, 0xdc, 0xca, 0xf0, 0x18, 0xea, 0x5c,
|
||||
0x10, 0x3a, 0x61, 0x24, 0xaf, 0x12, 0xd2, 0x95, 0x57, 0xb3, 0x01, 0xcf, 0x70, 0xcd, 0xb8, 0xc6,
|
||||
0x04, 0x79, 0xd0, 0x8c, 0x59, 0xa2, 0x29, 0x9f, 0x84, 0x84, 0x28, 0x9b, 0xdd, 0x2e, 0x86, 0xcc,
|
||||
0x64, 0x3a, 0x88, 0x5c, 0xa8, 0x73, 0xaa, 0x3f, 0x0b, 0x75, 0xed, 0x56, 0xad, 0xb3, 0x80, 0xc6,
|
||||
0x53, 0x24, 0xba, 0x93, 0x79, 0x72, 0x88, 0x3a, 0xd0, 0x88, 0xae, 0x42, 0xce, 0x69, 0x9c, 0xb8,
|
||||
0xb5, 0x9e, 0x73, 0xb2, 0x87, 0x1f, 0xb1, 0x61, 0x2d, 0x04, 0x67, 0xd7, 0x54, 0xb9, 0xf5, 0x8c,
|
||||
0x95, 0x43, 0xf4, 0x12, 0x76, 0x84, 0xbe, 0xa2, 0xca, 0x6d, 0xd8, 0xb2, 0xff, 0xdb, 0x2e, 0xbb,
|
||||
0x68, 0xd5, 0x85, 0xf9, 0x94, 0x17, 0x9d, 0x31, 0xfa, 0x1f, 0xa1, 0xb5, 0xe1, 0x45, 0x47, 0xd0,
|
||||
0xd0, 0x37, 0x13, 0xc6, 0x09, 0xbd, 0xc9, 0x46, 0x8f, 0xeb, 0xfa, 0x66, 0x6c, 0x20, 0x1a, 0x40,
|
||||
0x53, 0xc9, 0xc8, 0x96, 0x4b, 0x93, 0x24, 0x6f, 0xcd, 0x7e, 0xba, 0xf2, 0x00, 0x07, 0xa7, 0xf9,
|
||||
0xd2, 0x60, 0x50, 0x32, 0xca, 0xdf, 0xfd, 0xaf, 0x0e, 0x34, 0x02, 0x4a, 0x95, 0x1d, 0xd3, 0xdf,
|
||||
0xb6, 0x69, 0x04, 0x7b, 0xb9, 0xe2, 0x84, 0xf1, 0x99, 0x70, 0xcb, 0xbd, 0xca, 0x1f, 0x47, 0x47,
|
||||
0xa9, 0xca, 0x75, 0x8d, 0x1c, 0x6e, 0x86, 0x4f, 0x00, 0xbd, 0x81, 0xfd, 0x38, 0x4c, 0xf4, 0x24,
|
||||
0x12, 0x9c, 0xd3, 0x48, 0x53, 0x62, 0xc7, 0xd1, 0x1c, 0x76, 0xfc, 0x6c, 0xe3, 0xfd, 0x62, 0xe3,
|
||||
0xfd, 0xcb, 0x62, 0xe3, 0x47, 0xd5, 0xdb, 0x1f, 0x9e, 0x83, 0x5b, 0x86, 0x77, 0x5a, 0xd0, 0xfa,
|
||||
0xbf, 0x1c, 0x68, 0x6f, 0x45, 0x32, 0x7d, 0x2f, 0x4a, 0xce, 0x1b, 0x92, 0x43, 0xf4, 0x16, 0xfe,
|
||||
0xb1, 0x61, 0x09, 0x0b, 0xe3, 0x49, 0xb2, 0x8c, 0xa2, 0xa2, 0x2d, 0xcf, 0x89, 0xdc, 0x36, 0xd4,
|
||||
0x33, 0x16, 0xc6, 0xef, 0x32, 0xe2, 0xa6, 0xda, 0x2c, 0x64, 0xf1, 0x52, 0xd1, 0x67, 0xd7, 0xf1,
|
||||
0xa8, 0xf6, 0x3a, 0x23, 0xa2, 0x63, 0x68, 0xad, 0x0b, 0x25, 0x76, 0x07, 0x5b, 0x78, 0x8f, 0x3c,
|
||||
0xfd, 0x49, 0x46, 0x17, 0x77, 0x69, 0xd7, 0xb9, 0x4f, 0xbb, 0xce, 0xcf, 0xb4, 0xeb, 0xdc, 0x3e,
|
||||
0x74, 0x4b, 0xf7, 0x0f, 0xdd, 0xd2, 0xf7, 0x87, 0x6e, 0xe9, 0xc3, 0x8b, 0x39, 0xd3, 0x57, 0xcb,
|
||||
0xa9, 0x1f, 0x89, 0xc5, 0x60, 0xed, 0xee, 0xac, 0x9f, 0x20, 0x7b, 0x5d, 0x36, 0x6f, 0xd2, 0xb4,
|
||||
0x66, 0xad, 0xff, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x88, 0x9e, 0xfc, 0x51, 0xac, 0x04, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
||||
func (m *NetAddress) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *NetAddress) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *NetAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Port != 0 {
|
||||
i = encodeVarintTypes(dAtA, i, uint64(m.Port))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if len(m.IP) > 0 {
|
||||
i -= len(m.IP)
|
||||
copy(dAtA[i:], m.IP)
|
||||
i = encodeVarintTypes(dAtA, i, uint64(len(m.IP)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.ID) > 0 {
|
||||
i -= len(m.ID)
|
||||
copy(dAtA[i:], m.ID)
|
||||
i = encodeVarintTypes(dAtA, i, uint64(len(m.ID)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
// 610 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x4e, 0x1b, 0x3d,
|
||||
0x14, 0xcd, 0x24, 0x21, 0x09, 0x37, 0x84, 0xf0, 0x59, 0xe8, 0xd3, 0x10, 0xa9, 0x19, 0x14, 0x36,
|
||||
0xac, 0x26, 0x52, 0xaa, 0x2e, 0xba, 0x64, 0x40, 0xad, 0x22, 0x55, 0x25, 0x9a, 0xa2, 0x2e, 0xda,
|
||||
0xc5, 0x68, 0x32, 0x76, 0x82, 0xc5, 0xc4, 0xb6, 0x3c, 0x4e, 0x4b, 0xdf, 0x82, 0x37, 0xe9, 0x63,
|
||||
0x94, 0x25, 0xcb, 0xae, 0xd2, 0x6a, 0xd8, 0xf6, 0x21, 0x2a, 0xdb, 0x33, 0x40, 0xa2, 0x2e, 0xd8,
|
||||
0xf9, 0xdc, 0xe3, 0x73, 0xee, 0x8f, 0xad, 0x0b, 0x3d, 0x45, 0x18, 0x26, 0x72, 0x41, 0x99, 0x1a,
|
||||
0x8a, 0x91, 0x18, 0xaa, 0x6f, 0x82, 0x64, 0xbe, 0x90, 0x5c, 0x71, 0xb4, 0xfb, 0xc8, 0xf9, 0x62,
|
||||
0x24, 0x7a, 0xfb, 0x73, 0x3e, 0xe7, 0x86, 0x1a, 0xea, 0x93, 0xbd, 0xd5, 0xf3, 0xe6, 0x9c, 0xcf,
|
||||
0x53, 0x32, 0x34, 0x68, 0xba, 0x9c, 0x0d, 0x15, 0x5d, 0x90, 0x4c, 0xc5, 0x0b, 0x61, 0x2f, 0x0c,
|
||||
0x2e, 0xa0, 0x3b, 0xd1, 0x87, 0x84, 0xa7, 0x1f, 0x89, 0xcc, 0x28, 0x67, 0xe8, 0x00, 0x6a, 0x62,
|
||||
0x24, 0x5c, 0xe7, 0xd0, 0x39, 0xae, 0x07, 0xcd, 0x7c, 0xe5, 0xd5, 0x26, 0xa3, 0x49, 0xa8, 0x63,
|
||||
0x68, 0x1f, 0xb6, 0xa6, 0x29, 0x4f, 0xae, 0xdc, 0xaa, 0x26, 0x43, 0x0b, 0xd0, 0x1e, 0xd4, 0x62,
|
||||
0x21, 0xdc, 0x9a, 0x89, 0xe9, 0xe3, 0xe0, 0x47, 0x15, 0x5a, 0xef, 0x39, 0x26, 0x63, 0x36, 0xe3,
|
||||
0x68, 0x02, 0x7b, 0xa2, 0x48, 0x11, 0x7d, 0xb1, 0x39, 0x8c, 0x79, 0x7b, 0xe4, 0xf9, 0xeb, 0x4d,
|
||||
0xf8, 0x1b, 0xa5, 0x04, 0xf5, 0xdb, 0x95, 0x57, 0x09, 0xbb, 0x62, 0xa3, 0xc2, 0x23, 0x68, 0x32,
|
||||
0x8e, 0x49, 0x44, 0xb1, 0x29, 0x64, 0x3b, 0x80, 0x7c, 0xe5, 0x35, 0x4c, 0xc2, 0xb3, 0xb0, 0xa1,
|
||||
0xa9, 0x31, 0x46, 0x1e, 0xb4, 0x53, 0x9a, 0x29, 0xc2, 0xa2, 0x18, 0x63, 0x69, 0xaa, 0xdb, 0x0e,
|
||||
0xc1, 0x86, 0x4e, 0x30, 0x96, 0xc8, 0x85, 0x26, 0x23, 0xea, 0x2b, 0x97, 0x57, 0x6e, 0xdd, 0x90,
|
||||
0x25, 0xd4, 0x4c, 0x59, 0xe8, 0x96, 0x65, 0x0a, 0x88, 0x7a, 0xd0, 0x4a, 0x2e, 0x63, 0xc6, 0x48,
|
||||
0x9a, 0xb9, 0x8d, 0x43, 0xe7, 0x78, 0x27, 0x7c, 0xc0, 0x5a, 0xb5, 0xe0, 0x8c, 0x5e, 0x11, 0xe9,
|
||||
0x36, 0xad, 0xaa, 0x80, 0xe8, 0x35, 0x6c, 0x71, 0x75, 0x49, 0xa4, 0xdb, 0x32, 0x6d, 0xbf, 0xd8,
|
||||
0x6c, 0xbb, 0x1c, 0xd5, 0xb9, 0xbe, 0x54, 0x34, 0x6d, 0x15, 0x83, 0xcf, 0xd0, 0x59, 0x63, 0xd1,
|
||||
0x01, 0xb4, 0xd4, 0x75, 0x44, 0x19, 0x26, 0xd7, 0x66, 0x8a, 0xdb, 0x61, 0x53, 0x5d, 0x8f, 0x35,
|
||||
0x44, 0x43, 0x68, 0x4b, 0x91, 0x98, 0x76, 0x49, 0x96, 0x15, 0xa3, 0xd9, 0xcd, 0x57, 0x1e, 0x84,
|
||||
0x93, 0xd3, 0x13, 0x1b, 0x0d, 0x41, 0x8a, 0xa4, 0x38, 0x0f, 0xbe, 0x3b, 0xd0, 0x9a, 0x10, 0x22,
|
||||
0xcd, 0x33, 0xfd, 0x0f, 0x55, 0x8a, 0xad, 0x65, 0xd0, 0xc8, 0x57, 0x5e, 0x75, 0x7c, 0x16, 0x56,
|
||||
0x29, 0x46, 0x01, 0xec, 0x14, 0x8e, 0x11, 0x65, 0x33, 0xee, 0x56, 0x0f, 0x6b, 0xff, 0x7c, 0x3a,
|
||||
0x42, 0x64, 0xe1, 0xab, 0xed, 0xc2, 0x76, 0xfc, 0x08, 0xd0, 0x5b, 0xd8, 0x4d, 0xe3, 0x4c, 0x45,
|
||||
0x09, 0x67, 0x8c, 0x24, 0x8a, 0x60, 0xf3, 0x1c, 0xed, 0x51, 0xcf, 0xb7, 0xff, 0xd3, 0x2f, 0xff,
|
||||
0xa7, 0x7f, 0x51, 0xfe, 0xcf, 0xa0, 0x7e, 0xf3, 0xcb, 0x73, 0xc2, 0x8e, 0xd6, 0x9d, 0x96, 0xb2,
|
||||
0xc1, 0x1f, 0x07, 0xba, 0x1b, 0x99, 0xf4, 0xdc, 0xcb, 0x96, 0x8b, 0x81, 0x14, 0x10, 0xbd, 0x83,
|
||||
0xff, 0x4c, 0x5a, 0x4c, 0xe3, 0x34, 0xca, 0x96, 0x49, 0x52, 0x8e, 0xe5, 0x39, 0x99, 0xbb, 0x5a,
|
||||
0x7a, 0x46, 0xe3, 0xf4, 0x83, 0x15, 0xae, 0xbb, 0xcd, 0x62, 0x9a, 0x2e, 0x25, 0x79, 0x76, 0x1f,
|
||||
0x0f, 0x6e, 0x6f, 0xac, 0x10, 0x1d, 0x41, 0xe7, 0xa9, 0x51, 0x66, 0xfe, 0x60, 0x27, 0xdc, 0xc1,
|
||||
0x8f, 0x77, 0xb2, 0xe0, 0xfc, 0x36, 0xef, 0x3b, 0x77, 0x79, 0xdf, 0xf9, 0x9d, 0xf7, 0x9d, 0x9b,
|
||||
0xfb, 0x7e, 0xe5, 0xee, 0xbe, 0x5f, 0xf9, 0x79, 0xdf, 0xaf, 0x7c, 0x7a, 0x35, 0xa7, 0xea, 0x72,
|
||||
0x39, 0xf5, 0x13, 0xbe, 0x18, 0x3e, 0xd9, 0x12, 0x4f, 0x17, 0x86, 0xd9, 0x05, 0xeb, 0x1b, 0x64,
|
||||
0xda, 0x30, 0xd1, 0x97, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xe9, 0x56, 0xd3, 0x5a, 0x04,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *ProtocolVersion) Marshal() (dAtA []byte, err error) {
|
||||
@@ -805,26 +700,6 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *NetAddress) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.ID)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
}
|
||||
l = len(m.IP)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
}
|
||||
if m.Port != 0 {
|
||||
n += 1 + sovTypes(uint64(m.Port))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ProtocolVersion) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@@ -950,139 +825,6 @@ func sovTypes(x uint64) (n int) {
|
||||
func sozTypes(x uint64) (n int) {
|
||||
return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *NetAddress) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: NetAddress: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: NetAddress: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ID = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field IP", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.IP = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType)
|
||||
}
|
||||
m.Port = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Port |= uint32(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTypes(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ProtocolVersion) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
@@ -6,12 +6,6 @@ option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
message NetAddress {
|
||||
string id = 1 [(gogoproto.customname) = "ID"];
|
||||
string ip = 2 [(gogoproto.customname) = "IP"];
|
||||
uint32 port = 3;
|
||||
}
|
||||
|
||||
message ProtocolVersion {
|
||||
uint64 p2p = 1 [(gogoproto.customname) = "P2P"];
|
||||
uint64 block = 2;
|
||||
|
||||
@@ -61,9 +61,9 @@ func initCorpus(rootDir string) {
|
||||
}
|
||||
addrs = append(addrs, ipv6a)
|
||||
|
||||
msg := tmp2p.Message{
|
||||
Sum: &tmp2p.Message_PexAddrs{
|
||||
PexAddrs: &tmp2p.PexAddrs{Addrs: p2p.NetAddressesToProto(addrs)},
|
||||
msg := tmp2p.PexMessage{
|
||||
Sum: &tmp2p.PexMessage_PexResponse{
|
||||
PexResponse: &tmp2p.PexResponse{Addresses: p2p.NetAddressesToProto(addrs)},
|
||||
},
|
||||
}
|
||||
bz, err := msg.Marshal()
|
||||
|
||||
Reference in New Issue
Block a user