Documentation ¶
Index ¶
- Variables
- func NewRouterEndpoints() []*api.Endpoint
- func NewTableEndpoints() []*api.Endpoint
- func RegisterRouterHandler(s server.Server, hdlr RouterHandler, opts ...server.HandlerOption) error
- func RegisterRouterServer(s grpc.ServiceRegistrar, srv RouterServer)
- func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.HandlerOption) error
- func RegisterTableServer(s grpc.ServiceRegistrar, srv TableServer)
- type CreateResponse
- type DeleteResponse
- type Event
- func (*Event) Descriptor() ([]byte, []int)deprecated
- func (x *Event) GetId() string
- func (x *Event) GetRoute() *Route
- func (x *Event) GetTimestamp() int64
- func (x *Event) GetType() EventType
- func (*Event) ProtoMessage()
- func (x *Event) ProtoReflect() protoreflect.Message
- func (x *Event) Reset()
- func (x *Event) String() string
- type EventType
- type LookupOptions
- func (*LookupOptions) Descriptor() ([]byte, []int)deprecated
- func (x *LookupOptions) GetAddress() string
- func (x *LookupOptions) GetGateway() string
- func (x *LookupOptions) GetLink() string
- func (x *LookupOptions) GetNetwork() string
- func (x *LookupOptions) GetRouter() string
- func (*LookupOptions) ProtoMessage()
- func (x *LookupOptions) ProtoReflect() protoreflect.Message
- func (x *LookupOptions) Reset()
- func (x *LookupOptions) String() string
- type LookupRequest
- func (*LookupRequest) Descriptor() ([]byte, []int)deprecated
- func (x *LookupRequest) GetOptions() *LookupOptions
- func (x *LookupRequest) GetService() string
- func (*LookupRequest) ProtoMessage()
- func (x *LookupRequest) ProtoReflect() protoreflect.Message
- func (x *LookupRequest) Reset()
- func (x *LookupRequest) String() string
- type LookupResponse
- type ReadRequest
- type ReadResponse
- type Route
- func (*Route) Descriptor() ([]byte, []int)deprecated
- func (x *Route) GetAddress() string
- func (x *Route) GetGateway() string
- func (x *Route) GetLink() string
- func (x *Route) GetMetadata() map[string]string
- func (x *Route) GetMetric() int64
- func (x *Route) GetNetwork() string
- func (x *Route) GetRouter() string
- func (x *Route) GetService() string
- func (*Route) ProtoMessage()
- func (x *Route) ProtoReflect() protoreflect.Message
- func (x *Route) Reset()
- func (x *Route) String() string
- type RouterClient
- type RouterHandler
- type RouterServer
- type RouterService
- type Router_WatchClient
- type Router_WatchServer
- type Router_WatchService
- type Router_WatchStream
- type TableClient
- type TableHandler
- type TableServer
- type TableService
- type UnimplementedRouterServer
- type UnimplementedTableServer
- func (UnimplementedTableServer) Create(context.Context, *Route) (*CreateResponse, error)
- func (UnimplementedTableServer) Delete(context.Context, *Route) (*DeleteResponse, error)
- func (UnimplementedTableServer) Read(context.Context, *ReadRequest) (*ReadResponse, error)
- func (UnimplementedTableServer) Update(context.Context, *Route) (*UpdateResponse, error)
- type UnsafeRouterServer
- type UnsafeTableServer
- type UpdateResponse
- type WatchRequest
Constants ¶
This section is empty.
Variables ¶
var ( EventType_name = map[int32]string{ 0: "Create", 1: "Delete", 2: "Update", } EventType_value = map[string]int32{ "Create": 0, "Delete": 1, "Update": 2, } )
Enum value maps for EventType.
var File_proto_router_router_proto protoreflect.FileDescriptor
var Router_ServiceDesc = grpc.ServiceDesc{ ServiceName: "router.Router", HandlerType: (*RouterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Lookup", Handler: _Router_Lookup_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Watch", Handler: _Router_Watch_Handler, ServerStreams: true, }, }, Metadata: "proto/router/router.proto", }
Router_ServiceDesc is the grpc.ServiceDesc for Router service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var Table_ServiceDesc = grpc.ServiceDesc{ ServiceName: "router.Table", HandlerType: (*TableServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", Handler: _Table_Create_Handler, }, { MethodName: "Delete", Handler: _Table_Delete_Handler, }, { MethodName: "Update", Handler: _Table_Update_Handler, }, { MethodName: "Read", Handler: _Table_Read_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/router/router.proto", }
Table_ServiceDesc is the grpc.ServiceDesc for Table service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func NewRouterEndpoints ¶
func NewTableEndpoints ¶
func RegisterRouterHandler ¶
func RegisterRouterHandler(s server.Server, hdlr RouterHandler, opts ...server.HandlerOption) error
func RegisterRouterServer ¶
func RegisterRouterServer(s grpc.ServiceRegistrar, srv RouterServer)
func RegisterTableHandler ¶
func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.HandlerOption) error
func RegisterTableServer ¶
func RegisterTableServer(s grpc.ServiceRegistrar, srv TableServer)
Types ¶
type CreateResponse ¶
type CreateResponse struct {
// contains filtered or unexported fields
}
CreateResponse is returned by Create
func (*CreateResponse) Descriptor
deprecated
func (*CreateResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.
func (*CreateResponse) ProtoMessage ¶
func (*CreateResponse) ProtoMessage()
func (*CreateResponse) ProtoReflect ¶
func (x *CreateResponse) ProtoReflect() protoreflect.Message
func (*CreateResponse) Reset ¶
func (x *CreateResponse) Reset()
func (*CreateResponse) String ¶
func (x *CreateResponse) String() string
type DeleteResponse ¶
type DeleteResponse struct {
// contains filtered or unexported fields
}
DeleteResponse is returned by Delete
func (*DeleteResponse) Descriptor
deprecated
func (*DeleteResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.
func (*DeleteResponse) ProtoMessage ¶
func (*DeleteResponse) ProtoMessage()
func (*DeleteResponse) ProtoReflect ¶
func (x *DeleteResponse) ProtoReflect() protoreflect.Message
func (*DeleteResponse) Reset ¶
func (x *DeleteResponse) Reset()
func (*DeleteResponse) String ¶
func (x *DeleteResponse) String() string
type Event ¶
type Event struct { // the unique event id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // type of event Type EventType `protobuf:"varint,2,opt,name=type,proto3,enum=router.EventType" json:"type,omitempty"` // unix timestamp of event Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // service route Route *Route `protobuf:"bytes,4,opt,name=route,proto3" json:"route,omitempty"` // contains filtered or unexported fields }
Event is routing table event
func (*Event) Descriptor
deprecated
func (*Event) GetTimestamp ¶
func (*Event) ProtoMessage ¶
func (*Event) ProtoMessage()
func (*Event) ProtoReflect ¶
func (x *Event) ProtoReflect() protoreflect.Message
type EventType ¶
type EventType int32
EventType defines the type of event
func (EventType) Descriptor ¶
func (EventType) Descriptor() protoreflect.EnumDescriptor
func (EventType) EnumDescriptor
deprecated
func (EventType) Number ¶
func (x EventType) Number() protoreflect.EnumNumber
func (EventType) Type ¶
func (EventType) Type() protoreflect.EnumType
type LookupOptions ¶
type LookupOptions struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Gateway string `protobuf:"bytes,2,opt,name=gateway,proto3" json:"gateway,omitempty"` Network string `protobuf:"bytes,3,opt,name=network,proto3" json:"network,omitempty"` Router string `protobuf:"bytes,4,opt,name=router,proto3" json:"router,omitempty"` Link string `protobuf:"bytes,5,opt,name=link,proto3" json:"link,omitempty"` // contains filtered or unexported fields }
LookupOptions are passed in a LookupRequest
func (*LookupOptions) Descriptor
deprecated
func (*LookupOptions) Descriptor() ([]byte, []int)
Deprecated: Use LookupOptions.ProtoReflect.Descriptor instead.
func (*LookupOptions) GetAddress ¶
func (x *LookupOptions) GetAddress() string
func (*LookupOptions) GetGateway ¶
func (x *LookupOptions) GetGateway() string
func (*LookupOptions) GetLink ¶
func (x *LookupOptions) GetLink() string
func (*LookupOptions) GetNetwork ¶
func (x *LookupOptions) GetNetwork() string
func (*LookupOptions) GetRouter ¶
func (x *LookupOptions) GetRouter() string
func (*LookupOptions) ProtoMessage ¶
func (*LookupOptions) ProtoMessage()
func (*LookupOptions) ProtoReflect ¶
func (x *LookupOptions) ProtoReflect() protoreflect.Message
func (*LookupOptions) Reset ¶
func (x *LookupOptions) Reset()
func (*LookupOptions) String ¶
func (x *LookupOptions) String() string
type LookupRequest ¶
type LookupRequest struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` Options *LookupOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` // contains filtered or unexported fields }
LookupRequest is made to Lookup
func (*LookupRequest) Descriptor
deprecated
func (*LookupRequest) Descriptor() ([]byte, []int)
Deprecated: Use LookupRequest.ProtoReflect.Descriptor instead.
func (*LookupRequest) GetOptions ¶
func (x *LookupRequest) GetOptions() *LookupOptions
func (*LookupRequest) GetService ¶
func (x *LookupRequest) GetService() string
func (*LookupRequest) ProtoMessage ¶
func (*LookupRequest) ProtoMessage()
func (*LookupRequest) ProtoReflect ¶
func (x *LookupRequest) ProtoReflect() protoreflect.Message
func (*LookupRequest) Reset ¶
func (x *LookupRequest) Reset()
func (*LookupRequest) String ¶
func (x *LookupRequest) String() string
type LookupResponse ¶
type LookupResponse struct { Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` // contains filtered or unexported fields }
LookupResponse is returned by Lookup
func (*LookupResponse) Descriptor
deprecated
func (*LookupResponse) Descriptor() ([]byte, []int)
Deprecated: Use LookupResponse.ProtoReflect.Descriptor instead.
func (*LookupResponse) GetRoutes ¶
func (x *LookupResponse) GetRoutes() []*Route
func (*LookupResponse) ProtoMessage ¶
func (*LookupResponse) ProtoMessage()
func (*LookupResponse) ProtoReflect ¶
func (x *LookupResponse) ProtoReflect() protoreflect.Message
func (*LookupResponse) Reset ¶
func (x *LookupResponse) Reset()
func (*LookupResponse) String ¶
func (x *LookupResponse) String() string
type ReadRequest ¶
type ReadRequest struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // contains filtered or unexported fields }
Empty request
func (*ReadRequest) Descriptor
deprecated
func (*ReadRequest) Descriptor() ([]byte, []int)
Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.
func (*ReadRequest) GetService ¶
func (x *ReadRequest) GetService() string
func (*ReadRequest) ProtoMessage ¶
func (*ReadRequest) ProtoMessage()
func (*ReadRequest) ProtoReflect ¶
func (x *ReadRequest) ProtoReflect() protoreflect.Message
func (*ReadRequest) Reset ¶
func (x *ReadRequest) Reset()
func (*ReadRequest) String ¶
func (x *ReadRequest) String() string
type ReadResponse ¶
type ReadResponse struct { Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` // contains filtered or unexported fields }
Empty response
func (*ReadResponse) Descriptor
deprecated
func (*ReadResponse) Descriptor() ([]byte, []int)
Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.
func (*ReadResponse) GetRoutes ¶
func (x *ReadResponse) GetRoutes() []*Route
func (*ReadResponse) ProtoMessage ¶
func (*ReadResponse) ProtoMessage()
func (*ReadResponse) ProtoReflect ¶
func (x *ReadResponse) ProtoReflect() protoreflect.Message
func (*ReadResponse) Reset ¶
func (x *ReadResponse) Reset()
func (*ReadResponse) String ¶
func (x *ReadResponse) String() string
type Route ¶
type Route struct { // service for the route Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // the address that advertise this route Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // gateway as the next hop Gateway string `protobuf:"bytes,3,opt,name=gateway,proto3" json:"gateway,omitempty"` // the network for this destination Network string `protobuf:"bytes,4,opt,name=network,proto3" json:"network,omitempty"` // router if the router id Router string `protobuf:"bytes,5,opt,name=router,proto3" json:"router,omitempty"` // the network link Link string `protobuf:"bytes,6,opt,name=link,proto3" json:"link,omitempty"` // the metric / score of this route Metric int64 `protobuf:"varint,7,opt,name=metric,proto3" json:"metric,omitempty"` // metadata for the route Metadata map[string]string `` /* 157-byte string literal not displayed */ // contains filtered or unexported fields }
Route is a service route
func (*Route) Descriptor
deprecated
func (*Route) GetAddress ¶
func (*Route) GetGateway ¶
func (*Route) GetMetadata ¶
func (*Route) GetNetwork ¶
func (*Route) GetService ¶
func (*Route) ProtoMessage ¶
func (*Route) ProtoMessage()
func (*Route) ProtoReflect ¶
func (x *Route) ProtoReflect() protoreflect.Message
type RouterClient ¶
type RouterClient interface { Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Router_WatchClient, error) }
RouterClient is the client API for Router 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 NewRouterClient ¶
func NewRouterClient(cc grpc.ClientConnInterface) RouterClient
type RouterHandler ¶
type RouterHandler interface { Lookup(context.Context, *LookupRequest, *LookupResponse) error Watch(context.Context, *WatchRequest, Router_WatchStream) error }
type RouterServer ¶
type RouterServer interface { Lookup(context.Context, *LookupRequest) (*LookupResponse, error) Watch(*WatchRequest, Router_WatchServer) error // contains filtered or unexported methods }
RouterServer is the server API for Router service. All implementations must embed UnimplementedRouterServer for forward compatibility
type RouterService ¶
type RouterService interface { Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Router_WatchService, error) }
func NewRouterService ¶
func NewRouterService(name string, c client.Client) RouterService
type Router_WatchClient ¶
type Router_WatchClient interface { Recv() (*Event, error) grpc.ClientStream }
type Router_WatchServer ¶
type Router_WatchServer interface { Send(*Event) error grpc.ServerStream }
type Router_WatchService ¶
type Router_WatchStream ¶
type TableClient ¶
type TableClient interface { Create(ctx context.Context, in *Route, opts ...grpc.CallOption) (*CreateResponse, error) Delete(ctx context.Context, in *Route, opts ...grpc.CallOption) (*DeleteResponse, error) Update(ctx context.Context, in *Route, opts ...grpc.CallOption) (*UpdateResponse, error) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) }
TableClient is the client API for Table 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 NewTableClient ¶
func NewTableClient(cc grpc.ClientConnInterface) TableClient
type TableHandler ¶
type TableHandler interface { Create(context.Context, *Route, *CreateResponse) error Delete(context.Context, *Route, *DeleteResponse) error Update(context.Context, *Route, *UpdateResponse) error Read(context.Context, *ReadRequest, *ReadResponse) error }
type TableServer ¶
type TableServer interface { Create(context.Context, *Route) (*CreateResponse, error) Delete(context.Context, *Route) (*DeleteResponse, error) Update(context.Context, *Route) (*UpdateResponse, error) Read(context.Context, *ReadRequest) (*ReadResponse, error) // contains filtered or unexported methods }
TableServer is the server API for Table service. All implementations must embed UnimplementedTableServer for forward compatibility
type TableService ¶
type TableService interface { Create(ctx context.Context, in *Route, opts ...client.CallOption) (*CreateResponse, error) Delete(ctx context.Context, in *Route, opts ...client.CallOption) (*DeleteResponse, error) Update(ctx context.Context, in *Route, opts ...client.CallOption) (*UpdateResponse, error) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) }
func NewTableService ¶
func NewTableService(name string, c client.Client) TableService
type UnimplementedRouterServer ¶
type UnimplementedRouterServer struct { }
UnimplementedRouterServer must be embedded to have forward compatible implementations.
func (UnimplementedRouterServer) Lookup ¶
func (UnimplementedRouterServer) Lookup(context.Context, *LookupRequest) (*LookupResponse, error)
func (UnimplementedRouterServer) Watch ¶
func (UnimplementedRouterServer) Watch(*WatchRequest, Router_WatchServer) error
type UnimplementedTableServer ¶
type UnimplementedTableServer struct { }
UnimplementedTableServer must be embedded to have forward compatible implementations.
func (UnimplementedTableServer) Create ¶
func (UnimplementedTableServer) Create(context.Context, *Route) (*CreateResponse, error)
func (UnimplementedTableServer) Delete ¶
func (UnimplementedTableServer) Delete(context.Context, *Route) (*DeleteResponse, error)
func (UnimplementedTableServer) Read ¶
func (UnimplementedTableServer) Read(context.Context, *ReadRequest) (*ReadResponse, error)
func (UnimplementedTableServer) Update ¶
func (UnimplementedTableServer) Update(context.Context, *Route) (*UpdateResponse, error)
type UnsafeRouterServer ¶ added in v3.10.4
type UnsafeRouterServer interface {
// contains filtered or unexported methods
}
UnsafeRouterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RouterServer will result in compilation errors.
type UnsafeTableServer ¶ added in v3.10.4
type UnsafeTableServer interface {
// contains filtered or unexported methods
}
UnsafeTableServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TableServer will result in compilation errors.
type UpdateResponse ¶
type UpdateResponse struct {
// contains filtered or unexported fields
}
UpdateResponse is returned by Update
func (*UpdateResponse) Descriptor
deprecated
func (*UpdateResponse) Descriptor() ([]byte, []int)
Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.
func (*UpdateResponse) ProtoMessage ¶
func (*UpdateResponse) ProtoMessage()
func (*UpdateResponse) ProtoReflect ¶
func (x *UpdateResponse) ProtoReflect() protoreflect.Message
func (*UpdateResponse) Reset ¶
func (x *UpdateResponse) Reset()
func (*UpdateResponse) String ¶
func (x *UpdateResponse) String() string
type WatchRequest ¶
type WatchRequest struct {
// contains filtered or unexported fields
}
WatchRequest is made to Watch Router
func (*WatchRequest) Descriptor
deprecated
func (*WatchRequest) Descriptor() ([]byte, []int)
Deprecated: Use WatchRequest.ProtoReflect.Descriptor instead.
func (*WatchRequest) ProtoMessage ¶
func (*WatchRequest) ProtoMessage()
func (*WatchRequest) ProtoReflect ¶
func (x *WatchRequest) ProtoReflect() protoreflect.Message
func (*WatchRequest) Reset ¶
func (x *WatchRequest) Reset()
func (*WatchRequest) String ¶
func (x *WatchRequest) String() string