Documentation ¶
Overview ¶
Package route is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterRouteServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterRouteServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RouteServiceClient) error
- func RegisterRouteServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterRouteServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RouteServiceServer) error
- func RegisterRouteServiceServer(s grpc.ServiceRegistrar, srv RouteServiceServer)
- type AddRouteRequest
- func (*AddRouteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddRouteRequest) GetHcDestIP() string
- func (x *AddRouteRequest) GetHcTunDestIP() string
- func (*AddRouteRequest) ProtoMessage()
- func (x *AddRouteRequest) ProtoReflect() protoreflect.Message
- func (x *AddRouteRequest) Reset()
- func (x *AddRouteRequest) String() string
- type GetStateResponse
- type RemoveRouteRequest
- func (*RemoveRouteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RemoveRouteRequest) GetHcDestIP() string
- func (x *RemoveRouteRequest) GetHcTunDestIP() string
- func (*RemoveRouteRequest) ProtoMessage()
- func (x *RemoveRouteRequest) ProtoReflect() protoreflect.Message
- func (x *RemoveRouteRequest) Reset()
- func (x *RemoveRouteRequest) String() string
- type Route
- func (*Route) Descriptor() ([]byte, []int)deprecated
- func (x *Route) GetDev() string
- func (x *Route) GetHcDestIP() string
- func (x *Route) GetHcTunDestIP() string
- func (x *Route) GetTable() string
- func (*Route) ProtoMessage()
- func (x *Route) ProtoReflect() protoreflect.Message
- func (x *Route) Reset()
- func (x *Route) String() string
- type RouteServiceClient
- type RouteServiceServer
- type UnimplementedRouteServiceServer
- func (UnimplementedRouteServiceServer) AddRoute(context.Context, *AddRouteRequest) (*emptypb.Empty, error)
- func (UnimplementedRouteServiceServer) GetState(context.Context, *emptypb.Empty) (*GetStateResponse, error)
- func (UnimplementedRouteServiceServer) RemoveRoute(context.Context, *RemoveRouteRequest) (*emptypb.Empty, error)
- type UnsafeRouteServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_route_route_proto protoreflect.FileDescriptor
var RouteService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "route.RouteService", HandlerType: (*RouteServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AddRoute", Handler: _RouteService_AddRoute_Handler, }, { MethodName: "RemoveRoute", Handler: _RouteService_RemoveRoute_Handler, }, { MethodName: "GetState", Handler: _RouteService_GetState_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "route/route.proto", }
RouteService_ServiceDesc is the grpc.ServiceDesc for RouteService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRouteServiceHandler ¶
func RegisterRouteServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterRouteServiceHandler registers the http handlers for service RouteService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterRouteServiceHandlerClient ¶
func RegisterRouteServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RouteServiceClient) error
RegisterRouteServiceHandlerClient registers the http handlers for service RouteService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RouteServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RouteServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "RouteServiceClient" to call the correct interceptors.
func RegisterRouteServiceHandlerFromEndpoint ¶
func RegisterRouteServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterRouteServiceHandlerFromEndpoint is same as RegisterRouteServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterRouteServiceHandlerServer ¶
func RegisterRouteServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RouteServiceServer) error
RegisterRouteServiceHandlerServer registers the http handlers for service RouteService to "mux". UnaryRPC :call RouteServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterRouteServiceHandlerFromEndpoint instead.
func RegisterRouteServiceServer ¶
func RegisterRouteServiceServer(s grpc.ServiceRegistrar, srv RouteServiceServer)
Types ¶
type AddRouteRequest ¶
type AddRouteRequest struct { HcDestIP string `protobuf:"bytes,1,opt,name=hcDestIP,proto3" json:"hcDestIP,omitempty"` HcTunDestIP string `protobuf:"bytes,2,opt,name=hcTunDestIP,proto3" json:"hcTunDestIP,omitempty"` // contains filtered or unexported fields }
AddRouteRequest добавить роут
func (*AddRouteRequest) Descriptor
deprecated
func (*AddRouteRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddRouteRequest.ProtoReflect.Descriptor instead.
func (*AddRouteRequest) GetHcDestIP ¶
func (x *AddRouteRequest) GetHcDestIP() string
func (*AddRouteRequest) GetHcTunDestIP ¶
func (x *AddRouteRequest) GetHcTunDestIP() string
func (*AddRouteRequest) ProtoMessage ¶
func (*AddRouteRequest) ProtoMessage()
func (*AddRouteRequest) ProtoReflect ¶
func (x *AddRouteRequest) ProtoReflect() protoreflect.Message
func (*AddRouteRequest) Reset ¶
func (x *AddRouteRequest) Reset()
func (*AddRouteRequest) String ¶
func (x *AddRouteRequest) String() string
type GetStateResponse ¶
type GetStateResponse struct { //routes список роутов Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` // contains filtered or unexported fields }
GetStateResponse выдаем все роуты
func (*GetStateResponse) Descriptor
deprecated
func (*GetStateResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetStateResponse.ProtoReflect.Descriptor instead.
func (*GetStateResponse) GetRoutes ¶
func (x *GetStateResponse) GetRoutes() []*Route
func (*GetStateResponse) ProtoMessage ¶
func (*GetStateResponse) ProtoMessage()
func (*GetStateResponse) ProtoReflect ¶
func (x *GetStateResponse) ProtoReflect() protoreflect.Message
func (*GetStateResponse) Reset ¶
func (x *GetStateResponse) Reset()
func (*GetStateResponse) String ¶
func (x *GetStateResponse) String() string
type RemoveRouteRequest ¶
type RemoveRouteRequest struct { HcDestIP string `protobuf:"bytes,1,opt,name=hcDestIP,proto3" json:"hcDestIP,omitempty"` HcTunDestIP string `protobuf:"bytes,2,opt,name=hcTunDestIP,proto3" json:"hcTunDestIP,omitempty"` // contains filtered or unexported fields }
AddRouteRequest добавить роут
func (*RemoveRouteRequest) Descriptor
deprecated
func (*RemoveRouteRequest) Descriptor() ([]byte, []int)
Deprecated: Use RemoveRouteRequest.ProtoReflect.Descriptor instead.
func (*RemoveRouteRequest) GetHcDestIP ¶
func (x *RemoveRouteRequest) GetHcDestIP() string
func (*RemoveRouteRequest) GetHcTunDestIP ¶
func (x *RemoveRouteRequest) GetHcTunDestIP() string
func (*RemoveRouteRequest) ProtoMessage ¶
func (*RemoveRouteRequest) ProtoMessage()
func (*RemoveRouteRequest) ProtoReflect ¶
func (x *RemoveRouteRequest) ProtoReflect() protoreflect.Message
func (*RemoveRouteRequest) Reset ¶
func (x *RemoveRouteRequest) Reset()
func (*RemoveRouteRequest) String ¶
func (x *RemoveRouteRequest) String() string
type Route ¶
type Route struct { HcDestIP string `protobuf:"bytes,1,opt,name=hcDestIP,proto3" json:"hcDestIP,omitempty"` HcTunDestIP string `protobuf:"bytes,2,opt,name=hcTunDestIP,proto3" json:"hcTunDestIP,omitempty"` //dev net-link device Dev string `protobuf:"bytes,3,opt,name=dev,proto3" json:"dev,omitempty"` //table route table Table string `protobuf:"bytes,4,opt,name=table,proto3" json:"table,omitempty"` // contains filtered or unexported fields }
Route IP route
func (*Route) Descriptor
deprecated
func (*Route) GetHcDestIP ¶
func (*Route) GetHcTunDestIP ¶
func (*Route) ProtoMessage ¶
func (*Route) ProtoMessage()
func (*Route) ProtoReflect ¶
func (x *Route) ProtoReflect() protoreflect.Message
type RouteServiceClient ¶
type RouteServiceClient interface { //AddRoute добавить роут AddRoute(ctx context.Context, in *AddRouteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) //RemoveRoute удалить роут RemoveRoute(ctx context.Context, in *RemoveRouteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) //GetState вернуть все роуты GetState(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetStateResponse, error) }
RouteServiceClient is the client API for RouteService 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 NewRouteServiceClient ¶
func NewRouteServiceClient(cc grpc.ClientConnInterface) RouteServiceClient
type RouteServiceServer ¶
type RouteServiceServer interface { //AddRoute добавить роут AddRoute(context.Context, *AddRouteRequest) (*emptypb.Empty, error) //RemoveRoute удалить роут RemoveRoute(context.Context, *RemoveRouteRequest) (*emptypb.Empty, error) //GetState вернуть все роуты GetState(context.Context, *emptypb.Empty) (*GetStateResponse, error) // contains filtered or unexported methods }
RouteServiceServer is the server API for RouteService service. All implementations must embed UnimplementedRouteServiceServer for forward compatibility
type UnimplementedRouteServiceServer ¶
type UnimplementedRouteServiceServer struct { }
UnimplementedRouteServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedRouteServiceServer) AddRoute ¶
func (UnimplementedRouteServiceServer) AddRoute(context.Context, *AddRouteRequest) (*emptypb.Empty, error)
func (UnimplementedRouteServiceServer) GetState ¶
func (UnimplementedRouteServiceServer) GetState(context.Context, *emptypb.Empty) (*GetStateResponse, error)
func (UnimplementedRouteServiceServer) RemoveRoute ¶
func (UnimplementedRouteServiceServer) RemoveRoute(context.Context, *RemoveRouteRequest) (*emptypb.Empty, error)
type UnsafeRouteServiceServer ¶
type UnsafeRouteServiceServer interface {
// contains filtered or unexported methods
}
UnsafeRouteServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RouteServiceServer will result in compilation errors.