network

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

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,proto3" json:"header,omitempty"`
	ChainId              uint32   `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	MsgType              uint32   `protobuf:"varint,3,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty"`
	MsgBody              []byte   `protobuf:"bytes,4,opt,name=msg_body,json=msgBody,proto3" json:"msg_body,omitempty"`
	MsgChecksum          []byte   `protobuf:"bytes,5,opt,name=msg_checksum,json=msgChecksum,proto3" json:"msg_checksum,omitempty"`
	Ttl                  int32    `protobuf:"varint,6,opt,name=ttl,proto3" json:"ttl,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*BroadcastReq) Descriptor

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

func (*BroadcastReq) GetChainId added in v0.4.0

func (m *BroadcastReq) GetChainId() uint32

func (*BroadcastReq) GetHeader

func (m *BroadcastReq) GetHeader() uint32

func (*BroadcastReq) GetMsgBody

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

func (*BroadcastReq) GetMsgChecksum added in v0.3.0

func (m *BroadcastReq) GetMsgChecksum() []byte

func (*BroadcastReq) GetMsgType

func (m *BroadcastReq) GetMsgType() uint32

func (*BroadcastReq) GetTtl added in v0.2.0

func (m *BroadcastReq) GetTtl() int32

func (*BroadcastReq) ProtoMessage

func (*BroadcastReq) ProtoMessage()

func (*BroadcastReq) Reset

func (m *BroadcastReq) Reset()

func (*BroadcastReq) String

func (m *BroadcastReq) String() string

func (*BroadcastReq) XXX_DiscardUnknown added in v0.2.0

func (m *BroadcastReq) XXX_DiscardUnknown()

func (*BroadcastReq) XXX_Marshal added in v0.2.0

func (m *BroadcastReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BroadcastReq) XXX_Merge added in v0.2.0

func (dst *BroadcastReq) XXX_Merge(src proto.Message)

func (*BroadcastReq) XXX_Size added in v0.2.0

func (m *BroadcastReq) XXX_Size() int

func (*BroadcastReq) XXX_Unmarshal added in v0.2.0

func (m *BroadcastReq) XXX_Unmarshal(b []byte) error

type BroadcastRes

