Documentation ¶
Index ¶
- Variables
- func NewNetworkEndpoints() []*api.Endpoint
- func RegisterNetworkHandler(s server.Server, hdlr NetworkHandler, opts ...server.HandlerOption) error
- func RegisterNetworkServer(s grpc.ServiceRegistrar, srv NetworkServer)
- type Close
- type Connect
- type ConnectRequest
- type ConnectResponse
- type Error
- type GraphRequest
- type GraphResponse
- type NetworkClient
- type NetworkHandler
- type NetworkServer
- type NetworkService
- type Node
- func (*Node) Descriptor() ([]byte, []int)deprecated
- func (x *Node) GetAddress() string
- func (x *Node) GetId() string
- func (x *Node) GetMetadata() map[string]string
- func (x *Node) GetNetwork() string
- func (x *Node) GetStatus() *Status
- func (*Node) ProtoMessage()
- func (x *Node) ProtoReflect() protoreflect.Message
- func (x *Node) Reset()
- func (x *Node) String() string
- type NodesRequest
- type NodesResponse
- type Peer
- type Query
- func (*Query) Descriptor() ([]byte, []int)deprecated
- func (x *Query) GetAddress() string
- func (x *Query) GetGateway() string
- func (x *Query) GetNetwork() string
- func (x *Query) GetRouter() string
- func (x *Query) GetService() string
- func (*Query) ProtoMessage()
- func (x *Query) ProtoReflect() protoreflect.Message
- func (x *Query) Reset()
- func (x *Query) String() string
- type RoutesRequest
- type RoutesResponse
- type ServicesRequest
- type ServicesResponse
- type Status
- type StatusRequest
- type StatusResponse
- type Sync
- type UnimplementedNetworkServer
- func (UnimplementedNetworkServer) Connect(context.Context, *ConnectRequest) (*ConnectResponse, error)
- func (UnimplementedNetworkServer) Graph(context.Context, *GraphRequest) (*GraphResponse, error)
- func (UnimplementedNetworkServer) Nodes(context.Context, *NodesRequest) (*NodesResponse, error)
- func (UnimplementedNetworkServer) Routes(context.Context, *RoutesRequest) (*RoutesResponse, error)
- func (UnimplementedNetworkServer) Services(context.Context, *ServicesRequest) (*ServicesResponse, error)
- func (UnimplementedNetworkServer) Status(context.Context, *StatusRequest) (*StatusResponse, error)
- type UnsafeNetworkServer
Constants ¶
This section is empty.
Variables ¶
var File_proto_network_network_proto protoreflect.FileDescriptor
var Network_ServiceDesc = grpc.ServiceDesc{ ServiceName: "network.Network", HandlerType: (*NetworkServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Connect", Handler: _Network_Connect_Handler, }, { MethodName: "Graph", Handler: _Network_Graph_Handler, }, { MethodName: "Nodes", Handler: _Network_Nodes_Handler, }, { MethodName: "Routes", Handler: _Network_Routes_Handler, }, { MethodName: "Services", Handler: _Network_Services_Handler, }, { MethodName: "Status", Handler: _Network_Status_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/network/network.proto", }
Network_ServiceDesc is the grpc.ServiceDesc for Network service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func NewNetworkEndpoints ¶
func RegisterNetworkHandler ¶
func RegisterNetworkHandler(s server.Server, hdlr NetworkHandler, opts ...server.HandlerOption) error
func RegisterNetworkServer ¶
func RegisterNetworkServer(s grpc.ServiceRegistrar, srv NetworkServer)
Types ¶
type Close ¶
type Close struct { // network node Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` // contains filtered or unexported fields }
Close is sent when the node disconnects from the network
func (*Close) Descriptor
deprecated
func (*Close) ProtoMessage ¶
func (*Close) ProtoMessage()
func (*Close) ProtoReflect ¶
func (x *Close) ProtoReflect() protoreflect.Message
type Connect ¶
type Connect struct { // network mode Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` // contains filtered or unexported fields }
Connect is sent when the node connects to the network
func (*Connect) Descriptor
deprecated
func (*Connect) ProtoMessage ¶
func (*Connect) ProtoMessage()
func (*Connect) ProtoReflect ¶
func (x *Connect) ProtoReflect() protoreflect.Message
type ConnectRequest ¶
type ConnectRequest struct { Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` // contains filtered or unexported fields }
func (*ConnectRequest) Descriptor
deprecated
func (*ConnectRequest) Descriptor() ([]byte, []int)
Deprecated: Use ConnectRequest.ProtoReflect.Descriptor instead.
func (*ConnectRequest) GetNodes ¶
func (x *ConnectRequest) GetNodes() []*Node
func (*ConnectRequest) ProtoMessage ¶
func (*ConnectRequest) ProtoMessage()
func (*ConnectRequest) ProtoReflect ¶
func (x *ConnectRequest) ProtoReflect() protoreflect.Message
func (*ConnectRequest) Reset ¶
func (x *ConnectRequest) Reset()
func (*ConnectRequest) String ¶
func (x *ConnectRequest) String() string
type ConnectResponse ¶
type ConnectResponse struct {
// contains filtered or unexported fields
}
func (*ConnectResponse) Descriptor
deprecated
func (*ConnectResponse) Descriptor() ([]byte, []int)
Deprecated: Use ConnectResponse.ProtoReflect.Descriptor instead.
func (*ConnectResponse) ProtoMessage ¶
func (*ConnectResponse) ProtoMessage()
func (*ConnectResponse) ProtoReflect ¶
func (x *ConnectResponse) ProtoReflect() protoreflect.Message
func (*ConnectResponse) Reset ¶
func (x *ConnectResponse) Reset()
func (*ConnectResponse) String ¶
func (x *ConnectResponse) String() string
type Error ¶
type Error struct { Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` // contains filtered or unexported fields }
Error tracks network errors
func (*Error) Descriptor
deprecated
func (*Error) ProtoMessage ¶
func (*Error) ProtoMessage()
func (*Error) ProtoReflect ¶
func (x *Error) ProtoReflect() protoreflect.Message
type GraphRequest ¶
type GraphRequest struct { // node topology depth Depth uint32 `protobuf:"varint,1,opt,name=depth,proto3" json:"depth,omitempty"` // contains filtered or unexported fields }
func (*GraphRequest) Descriptor
deprecated
func (*GraphRequest) Descriptor() ([]byte, []int)
Deprecated: Use GraphRequest.ProtoReflect.Descriptor instead.
func (*GraphRequest) GetDepth ¶
func (x *GraphRequest) GetDepth() uint32
func (*GraphRequest) ProtoMessage ¶
func (*GraphRequest) ProtoMessage()
func (*GraphRequest) ProtoReflect ¶
func (x *GraphRequest) ProtoReflect() protoreflect.Message
func (*GraphRequest) Reset ¶
func (x *GraphRequest) Reset()
func (*GraphRequest) String ¶
func (x *GraphRequest) String() string
type GraphResponse ¶
type GraphResponse struct { Root *Peer `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty"` // contains filtered or unexported fields }
func (*GraphResponse) Descriptor
deprecated
func (*GraphResponse) Descriptor() ([]byte, []int)
Deprecated: Use GraphResponse.ProtoReflect.Descriptor instead.
func (*GraphResponse) GetRoot ¶
func (x *GraphResponse) GetRoot() *Peer
func (*GraphResponse) ProtoMessage ¶
func (*GraphResponse) ProtoMessage()
func (*GraphResponse) ProtoReflect ¶
func (x *GraphResponse) ProtoReflect() protoreflect.Message
func (*GraphResponse) Reset ¶
func (x *GraphResponse) Reset()
func (*GraphResponse) String ¶
func (x *GraphResponse) String() string
type NetworkClient ¶
type NetworkClient interface { // Connect to the network Connect(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (*ConnectResponse, error) // Returns the entire network graph Graph(ctx context.Context, in *GraphRequest, opts ...grpc.CallOption) (*GraphResponse, error) // Returns a list of known nodes in the network Nodes(ctx context.Context, in *NodesRequest, opts ...grpc.CallOption) (*NodesResponse, error) // Returns a list of known routes in the network Routes(ctx context.Context, in *RoutesRequest, opts ...grpc.CallOption) (*RoutesResponse, error) // Returns a list of known services based on routes Services(ctx context.Context, in *ServicesRequest, opts ...grpc.CallOption) (*ServicesResponse, error) // Status returns network status Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) }
NetworkClient is the client API for Network service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewNetworkClient ¶
func NewNetworkClient(cc grpc.ClientConnInterface) NetworkClient
type NetworkHandler ¶
type NetworkHandler interface { // Connect to the network Connect(context.Context, *ConnectRequest, *ConnectResponse) error // Returns the entire network graph Graph(context.Context, *GraphRequest, *GraphResponse) error // Returns a list of known nodes in the network Nodes(context.Context, *NodesRequest, *NodesResponse) error // Returns a list of known routes in the network Routes(context.Context, *RoutesRequest, *RoutesResponse) error // Returns a list of known services based on routes Services(context.Context, *ServicesRequest, *ServicesResponse) error // Status returns network status Status(context.Context, *StatusRequest, *StatusResponse) error }
type NetworkServer ¶
type NetworkServer interface { // Connect to the network Connect(context.Context, *ConnectRequest) (*ConnectResponse, error) // Returns the entire network graph Graph(context.Context, *GraphRequest) (*GraphResponse, error) // Returns a list of known nodes in the network Nodes(context.Context, *NodesRequest) (*NodesResponse, error) // Returns a list of known routes in the network Routes(context.Context, *RoutesRequest) (*RoutesResponse, error) // Returns a list of known services based on routes Services(context.Context, *ServicesRequest) (*ServicesResponse, error) // Status returns network status Status(context.Context, *StatusRequest) (*StatusResponse, error) // contains filtered or unexported methods }
NetworkServer is the server API for Network service. All implementations must embed UnimplementedNetworkServer for forward compatibility
type NetworkService ¶
type NetworkService interface { // Connect to the network Connect(ctx context.Context, in *ConnectRequest, opts ...client.CallOption) (*ConnectResponse, error) // Returns the entire network graph Graph(ctx context.Context, in *GraphRequest, opts ...client.CallOption) (*GraphResponse, error) // Returns a list of known nodes in the network Nodes(ctx context.Context, in *NodesRequest, opts ...client.CallOption) (*NodesResponse, error) // Returns a list of known routes in the network Routes(ctx context.Context, in *RoutesRequest, opts ...client.CallOption) (*RoutesResponse, error) // Returns a list of known services based on routes Services(ctx context.Context, in *ServicesRequest, opts ...client.CallOption) (*ServicesResponse, error) // Status returns network status Status(ctx context.Context, in *StatusRequest, opts ...client.CallOption) (*StatusResponse, error) }
func NewNetworkService ¶
func NewNetworkService(name string, c client.Client) NetworkService
type Node ¶
type Node struct { // node id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // node address Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // the network Network string `protobuf:"bytes,3,opt,name=network,proto3" json:"network,omitempty"` // associated metadata Metadata map[string]string `` /* 157-byte string literal not displayed */ // node status Status *Status `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
Node is network node
func (*Node) Descriptor
deprecated
func (*Node) GetAddress ¶
func (*Node) GetMetadata ¶
func (*Node) GetNetwork ¶
func (*Node) ProtoMessage ¶
func (*Node) ProtoMessage()
func (*Node) ProtoReflect ¶
func (x *Node) ProtoReflect() protoreflect.Message
type NodesRequest ¶
type NodesRequest struct { // node topology depth Depth uint32 `protobuf:"varint,1,opt,name=depth,proto3" json:"depth,omitempty"` // contains filtered or unexported fields }
PeerRequest requests list of peers
func (*NodesRequest) Descriptor
deprecated
func (*NodesRequest) Descriptor() ([]byte, []int)
Deprecated: Use NodesRequest.ProtoReflect.Descriptor instead.
func (*NodesRequest) GetDepth ¶
func (x *NodesRequest) GetDepth() uint32
func (*NodesRequest) ProtoMessage ¶
func (*NodesRequest) ProtoMessage()
func (*NodesRequest) ProtoReflect ¶
func (x *NodesRequest) ProtoReflect() protoreflect.Message
func (*NodesRequest) Reset ¶
func (x *NodesRequest) Reset()
func (*NodesRequest) String ¶
func (x *NodesRequest) String() string
type NodesResponse ¶
type NodesResponse struct { // return peer topology Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` // contains filtered or unexported fields }
PeerResponse is returned by ListPeers
func (*NodesResponse) Descriptor
deprecated
func (*NodesResponse) Descriptor() ([]byte, []int)
Deprecated: Use NodesResponse.ProtoReflect.Descriptor instead.
func (*NodesResponse) GetNodes ¶
func (x *NodesResponse) GetNodes() []*Node
func (*NodesResponse) ProtoMessage ¶
func (*NodesResponse) ProtoMessage()
func (*NodesResponse) ProtoReflect ¶
func (x *NodesResponse) ProtoReflect() protoreflect.Message
func (*NodesResponse) Reset ¶
func (x *NodesResponse) Reset()
func (*NodesResponse) String ¶
func (x *NodesResponse) String() string
type Peer ¶
type Peer struct { // network node Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` // node peers Peers []*Peer `protobuf:"bytes,2,rep,name=peers,proto3" json:"peers,omitempty"` // contains filtered or unexported fields }
Peer is used to advertise node peers
func (*Peer) Descriptor
deprecated
func (*Peer) ProtoMessage ¶
func (*Peer) ProtoMessage()
func (*Peer) ProtoReflect ¶
func (x *Peer) ProtoReflect() protoreflect.Message
type Query ¶
type Query struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` Gateway string `protobuf:"bytes,3,opt,name=gateway,proto3" json:"gateway,omitempty"` Router string `protobuf:"bytes,4,opt,name=router,proto3" json:"router,omitempty"` Network string `protobuf:"bytes,5,opt,name=network,proto3" json:"network,omitempty"` // contains filtered or unexported fields }
Query is passed in a LookupRequest
func (*Query) Descriptor
deprecated
func (*Query) GetAddress ¶
func (*Query) GetGateway ¶
func (*Query) GetNetwork ¶
func (*Query) GetService ¶
func (*Query) ProtoMessage ¶
func (*Query) ProtoMessage()
func (*Query) ProtoReflect ¶
func (x *Query) ProtoReflect() protoreflect.Message
type RoutesRequest ¶
type RoutesRequest struct { // filter based on Query *Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` // contains filtered or unexported fields }
func (*RoutesRequest) Descriptor
deprecated
func (*RoutesRequest) Descriptor() ([]byte, []int)
Deprecated: Use RoutesRequest.ProtoReflect.Descriptor instead.
func (*RoutesRequest) GetQuery ¶
func (x *RoutesRequest) GetQuery() *Query
func (*RoutesRequest) ProtoMessage ¶
func (*RoutesRequest) ProtoMessage()
func (*RoutesRequest) ProtoReflect ¶
func (x *RoutesRequest) ProtoReflect() protoreflect.Message
func (*RoutesRequest) Reset ¶
func (x *RoutesRequest) Reset()
func (*RoutesRequest) String ¶
func (x *RoutesRequest) String() string
type RoutesResponse ¶
type RoutesResponse struct { Routes []*router.Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` // contains filtered or unexported fields }
func (*RoutesResponse) Descriptor
deprecated
func (*RoutesResponse) Descriptor() ([]byte, []int)
Deprecated: Use RoutesResponse.ProtoReflect.Descriptor instead.
func (*RoutesResponse) GetRoutes ¶
func (x *RoutesResponse) GetRoutes() []*router.Route
func (*RoutesResponse) ProtoMessage ¶
func (*RoutesResponse) ProtoMessage()
func (*RoutesResponse) ProtoReflect ¶
func (x *RoutesResponse) ProtoReflect() protoreflect.Message
func (*RoutesResponse) Reset ¶
func (x *RoutesResponse) Reset()
func (*RoutesResponse) String ¶
func (x *RoutesResponse) String() string
type ServicesRequest ¶
type ServicesRequest struct {
// contains filtered or unexported fields
}
func (*ServicesRequest) Descriptor
deprecated
func (*ServicesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ServicesRequest.ProtoReflect.Descriptor instead.
func (*ServicesRequest) ProtoMessage ¶
func (*ServicesRequest) ProtoMessage()
func (*ServicesRequest) ProtoReflect ¶
func (x *ServicesRequest) ProtoReflect() protoreflect.Message
func (*ServicesRequest) Reset ¶
func (x *ServicesRequest) Reset()
func (*ServicesRequest) String ¶
func (x *ServicesRequest) String() string
type ServicesResponse ¶
type ServicesResponse struct { Services []string `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` // contains filtered or unexported fields }
func (*ServicesResponse) Descriptor
deprecated
func (*ServicesResponse) Descriptor() ([]byte, []int)
Deprecated: Use ServicesResponse.ProtoReflect.Descriptor instead.
func (*ServicesResponse) GetServices ¶
func (x *ServicesResponse) GetServices() []string
func (*ServicesResponse) ProtoMessage ¶
func (*ServicesResponse) ProtoMessage()
func (*ServicesResponse) ProtoReflect ¶
func (x *ServicesResponse) ProtoReflect() protoreflect.Message
func (*ServicesResponse) Reset ¶
func (x *ServicesResponse) Reset()
func (*ServicesResponse) String ¶
func (x *ServicesResponse) String() string
type Status ¶
type Status struct { Error *Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` // contains filtered or unexported fields }
Status is node status
func (*Status) Descriptor
deprecated
func (*Status) ProtoMessage ¶
func (*Status) ProtoMessage()
func (*Status) ProtoReflect ¶
func (x *Status) ProtoReflect() protoreflect.Message
type StatusRequest ¶
type StatusRequest struct {
// contains filtered or unexported fields
}
func (*StatusRequest) Descriptor
deprecated
func (*StatusRequest) Descriptor() ([]byte, []int)
Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.
func (*StatusRequest) ProtoMessage ¶
func (*StatusRequest) ProtoMessage()
func (*StatusRequest) ProtoReflect ¶
func (x *StatusRequest) ProtoReflect() protoreflect.Message
func (*StatusRequest) Reset ¶
func (x *StatusRequest) Reset()
func (*StatusRequest) String ¶
func (x *StatusRequest) String() string
type StatusResponse ¶
type StatusResponse struct { Status *Status `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*StatusResponse) Descriptor
deprecated
func (*StatusResponse) Descriptor() ([]byte, []int)
Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.
func (*StatusResponse) GetStatus ¶
func (x *StatusResponse) GetStatus() *Status
func (*StatusResponse) ProtoMessage ¶
func (*StatusResponse) ProtoMessage()
func (*StatusResponse) ProtoReflect ¶
func (x *StatusResponse) ProtoReflect() protoreflect.Message
func (*StatusResponse) Reset ¶
func (x *StatusResponse) Reset()
func (*StatusResponse) String ¶
func (x *StatusResponse) String() string
type Sync ¶
type Sync struct { // peer origin Peer *Peer `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"` // node routes Routes []*router.Route `protobuf:"bytes,2,rep,name=routes,proto3" json:"routes,omitempty"` // contains filtered or unexported fields }
Sync is network sync message
func (*Sync) Descriptor
deprecated
func (*Sync) ProtoMessage ¶
func (*Sync) ProtoMessage()
func (*Sync) ProtoReflect ¶
func (x *Sync) ProtoReflect() protoreflect.Message
type UnimplementedNetworkServer ¶
type UnimplementedNetworkServer struct { }
UnimplementedNetworkServer must be embedded to have forward compatible implementations.
func (UnimplementedNetworkServer) Connect ¶
func (UnimplementedNetworkServer) Connect(context.Context, *ConnectRequest) (*ConnectResponse, error)
func (UnimplementedNetworkServer) Graph ¶
func (UnimplementedNetworkServer) Graph(context.Context, *GraphRequest) (*GraphResponse, error)
func (UnimplementedNetworkServer) Nodes ¶
func (UnimplementedNetworkServer) Nodes(context.Context, *NodesRequest) (*NodesResponse, error)
func (UnimplementedNetworkServer) Routes ¶
func (UnimplementedNetworkServer) Routes(context.Context, *RoutesRequest) (*RoutesResponse, error)
func (UnimplementedNetworkServer) Services ¶
func (UnimplementedNetworkServer) Services(context.Context, *ServicesRequest) (*ServicesResponse, error)
func (UnimplementedNetworkServer) Status ¶
func (UnimplementedNetworkServer) Status(context.Context, *StatusRequest) (*StatusResponse, error)
type UnsafeNetworkServer ¶ added in v3.10.4
type UnsafeNetworkServer interface {
// contains filtered or unexported methods
}
UnsafeNetworkServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NetworkServer will result in compilation errors.