network

package
v3.10.13 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_network_network_proto protoreflect.FileDescriptor
View Source
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 NewNetworkEndpoints() []*api.Endpoint

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

Deprecated: Use Close.ProtoReflect.Descriptor instead.

func (*Close) GetNode

func (x *Close) GetNode() *Node

func (*Close) ProtoMessage

func (*Close) ProtoMessage()

func (*Close) ProtoReflect

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

func (*Close) Reset

func (x *Close) Reset()

func (*Close) String

func (x *Close) String() string

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

Deprecated: Use Connect.ProtoReflect.Descriptor instead.

func (*Connect) GetNode

func (x *Connect) GetNode() *Node

func (*Connect) ProtoMessage

func (*Connect) ProtoMessage()

func (*Connect) ProtoReflect

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

func (*Connect) Reset

func (x *Connect) Reset()

func (*Connect) String

func (x *Connect) String() string

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCount

func (x *Error) GetCount() uint32

func (*Error) GetMsg

func (x *Error) GetMsg() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

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

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

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

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetAddress

func (x *Node) GetAddress() string

func (*Node) GetId

func (x *Node) GetId() string

func (*Node) GetMetadata

func (x *Node) GetMetadata() map[string]string

func (*Node) GetNetwork

func (x *Node) GetNetwork() string

func (*Node) GetStatus

func (x *Node) GetStatus() *Status

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

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

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

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

Deprecated: Use Peer.ProtoReflect.Descriptor instead.

func (*Peer) GetNode

func (x *Peer) GetNode() *Node

func (*Peer) GetPeers

func (x *Peer) GetPeers() []*Peer

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) ProtoReflect

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

func (*Peer) Reset

func (x *Peer) Reset()

func (*Peer) String

func (x *Peer) String() string

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

Deprecated: Use Query.ProtoReflect.Descriptor instead.

func (*Query) GetAddress

func (x *Query) GetAddress() string

func (*Query) GetGateway

func (x *Query) GetGateway() string

func (*Query) GetNetwork

func (x *Query) GetNetwork() string

func (*Query) GetRouter

func (x *Query) GetRouter() string

func (*Query) GetService

func (x *Query) GetService() string

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) ProtoReflect

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

func (*Query) Reset

func (x *Query) Reset()

func (*Query) String

func (x *Query) String() string

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

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetError

func (x *Status) GetError() *Error

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

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

func (*Status) Reset

func (x *Status) Reset()

func (*Status) String

func (x *Status) String() string

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

Deprecated: Use Sync.ProtoReflect.Descriptor instead.

func (*Sync) GetPeer

func (x *Sync) GetPeer() *Peer

func (*Sync) GetRoutes

func (x *Sync) GetRoutes() []*router.Route

func (*Sync) ProtoMessage

func (*Sync) ProtoMessage()

func (*Sync) ProtoReflect

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

func (*Sync) Reset

func (x *Sync) Reset()

func (*Sync) String

func (x *Sync) String() string

type UnimplementedNetworkServer

type UnimplementedNetworkServer struct {
}

UnimplementedNetworkServer must be embedded to have forward compatible implementations.

func (UnimplementedNetworkServer) Connect

func (UnimplementedNetworkServer) Graph

func (UnimplementedNetworkServer) Nodes

func (UnimplementedNetworkServer) Routes

func (UnimplementedNetworkServer) Services

func (UnimplementedNetworkServer) Status

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.

Jump to

Keyboard shortcuts

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