gatewayrpc

package module
v0.0.0-...-3a625a3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: MIT Imports: 10 Imported by: 1

README

gatewayrpc

GoDoc

A package which wraps a gorilla/rpc/v2 server, adding an endpoint (RPC.GetServices) which automatically returns a data representation of all methods and their signatures.

This package also contains a sub-package gateway, which can be used to create a simple rpc server which forwards requests to other rpc servers.

Documentation

Overview

Package gatewayrpc is a wrapper around a gorilla/rpc/v2 server which registers a special endpoint, "RPC.GetServices", which returns a structure containing a description of all services and their methods the rpc server supports and their type signatures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetServicesRes

type GetServicesRes struct {
	Services []gatewaytypes.Service `json:"services"`
}

GetServicesRes describes the structure returned from the GetServices api call

type Server

type Server struct {
	*rpc.Server
	// contains filtered or unexported fields
}

Server is a simple wrapper around the normal gorilla/rpc/v2 server, adding a couple extra features

func NewServer

func NewServer() *Server

NewServer returns a new Server struct initialized with a gorilla/rpc/v2 server

func (*Server) GetServices

func (s *Server) GetServices(r *http.Request, _ *struct{}, res *GetServicesRes) error

GetServices is the actual rpc method which returns the set of services and their methods which are supported

func (*Server) RegisterHiddenService

func (s *Server) RegisterHiddenService(receiver interface{}, name string) error

RegisterHiddenService passes its arguments through to the underlying gorilla/rpc/v2 server, but unlike RegisterService does NOT add the receiver's method data to the Server's cache, so the receiver won't show up in calls to GetMethods

func (*Server) RegisterService

func (s *Server) RegisterService(receiver interface{}, name string) error

RegisterService passes its arguments through to the underlying gorilla/rpc/v2 server, as well as adds the given receiver's rpc methods to the Server's cache of method data which will be returned by the "RPC.GetMethods" endpoint.

Directories

Path Synopsis
Package gateway implements the actual gateway which will listen for requests and forward them to servers wrapped by gatewayrpc
Package gateway implements the actual gateway which will listen for requests and forward them to servers wrapped by gatewayrpc

Jump to

Keyboard shortcuts

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