Documentation ¶
Overview ¶
Package network is a generated protocol buffer package.
It is generated from these files:
network/proto/rpc.proto
It has these top-level messages:
Ping Pong GetPeersReq GetPeersRes BroadcastReq BroadcastRes TellReq TellRes
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterPeerServer ¶
func RegisterPeerServer(s *grpc.Server, srv PeerServer)
Types ¶
type BroadcastReq ¶
type BroadcastReq struct { Header uint32 `protobuf:"varint,1,opt,name=header" json:"header,omitempty"` MsgType uint32 `protobuf:"varint,2,opt,name=msg_type,json=msgType" json:"msg_type,omitempty"` MsgBody []byte `protobuf:"bytes,3,opt,name=msg_body,json=msgBody,proto3" json:"msg_body,omitempty"` }
func (*BroadcastReq) Descriptor ¶
func (*BroadcastReq) Descriptor() ([]byte, []int)
func (*BroadcastReq) GetHeader ¶
func (m *BroadcastReq) GetHeader() uint32
func (*BroadcastReq) GetMsgBody ¶
func (m *BroadcastReq) GetMsgBody() []byte
func (*BroadcastReq) GetMsgType ¶
func (m *BroadcastReq) GetMsgType() uint32
func (*BroadcastReq) ProtoMessage ¶
func (*BroadcastReq) ProtoMessage()
func (*BroadcastReq) Reset ¶
func (m *BroadcastReq) Reset()
func (*BroadcastReq) String ¶
func (m *BroadcastReq) String() string
type BroadcastRes ¶
type BroadcastRes struct {
Header uint32 `protobuf:"varint,1,opt,name=header" json:"header,omitempty"`
}
func (*BroadcastRes) Descriptor ¶
func (*BroadcastRes) Descriptor() ([]byte, []int)
func (*BroadcastRes) GetHeader ¶
func (m *BroadcastRes) GetHeader() uint32
func (*BroadcastRes) ProtoMessage ¶
func (*BroadcastRes) ProtoMessage()
func (*BroadcastRes) Reset ¶
func (m *BroadcastRes) Reset()
func (*BroadcastRes) String ¶
func (m *BroadcastRes) String() string
type GetPeersReq ¶
type GetPeersReq struct {
Count uint32 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"`
}
func (*GetPeersReq) Descriptor ¶
func (*GetPeersReq) Descriptor() ([]byte, []int)
func (*GetPeersReq) GetCount ¶
func (m *GetPeersReq) GetCount() uint32
func (*GetPeersReq) ProtoMessage ¶
func (*GetPeersReq) ProtoMessage()
func (*GetPeersReq) Reset ¶
func (m *GetPeersReq) Reset()
func (*GetPeersReq) String ¶
func (m *GetPeersReq) String() string
type GetPeersRes ¶
type GetPeersRes struct {
Addr []string `protobuf:"bytes,1,rep,name=addr" json:"addr,omitempty"`
}
func (*GetPeersRes) Descriptor ¶
func (*GetPeersRes) Descriptor() ([]byte, []int)
func (*GetPeersRes) GetAddr ¶
func (m *GetPeersRes) GetAddr() []string
func (*GetPeersRes) ProtoMessage ¶
func (*GetPeersRes) ProtoMessage()
func (*GetPeersRes) Reset ¶
func (m *GetPeersRes) Reset()
func (*GetPeersRes) String ¶
func (m *GetPeersRes) String() string
type PeerClient ¶
type PeerClient interface { Ping(ctx context.Context, in *Ping, opts ...grpc.CallOption) (*Pong, error) GetPeers(ctx context.Context, in *GetPeersReq, opts ...grpc.CallOption) (*GetPeersRes, error) Broadcast(ctx context.Context, in *BroadcastReq, opts ...grpc.CallOption) (*BroadcastRes, error) Tell(ctx context.Context, in *TellReq, opts ...grpc.CallOption) (*TellRes, error) }
func NewPeerClient ¶
func NewPeerClient(cc *grpc.ClientConn) PeerClient
type PeerServer ¶
type PeerServer interface { Ping(context.Context, *Ping) (*Pong, error) GetPeers(context.Context, *GetPeersReq) (*GetPeersRes, error) Broadcast(context.Context, *BroadcastReq) (*BroadcastRes, error) Tell(context.Context, *TellReq) (*TellRes, error) }
type Ping ¶
type Ping struct { Nonce uint64 `protobuf:"varint,1,opt,name=nonce" json:"nonce,omitempty"` // Every one who participates into the network needs to tell others its address // TODO: Seperate it as a standalone protocol Addr string `protobuf:"bytes,2,opt,name=addr" json:"addr,omitempty"` }
func (*Ping) Descriptor ¶
func (*Ping) ProtoMessage ¶
func (*Ping) ProtoMessage()
type Pong ¶
type Pong struct {
AckNonce uint64 `protobuf:"varint,1,opt,name=ack_nonce,json=ackNonce" json:"ack_nonce,omitempty"`
}
func (*Pong) Descriptor ¶
func (*Pong) GetAckNonce ¶
func (*Pong) ProtoMessage ¶
func (*Pong) ProtoMessage()
type TellReq ¶
type TellReq struct { Header uint32 `protobuf:"varint,1,opt,name=header" json:"header,omitempty"` Addr string `protobuf:"bytes,2,opt,name=addr" json:"addr,omitempty"` MsgType uint32 `protobuf:"varint,3,opt,name=msg_type,json=msgType" json:"msg_type,omitempty"` MsgBody []byte `protobuf:"bytes,4,opt,name=msg_body,json=msgBody,proto3" json:"msg_body,omitempty"` }
func (*TellReq) Descriptor ¶
func (*TellReq) GetMsgBody ¶
func (*TellReq) GetMsgType ¶
func (*TellReq) ProtoMessage ¶
func (*TellReq) ProtoMessage()
type TellRes ¶
type TellRes struct {
Header uint32 `protobuf:"varint,1,opt,name=header" json:"header,omitempty"`
}
func (*TellRes) Descriptor ¶
func (*TellRes) ProtoMessage ¶
func (*TellRes) ProtoMessage()
Click to show internal directories.
Click to hide internal directories.