gateway

package
v0.11.0-rc9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAddressFormat = errors.New("address must be a valid account or validator address")
	ErrMissingAddress       = errors.New("address not specified")
)

Functions

This section is empty.

Types

type AvailabilityResponse

type AvailabilityResponse struct {
	Available   bool   `json:"available"`
	Probability string `json:"probability_of_availability"`
}

AvailabilityResponse represents the response to a `/data_available` request.

type Config

type Config struct {
	Address string
	Port    string
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) Validate

func (cfg *Config) Validate() error

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(
	state state.Module,
	share share.Module,
	header header.Module,
	das *das.DASer,
) *Handler

func (*Handler) RegisterEndpoints

func (h *Handler) RegisterEndpoints(rpc *Server, deprecatedEndpointsEnabled bool)

func (*Handler) RegisterMiddleware

func (h *Handler) RegisterMiddleware(srv *Server)

type NamespacedDataResponse

type NamespacedDataResponse struct {
	Data   [][]byte `json:"data"`
	Height uint64   `json:"height"`
}

NamespacedDataResponse represents the response to a DataByNamespace request.

type NamespacedSharesResponse

type NamespacedSharesResponse struct {
	Shares []share.Share `json:"shares"`
	Height uint64        `json:"height"`
}

NamespacedSharesResponse represents the response to a SharesByNamespace request.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents a gateway server on the Node.

func NewServer

func NewServer(address, port string) *Server

NewServer returns a new gateway Server.

func (*Server) ListenAddr

func (s *Server) ListenAddr() string

ListenAddr returns the listen address of the server.

func (*Server) RegisterHandlerFunc

func (s *Server) RegisterHandlerFunc(pattern string, handlerFunc http.HandlerFunc, method string)

RegisterHandlerFunc registers the given http.HandlerFunc on the Server's multiplexer on the given pattern.

func (*Server) RegisterMiddleware

func (s *Server) RegisterMiddleware(middlewareFuncs ...mux.MiddlewareFunc)

RegisterMiddleware allows to register a custom middleware that will be called before http.Request will reach handler.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves inbound requests on the Server.

func (*Server) Start

func (s *Server) Start(context.Context) error

Start starts the gateway Server, listening on the given address.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the gateway Server.

Jump to

Keyboard shortcuts

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