2019-08-28 20:11:19 +01:00
|
|
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
|
|
// source: network.proto
|
|
|
|
|
|
|
|
package go_micro_network
|
|
|
|
|
|
|
|
import (
|
|
|
|
fmt "fmt"
|
|
|
|
proto "github.com/golang/protobuf/proto"
|
2019-08-30 12:29:26 +01:00
|
|
|
proto1 "github.com/micro/go-micro/router/proto"
|
2019-08-28 20:11:19 +01:00
|
|
|
math "math"
|
|
|
|
)
|
|
|
|
|
2019-08-30 12:29:26 +01:00
|
|
|
import (
|
|
|
|
context "context"
|
|
|
|
client "github.com/micro/go-micro/client"
|
|
|
|
server "github.com/micro/go-micro/server"
|
|
|
|
)
|
|
|
|
|
2019-08-28 20:11:19 +01:00
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ = proto.Marshal
|
|
|
|
var _ = fmt.Errorf
|
|
|
|
var _ = math.Inf
|
|
|
|
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
|
|
// is compatible with the proto package it is being compiled against.
|
|
|
|
// A compilation error at this line likely means your copy of the
|
|
|
|
// proto package needs to be updated.
|
|
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
2019-08-30 12:29:26 +01:00
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ context.Context
|
|
|
|
var _ client.Option
|
|
|
|
var _ server.Option
|
|
|
|
|
|
|
|
// Client API for Network service
|
|
|
|
|
|
|
|
type NetworkService interface {
|
2019-09-10 01:14:23 +01:00
|
|
|
ListPeers(ctx context.Context, in *PeerRequest, opts ...client.CallOption) (*PeerResponse, error)
|
2019-09-09 18:47:10 +01:00
|
|
|
ListRoutes(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.ListResponse, error)
|
2019-08-30 12:29:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type networkService struct {
|
|
|
|
c client.Client
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewNetworkService(name string, c client.Client) NetworkService {
|
|
|
|
if c == nil {
|
|
|
|
c = client.NewClient()
|
|
|
|
}
|
|
|
|
if len(name) == 0 {
|
|
|
|
name = "go.micro.network"
|
|
|
|
}
|
|
|
|
return &networkService{
|
|
|
|
c: c,
|
|
|
|
name: name,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-10 01:14:23 +01:00
|
|
|
func (c *networkService) ListPeers(ctx context.Context, in *PeerRequest, opts ...client.CallOption) (*PeerResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Network.ListPeers", in)
|
|
|
|
out := new(PeerResponse)
|
2019-08-30 12:29:26 +01:00
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2019-09-09 18:47:10 +01:00
|
|
|
func (c *networkService) ListRoutes(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.ListResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Network.ListRoutes", in)
|
|
|
|
out := new(proto1.ListResponse)
|
2019-08-30 12:29:26 +01:00
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Server API for Network service
|
|
|
|
|
|
|
|
type NetworkHandler interface {
|
2019-09-10 01:14:23 +01:00
|
|
|
ListPeers(context.Context, *PeerRequest, *PeerResponse) error
|
2019-09-09 18:47:10 +01:00
|
|
|
ListRoutes(context.Context, *proto1.Request, *proto1.ListResponse) error
|
2019-08-30 12:29:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterNetworkHandler(s server.Server, hdlr NetworkHandler, opts ...server.HandlerOption) error {
|
|
|
|
type network interface {
|
2019-09-10 01:14:23 +01:00
|
|
|
ListPeers(ctx context.Context, in *PeerRequest, out *PeerResponse) error
|
2019-09-09 18:47:10 +01:00
|
|
|
ListRoutes(ctx context.Context, in *proto1.Request, out *proto1.ListResponse) error
|
2019-08-30 12:29:26 +01:00
|
|
|
}
|
|
|
|
type Network struct {
|
|
|
|
network
|
|
|
|
}
|
|
|
|
h := &networkHandler{hdlr}
|
|
|
|
return s.Handle(s.NewHandler(&Network{h}, opts...))
|
|
|
|
}
|
|
|
|
|
|
|
|
type networkHandler struct {
|
|
|
|
NetworkHandler
|
|
|
|
}
|
|
|
|
|
2019-09-10 01:14:23 +01:00
|
|
|
func (h *networkHandler) ListPeers(ctx context.Context, in *PeerRequest, out *PeerResponse) error {
|
|
|
|
return h.NetworkHandler.ListPeers(ctx, in, out)
|
2019-08-30 12:29:26 +01:00
|
|
|
}
|
2019-09-09 18:47:10 +01:00
|
|
|
|
|
|
|
func (h *networkHandler) ListRoutes(ctx context.Context, in *proto1.Request, out *proto1.ListResponse) error {
|
|
|
|
return h.NetworkHandler.ListRoutes(ctx, in, out)
|
|
|
|
}
|