type BroadcastRes struct {
	Header               uint32   `protobuf:"varint,1,opt,name=header,proto3" json:"header,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

func (*BroadcastRes) XXX_DiscardUnknown added in v0.2.0

func (m *BroadcastRes) XXX_DiscardUnknown()

func (*BroadcastRes) XXX_Marshal added in v0.2.0

func (m *BroadcastRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BroadcastRes) XXX_Merge added in v0.2.0

func (dst *BroadcastRes) XXX_Merge(src proto.Message)

func (*BroadcastRes) XXX_Size added in v0.2.0

func (m *BroadcastRes) XXX_Size() int

func (*BroadcastRes) XXX_Unmarshal added in v0.2.0

func (m *BroadcastRes) XXX_Unmarshal(b []byte) error

type GetPeersReq

type GetPeersReq struct {
	Count                uint32   `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

func (*GetPeersReq) XXX_DiscardUnknown added in v0.2.0

func (m *GetPeersReq) XXX_DiscardUnknown()

func (*GetPeersReq) XXX_Marshal added in v0.2.0

func (m *GetPeersReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetPeersReq) XXX_Merge added in v0.2.0

func (dst *GetPeersReq) XXX_Merge(src proto.Message)

func (*GetPeersReq) XXX_Size added in v0.2.0

func (m *GetPeersReq) XXX_Size() int

func (*GetPeersReq) XXX_Unmarshal added in v0.2.0

func (m *GetPeersReq) XXX_Unmarshal(b []byte) error

type GetPeersRes

type GetPeersRes struct {
	Addr                 []string `protobuf:"bytes,1,rep,name=addr,proto3" json:"addr,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

func (*GetPeersRes) XXX_DiscardUnknown added in v0.2.0

func (m *GetPeersRes) XXX_DiscardUnknown()

func (*GetPeersRes) XXX_Marshal added in v0.2.0

func (m *GetPeersRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetPeersRes) XXX_Merge added in v0.2.0

func (dst *GetPeersRes) XXX_Merge(src proto.Message)

func (*GetPeersRes) XXX_Size added in v0.2.0

func (m *GetPeersRes) XXX_Size() int

func (*GetPeersRes) XXX_Unmarshal added in v0.2.0

func (m *GetPeersRes) XXX_Unmarshal(b []byte) error

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)
}

PeerClient is the client API for Peer service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

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)
}

PeerServer is the server API for Peer service.

type Ping

type Ping struct {
	Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" 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,proto3" json:"addr,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

func (*Ping) XXX_DiscardUnknown added in v0.2.0

func (m *Ping) XXX_DiscardUnknown()

func (*Ping) XXX_Marshal added in v0.2.0

func (m *Ping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Ping) XXX_Merge added in v0.2.0

func (dst *Ping) XXX_Merge(src proto.Message)

func (*Ping) XXX_Size added in v0.2.0

func (m *Ping) XXX_Size() int

func (*Ping) XXX_Unmarshal added in v0.2.0

func (m *Ping) XXX_Unmarshal(b []byte) error

type Pong

type Pong struct {
	AckNonce             uint64   `protobuf:"varint,1,opt,name=ack_nonce,json=ackNonce,proto3" json:"ack_nonce,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

func (*Pong) XXX_DiscardUnknown added in v0.2.0

func (m *Pong) XXX_DiscardUnknown()

func (*Pong) XXX_Marshal added in v0.2.0

func (m *Pong) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Pong) XXX_Merge added in v0.2.0

func (dst *Pong) XXX_Merge(src proto.Message)

func (*Pong) XXX_Size added in v0.2.0

func (m *Pong) XXX_Size() int

func (*Pong) XXX_Unmarshal added in v0.2.0

func (m *Pong) XXX_Unmarshal(b []byte) error

type TellReq

type TellReq struct {
	Header               uint32   `protobuf:"varint,1,opt,name=header,proto3" json:"header,omitempty"`
	Addr                 string   `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
	ChainId              uint32   `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	MsgType              uint32   `protobuf:"varint,4,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty"`
	MsgBody              []byte   `protobuf:"bytes,5,opt,name=msg_body,json=msgBody,proto3" json:"msg_body,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*TellReq) Descriptor

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

func (*TellReq) GetAddr

func (m *TellReq) GetAddr() string

func (*TellReq) GetChainId added in v0.4.0

func (m *TellReq) GetChainId() uint32

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

func (*TellReq) XXX_DiscardUnknown added in v0.2.0

func (m *TellReq) XXX_DiscardUnknown()

func (*TellReq) XXX_Marshal added in v0.2.0

func (m *TellReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TellReq) XXX_Merge added in v0.2.0

func (dst *TellReq) XXX_Merge(src proto.Message)

func (*TellReq) XXX_Size added in v0.2.0

func (m *TellReq) XXX_Size() int

func (*TellReq) XXX_Unmarshal added in v0.2.0

func (m *TellReq) XXX_Unmarshal(b []byte) error

type TellRes

type TellRes struct {
	Header               uint32   `protobuf:"varint,1,opt,name=header,proto3" json:"header,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

func (*TellRes) XXX_DiscardUnknown added in v0.2.0

func (m *TellRes) XXX_DiscardUnknown()

func (*TellRes) XXX_Marshal added in v0.2.0

func (m *TellRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TellRes) XXX_Merge added in v0.2.0

func (dst *TellRes) XXX_Merge(src proto.Message)

func (*TellRes) XXX_Size added in v0.2.0

func (m *TellRes) XXX_Size() int

func (*TellRes) XXX_Unmarshal added in v0.2.0

func (m *TellRes) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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