Documentation ¶
Index ¶
- Variables
- func RegisterRouter(name string, factory RouterFactory, ctx interface{})
- func WriteErr(w http.ResponseWriter, code int, msg string)
- func WriteJSON(w http.ResponseWriter, msg []byte)
- func WriteObject(w http.ResponseWriter, obj interface{})
- type ErrorResponse
- type RootRequestContext
- type RouterFactory
- type RouterFactoryParams
- type Server
- func (s *Server) AddAliases(endpoint string, aliases ...string) error
- func (s *Server) AddAliasesWithReadLock(endpoint string, aliases ...string) error
- func (s *Server) AddRoute(handler *common.HTTPHandler, lock *sync.RWMutex, base, endpoint string, ...) error
- func (s *Server) Call(writer http.ResponseWriter, method, base, endpoint string, body io.Reader, ...) error
- func (s *Server) Dispatch() error
- func (s *Server) DispatchTLS(certFile, keyFile string) error
- func (s *Server) Initialize(log logging.Logger, factory logging.Factory, host string, port uint16)
- func (s *Server) RegisterChain(ctx *snow.Context, vmIntf interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnregisteredVM = errors.New("no Router is registered for this VM")
)
Functions ¶
func RegisterRouter ¶
func RegisterRouter(name string, factory RouterFactory, ctx interface{})
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, msg []byte)
func WriteObject ¶
func WriteObject(w http.ResponseWriter, obj interface{})
Types ¶
type ErrorResponse ¶
type RootRequestContext ¶
type RootRequestContext struct{}
type RouterFactory ¶
type RouterFactory func(RouterFactoryParams) error
type RouterFactoryParams ¶
type RouterFactoryParams struct { Router *web.Router NetworkID uint32 ChainConfig cfg.ChainConfig ServiceConfig cfg.ServiceConfig }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server maintains the HTTP router
func (*Server) AddAliases ¶
AddAliases registers aliases to the server
func (*Server) AddAliasesWithReadLock ¶
AddAliasesWithReadLock registers aliases to the server assuming the http read lock is currently held.
func (*Server) AddRoute ¶
func (s *Server) AddRoute(handler *common.HTTPHandler, lock *sync.RWMutex, base, endpoint string, log logging.Logger) error
AddRoute registers the appropriate endpoint for the vm given an endpoint
func (*Server) Call ¶
func (s *Server) Call( writer http.ResponseWriter, method, base, endpoint string, body io.Reader, headers map[string]string, ) error
Call ...
func (*Server) DispatchTLS ¶
DispatchTLS starts the API server with the provided TLS certificate
func (*Server) Initialize ¶
Initialize creates the API server at the provided host and port
func (*Server) RegisterChain ¶
RegisterChain registers the API endpoints associated with this chain That is, add <route, handler> pairs to server so that http calls can be made to the vm
Source Files ¶
Click to show internal directories.
Click to hide internal directories.