rpc

package
v0.5.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Connectedness_name = map[int32]string{
		0: "CONNECTEDNESS_UNSPECIFIED",
		1: "CONNECTEDNESS_NOT_CONNECTED",
		2: "CONNECTEDNESS_CONNECTED",
		3: "CONNECTEDNESS_CAN_CONNECT",
		4: "CONNECTEDNESS_CANNOT_CONNECT",
		5: "CONNECTEDNESS_ERROR",
	}
	Connectedness_value = map[string]int32{
		"CONNECTEDNESS_UNSPECIFIED":    0,
		"CONNECTEDNESS_NOT_CONNECTED":  1,
		"CONNECTEDNESS_CONNECTED":      2,
		"CONNECTEDNESS_CAN_CONNECT":    3,
		"CONNECTEDNESS_CANNOT_CONNECT": 4,
		"CONNECTEDNESS_ERROR":          5,
	}
)

Enum value maps for Connectedness.

View Source
var File_net_rpc_rpc_proto protoreflect.FileDescriptor

Functions

func RegisterRPCServiceServer

func RegisterRPCServiceServer(s *grpc.Server, srv RPCServiceServer)

Types

type ConnectPeerRequest

type ConnectPeerRequest struct {
	PeerInfo *PeerAddrInfo `protobuf:"bytes,1,opt,name=peer_info,json=peerInfo,proto3" json:"peer_info,omitempty"`
	// contains filtered or unexported fields
}

func (*ConnectPeerRequest) Descriptor deprecated

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

Deprecated: Use ConnectPeerRequest.ProtoReflect.Descriptor instead.

func (*ConnectPeerRequest) GetPeerInfo

func (x *ConnectPeerRequest) GetPeerInfo() *PeerAddrInfo

func (*ConnectPeerRequest) ProtoMessage

func (*ConnectPeerRequest) ProtoMessage()

func (*ConnectPeerRequest) ProtoReflect

func (x *ConnectPeerRequest) ProtoReflect() protoreflect.Message

func (*ConnectPeerRequest) Reset

func (x *ConnectPeerRequest) Reset()

func (*ConnectPeerRequest) String

func (x *ConnectPeerRequest) String() string

type ConnectPeerResponse

type ConnectPeerResponse struct {
	// contains filtered or unexported fields
}

func (*ConnectPeerResponse) Descriptor deprecated

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

Deprecated: Use ConnectPeerResponse.ProtoReflect.Descriptor instead.

func (*ConnectPeerResponse) ProtoMessage

func (*ConnectPeerResponse) ProtoMessage()

func (*ConnectPeerResponse) ProtoReflect

func (x *ConnectPeerResponse) ProtoReflect() protoreflect.Message

func (*ConnectPeerResponse) Reset

func (x *ConnectPeerResponse) Reset()

func (*ConnectPeerResponse) String

func (x *ConnectPeerResponse) String() string

type Connectedness

type Connectedness int32
const (
	Connectedness_CONNECTEDNESS_UNSPECIFIED    Connectedness = 0
	Connectedness_CONNECTEDNESS_NOT_CONNECTED  Connectedness = 1
	Connectedness_CONNECTEDNESS_CONNECTED      Connectedness = 2
	Connectedness_CONNECTEDNESS_CAN_CONNECT    Connectedness = 3
	Connectedness_CONNECTEDNESS_CANNOT_CONNECT Connectedness = 4
	Connectedness_CONNECTEDNESS_ERROR          Connectedness = 5
)

func (Connectedness) Descriptor

func (Connectedness) Enum

func (x Connectedness) Enum() *Connectedness

func (Connectedness) EnumDescriptor deprecated

func (Connectedness) EnumDescriptor() ([]byte, []int)

Deprecated: Use Connectedness.Descriptor instead.

func (Connectedness) Number

func (Connectedness) String

func (x Connectedness) String() string

func (Connectedness) Type

type ConnectednessRequest

type ConnectednessRequest struct {
	PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ConnectednessRequest) Descriptor deprecated

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

Deprecated: Use ConnectednessRequest.ProtoReflect.Descriptor instead.

func (*ConnectednessRequest) GetPeerId

func (x *ConnectednessRequest) GetPeerId() string

func (*ConnectednessRequest) ProtoMessage

func (*ConnectednessRequest) ProtoMessage()

func (*ConnectednessRequest) ProtoReflect

func (x *ConnectednessRequest) ProtoReflect() protoreflect.Message

