network

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

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) Descriptor() ([]byte, []int)

func (*Ping) GetAddr

func (m *Ping) GetAddr() string

func (*Ping) GetNonce

func (m *Ping) GetNonce() uint64

func (*Ping) ProtoMessage

func (*Ping) ProtoMessage()

func (*Ping) Reset

func (m *Ping) Reset()

func (*Ping) String

func (m *Ping) String() string

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) Descriptor() ([]byte, []int)

func (*Pong) GetAckNonce

func (m *Pong) GetAckNonce() uint64

func (*Pong) ProtoMessage

func (*Pong) ProtoMessage()

func (*Pong) Reset

func (m *Pong) Reset()

func (*Pong) String

func (m *Pong) String() string

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) Descriptor() ([]byte, []int)

func (*TellReq) GetAddr

func (m *TellReq) GetAddr() string

func (*TellReq) GetHeader

func (m *TellReq) GetHeader() uint32

func (*TellReq) GetMsgBody

func (m *TellReq) GetMsgBody() []byte

func (*TellReq) GetMsgType

func (m *TellReq) GetMsgType() uint32

func (*TellReq) ProtoMessage

func (*TellReq) ProtoMessage()

func (*TellReq) Reset

func (m *TellReq) Reset()

func (*TellReq) String

func (m *TellReq) String() string

type TellRes

type TellRes struct {
	Header uint32 `protobuf:"varint,1,opt,name=header" json:"header,omitempty"`
}

func (*TellRes) Descriptor

func (*TellRes) Descriptor() ([]byte, []int)

func (*TellRes) GetHeader

func (m *TellRes) GetHeader() uint32

func (*TellRes) ProtoMessage

func (*TellRes) ProtoMessage()

func (*TellRes) Reset

func (m *TellRes) Reset()

func (*TellRes) String

func (m *TellRes) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL