Documentation
¶
Index ¶
Constants ¶
View Source
const HTTPHeaderRoute = "Avalanche-Api-Route"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPConfig ¶ added in v1.9.12
type PathAdder ¶ added in v1.7.6
type PathAdder interface {
// AddRoute registers a route to a handler.
AddRoute(handler http.Handler, base, endpoint string) error
// AddAliases registers aliases to the server
AddAliases(endpoint string, aliases ...string) error
}
func PathWriterFromWithReadLock ¶ added in v1.7.6
func PathWriterFromWithReadLock(pather PathAdderWithReadLock) PathAdder
type PathAdderWithReadLock ¶ added in v1.7.6
type PathAdderWithReadLock interface {
// AddRouteWithReadLock registers a route to a handler assuming the http
// read lock is currently held.
AddRouteWithReadLock(handler http.Handler, base, endpoint string) error
// AddAliasesWithReadLock registers aliases to the server assuming the http read
// lock is currently held.
AddAliasesWithReadLock(endpoint string, aliases ...string) error
}
type Server ¶
type Server interface {
PathAdder
PathAdderWithReadLock
// Dispatch starts the API server
Dispatch() error
// RegisterChain registers the API endpoints associated with this chain.
// That is, add <route, handler> pairs to server so that API calls can be
// made to the VM.
RegisterChain(chainName string, ctx *snow.ConsensusContext, vm common.VM)
// Shutdown this server
Shutdown() error
}
Server maintains the HTTP router
func New ¶ added in v1.7.6
func New( log logging.Logger, listener net.Listener, allowedOrigins []string, shutdownTimeout time.Duration, nodeID ids.NodeID, tracingEnabled bool, tracer trace.Tracer, registerer prometheus.Registerer, httpConfig HTTPConfig, allowedHosts []string, ) (Server, error)
New returns an instance of a Server.
Click to show internal directories.
Click to hide internal directories.