func (*ConnectednessRequest) Reset

func (x *ConnectednessRequest) Reset()

func (*ConnectednessRequest) String

func (x *ConnectednessRequest) String() string

type ConnectednessResponse

type ConnectednessResponse struct {
	Connectedness Connectedness `protobuf:"varint,1,opt,name=connectedness,proto3,enum=net.rpc.Connectedness" json:"connectedness,omitempty"`
	// contains filtered or unexported fields
}

func (*ConnectednessResponse) Descriptor deprecated

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

Deprecated: Use ConnectednessResponse.ProtoReflect.Descriptor instead.

func (*ConnectednessResponse) GetConnectedness

func (x *ConnectednessResponse) GetConnectedness() Connectedness

func (*ConnectednessResponse) ProtoMessage

func (*ConnectednessResponse) ProtoMessage()

func (*ConnectednessResponse) ProtoReflect

func (x *ConnectednessResponse) ProtoReflect() protoreflect.Message

func (*ConnectednessResponse) Reset

func (x *ConnectednessResponse) Reset()

func (*ConnectednessResponse) String

func (x *ConnectednessResponse) String() string

type DisconnectPeerRequest

type DisconnectPeerRequest struct {
	PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	// contains filtered or unexported fields
}

func (*DisconnectPeerRequest) Descriptor deprecated

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

Deprecated: Use DisconnectPeerRequest.ProtoReflect.Descriptor instead.

func (*DisconnectPeerRequest) GetPeerId

func (x *DisconnectPeerRequest) GetPeerId() string

func (*DisconnectPeerRequest) ProtoMessage

func (*DisconnectPeerRequest) ProtoMessage()

func (*DisconnectPeerRequest) ProtoReflect

func (x *DisconnectPeerRequest) ProtoReflect() protoreflect.Message

func (*DisconnectPeerRequest) Reset

func (x *DisconnectPeerRequest) Reset()

func (*DisconnectPeerRequest) String

func (x *DisconnectPeerRequest) String() string

type DisconnectPeerResponse

type DisconnectPeerResponse struct {
	// contains filtered or unexported fields
}

func (*DisconnectPeerResponse) Descriptor deprecated

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

Deprecated: Use DisconnectPeerResponse.ProtoReflect.Descriptor instead.

func (*DisconnectPeerResponse) ProtoMessage

func (*DisconnectPeerResponse) ProtoMessage()

func (*DisconnectPeerResponse) ProtoReflect

func (x *DisconnectPeerResponse) ProtoReflect() protoreflect.Message

func (*DisconnectPeerResponse) Reset

func (x *DisconnectPeerResponse) Reset()

func (*DisconnectPeerResponse) String

func (x *DisconnectPeerResponse) String() string

type FindPeerRequest

type FindPeerRequest struct {
	PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	// contains filtered or unexported fields
}

func (*FindPeerRequest) Descriptor deprecated

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

Deprecated: Use FindPeerRequest.ProtoReflect.Descriptor instead.

func (*FindPeerRequest) GetPeerId

func (x *FindPeerRequest) GetPeerId() string

func (*FindPeerRequest) ProtoMessage

func (*FindPeerRequest) ProtoMessage()

func (*FindPeerRequest) ProtoReflect

func (x *FindPeerRequest) ProtoReflect() protoreflect.Message

func (*FindPeerRequest) Reset

func (x *FindPeerRequest) Reset()

func (*FindPeerRequest) String

func (x *FindPeerRequest) String() string

type FindPeerResponse

type FindPeerResponse struct {
	PeerInfo *PeerInfo `protobuf:"bytes,1,opt,name=peer_info,json=peerInfo,proto3" json:"peer_info,omitempty"`
	// contains filtered or unexported fields
}

func (*FindPeerResponse) Descriptor deprecated

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

Deprecated: Use FindPeerResponse.ProtoReflect.Descriptor instead.

func (*FindPeerResponse) GetPeerInfo

func (x *FindPeerResponse) GetPeerInfo() *PeerInfo

func (*FindPeerResponse) ProtoMessage

func (*FindPeerResponse) ProtoMessage()

func (*FindPeerResponse) ProtoReflect

func (x *FindPeerResponse) ProtoReflect() protoreflect.Message

func (*FindPeerResponse) Reset

func (x *FindPeerResponse) Reset()

func (*FindPeerResponse) String

func (x *FindPeerResponse) String() string

type ListenAddrRequest

type ListenAddrRequest struct {
	// contains filtered or unexported fields
}

func (*ListenAddrRequest) Descriptor deprecated

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

Deprecated: Use ListenAddrRequest.ProtoReflect.Descriptor instead.

func (*ListenAddrRequest) ProtoMessage

func (*ListenAddrRequest) ProtoMessage()

func (*ListenAddrRequest) ProtoReflect

func (x *ListenAddrRequest) ProtoReflect() protoreflect.Message

func (*ListenAddrRequest) Reset

func (x *ListenAddrRequest) Reset()

func (*ListenAddrRequest) String

func (x *ListenAddrRequest) String() string

type ListenAddrResponse

type ListenAddrResponse struct {
	AddrInfo *PeerAddrInfo `protobuf:"bytes,1,opt,name=addr_info,json=addrInfo,proto3" json:"addr_info,omitempty"`
	// contains filtered or unexported fields
}

func (*ListenAddrResponse) Descriptor deprecated

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

Deprecated: Use ListenAddrResponse.ProtoReflect.Descriptor instead.

func (*ListenAddrResponse) GetAddrInfo

func (x *ListenAddrResponse) GetAddrInfo() *PeerAddrInfo

func (*ListenAddrResponse) ProtoMessage

func (*ListenAddrResponse) ProtoMessage()

func (*ListenAddrResponse) ProtoReflect

func (x *ListenAddrResponse) ProtoReflect() protoreflect.Message

func (*ListenAddrResponse) Reset

func (x *ListenAddrResponse) Reset()

func (*ListenAddrResponse) String

func (x *ListenAddrResponse) String() string

type Location

type Location struct {
	Country   string  `protobuf:"bytes,1,opt,name=country,proto3" json:"country,omitempty"`
	Latitude  float64 `protobuf:"fixed64,2,opt,name=latitude,proto3" json:"latitude,omitempty"`
	Longitude float64 `protobuf:"fixed64,3,opt,name=longitude,proto3" json:"longitude,omitempty"`
	// contains filtered or unexported fields
}

func (*Location) Descriptor deprecated

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

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetCountry

func (x *Location) GetCountry() string

func (*Location) GetLatitude

func (x *Location) GetLatitude() float64

func (*Location) GetLongitude

func (x *Location) GetLongitude() float64

func (*Location) ProtoMessage

func (*Location) ProtoMessage()

func (*Location) ProtoReflect

func (x *Location) ProtoReflect() protoreflect.Message

func (*Location) Reset

func (x *Location) Reset()

func (*Location) String

func (x *Location) String() string

type PeerAddrInfo

type PeerAddrInfo struct {
	Id    string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Addrs []string `protobuf:"bytes,2,rep,name=addrs,proto3" json:"addrs,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerAddrInfo) Descriptor deprecated

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

Deprecated: Use PeerAddrInfo.ProtoReflect.Descriptor instead.

func (*PeerAddrInfo) GetAddrs

func (x *PeerAddrInfo) GetAddrs() []string

func (*PeerAddrInfo) GetId

func (x *PeerAddrInfo) GetId() string

func (*PeerAddrInfo) ProtoMessage

func (*PeerAddrInfo) ProtoMessage()

func (*PeerAddrInfo) ProtoReflect

func (x *PeerAddrInfo) ProtoReflect() protoreflect.Message

func (*PeerAddrInfo) Reset

func (x *PeerAddrInfo) Reset()

func (*PeerAddrInfo) String

func (x *PeerAddrInfo) String() string

type PeerInfo

type PeerInfo struct {
	AddrInfo *PeerAddrInfo `protobuf:"bytes,1,opt,name=addr_info,json=addrInfo,proto3" json:"addr_info,omitempty"`
	Location *Location     `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerInfo) Descriptor deprecated

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

Deprecated: Use PeerInfo.ProtoReflect.Descriptor instead.

func (*PeerInfo) GetAddrInfo

func (x *PeerInfo) GetAddrInfo() *PeerAddrInfo

func (*PeerInfo) GetLocation

func (x *PeerInfo) GetLocation() *Location

func (*PeerInfo) ProtoMessage

func (*PeerInfo) ProtoMessage()

func (*PeerInfo) ProtoReflect

func (x *PeerInfo) ProtoReflect() protoreflect.Message

func (*PeerInfo) Reset

func (x *PeerInfo) Reset()

func (*PeerInfo) String

func (x *PeerInfo) String() string

type PeersRequest

type PeersRequest struct {
	// contains filtered or unexported fields
}

func (*PeersRequest) Descriptor deprecated

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

Deprecated: Use PeersRequest.ProtoReflect.Descriptor instead.

func (*PeersRequest) ProtoMessage

func (*PeersRequest) ProtoMessage()

func (*PeersRequest) ProtoReflect

func (x *PeersRequest) ProtoReflect() protoreflect.Message

func (*PeersRequest) Reset

func (x *PeersRequest) Reset()

func (*PeersRequest) String

func (x *PeersRequest) String() string

type PeersResponse

type PeersResponse struct {
	Peers []*PeerInfo `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"`
	// contains filtered or unexported fields
}

func (*PeersResponse) Descriptor deprecated

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

Deprecated: Use PeersResponse.ProtoReflect.Descriptor instead.

func (*PeersResponse) GetPeers

func (x *PeersResponse) GetPeers() []*PeerInfo

func (*PeersResponse) ProtoMessage

func (*PeersResponse) ProtoMessage()

func (*PeersResponse) ProtoReflect

func (x *PeersResponse) ProtoReflect() protoreflect.Message

func (*PeersResponse) Reset

func (x *PeersResponse) Reset()

func (*PeersResponse) String

func (x *PeersResponse) String() string

type RPC

type RPC struct {
	UnimplementedRPCServiceServer
	// contains filtered or unexported fields
}

RPC implements the rpc service.

func New

func New(m net.Module) *RPC

New creates a new rpc service.

func (*RPC) ConnectPeer

func (a *RPC) ConnectPeer(ctx context.Context, req *ConnectPeerRequest) (*ConnectPeerResponse, error)

ConnectPeer calls module.ConnectPeer.

func (*RPC) Connectedness

func (a *RPC) Connectedness(ctx context.Context, req *ConnectednessRequest) (*ConnectednessResponse, error)

Connectedness calls module.Connectedness.

func (*RPC) DisconnectPeer

func (a *RPC) DisconnectPeer(ctx context.Context, req *DisconnectPeerRequest) (*DisconnectPeerResponse, error)

DisconnectPeer calls module.DisconnectPeer.

func (*RPC) FindPeer

func (a *RPC) FindPeer(ctx context.Context, req *FindPeerRequest) (*FindPeerResponse, error)

FindPeer calls module.FindPeer.

func (*RPC) ListenAddr

func (a *RPC) ListenAddr(ctx context.Context, req *ListenAddrRequest) (*ListenAddrResponse, error)

ListenAddr calls module.ListenAddr.

func (*RPC) Peers

func (a *RPC) Peers(ctx context.Context, req *PeersRequest) (*PeersResponse, error)

Peers calls module.Peers.

type RPCServiceClient

type RPCServiceClient interface {
	ListenAddr(ctx context.Context, in *ListenAddrRequest, opts ...grpc.CallOption) (*ListenAddrResponse, error)
	Peers(ctx context.Context, in *PeersRequest, opts ...grpc.CallOption) (*PeersResponse, error)
	FindPeer(ctx context.Context, in *FindPeerRequest, opts ...grpc.CallOption) (*FindPeerResponse, error)
	ConnectPeer(ctx context.Context, in *ConnectPeerRequest, opts ...grpc.CallOption) (*ConnectPeerResponse, error)
	DisconnectPeer(ctx context.Context, in *DisconnectPeerRequest, opts ...grpc.CallOption) (*DisconnectPeerResponse, error)
	Connectedness(ctx context.Context, in *ConnectednessRequest, opts ...grpc.CallOption) (*ConnectednessResponse, error)
}

RPCServiceClient is the client API for RPCService service.

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

func NewRPCServiceClient

func NewRPCServiceClient(cc grpc.ClientConnInterface) RPCServiceClient

type RPCServiceServer

RPCServiceServer is the server API for RPCService service.

type UnimplementedRPCServiceServer

type UnimplementedRPCServiceServer struct {
}

UnimplementedRPCServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedRPCServiceServer) ConnectPeer

func (*UnimplementedRPCServiceServer) Connectedness

func (*UnimplementedRPCServiceServer) DisconnectPeer

func (*UnimplementedRPCServiceServer) FindPeer

func (*UnimplementedRPCServiceServer) ListenAddr

func (*UnimplementedRPCServiceServer) Peers

Jump to

Keyboard shortcuts

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