Documentation ¶
Index ¶
- Constants
- func APIDirectory(w http.ResponseWriter, r *http.Request)
- func AddressPathCtx(next http.Handler) http.Handler
- func AddressPostCtx(next http.Handler) http.Handler
- func BlockDateQueryCtx(next http.Handler) http.Handler
- func BlockHashLatestCtx(r *http.Request, source DataSource) context.Context
- func BlockHashPathAndIndexCtx(r *http.Request, source DataSource) context.Context
- func BlockHashPathCtx(next http.Handler) http.Handler
- func BlockIndex0PathCtx(next http.Handler) http.Handler
- func BlockIndexLatestCtx(r *http.Request, source DataSource) context.Context
- func BlockIndexOrHashPathCtx(next http.Handler) http.Handler
- func BlockIndexPathCtx(next http.Handler) http.Handler
- func BlockStepPathCtx(next http.Handler) http.Handler
- func CacheControl(maxAge int64) func(http.Handler) http.Handler
- func DisableLog()
- func GetAddressCtx(r *http.Request) string
- func GetBlockDateCtx(r *http.Request) string
- func GetBlockHashCtx(r *http.Request) string
- func GetBlockHeightCtx(r *http.Request, source DataSource) int64
- func GetBlockIndex0Ctx(r *http.Request) int
- func GetBlockIndexCtx(r *http.Request) int
- func GetBlockStepCtx(r *http.Request) int
- func GetCountCtx(r *http.Request) int
- func GetLatestVoteVersionCtx(r *http.Request) int
- func GetMCtx(r *http.Request) int
- func GetNCtx(r *http.Request) int
- func GetOffsetCtx(r *http.Request) int
- func GetRawHexTx(r *http.Request) string
- func GetStatusInfoCtx(r *http.Request) string
- func GetTxIDCtx(r *http.Request) string
- func GetTxIOIndexCtx(r *http.Request) int
- func GetTxnsCtx(r *http.Request) []string
- func MPathCtx(next http.Handler) http.Handler
- func NPathCtx(next http.Handler) http.Handler
- func PaginationCtx(next http.Handler) http.Handler
- func PostTxnsCtx(next http.Handler) http.Handler
- func SearchPathCtx(next http.Handler) http.Handler
- func StakeVersionLatestCtx(r *http.Request, stakeVerFun StakeVersionsLatest) context.Context
- func StatusCtx(r *http.Request, status apitypes.Status) context.Context
- func StatusInfoCtx(r *http.Request, source DataSource) context.Context
- func TransactionHashCtx(next http.Handler) http.Handler
- func TransactionIOIndexCtx(next http.Handler) http.Handler
- func TransactionsCtx(next http.Handler) http.Handler
- func UseLogger(logger slog.Logger)
- func ValidateTxnsPostCtx(next http.Handler) http.Handler
- type DataSource
- type StakeVersionsLatest
Constants ¶
const ( CtxAddress contextKey CtxBlockDate CtxLimit )
Variables ¶
This section is empty.
Functions ¶
func APIDirectory ¶
func APIDirectory(w http.ResponseWriter, r *http.Request)
APIDirectory is the actual handler used with apiDocs (e.g. mux.With(apiDocs(mux)).HandleFunc("/help", APIDirectory))
func AddressPathCtx ¶
AddressPathCtx returns a http.HandlerFunc that embeds the value at the url part {address} into the request context.
func AddressPostCtx ¶
AddressPostCtx returns a http.HandlerFunc that embeds the {addrs} value in the post request into the request context.
func BlockDateQueryCtx ¶
BlockDateQueryCtx returns a http.Handlerfunc that embeds the {blockdate, limit} value in the request into the request context.
func BlockHashLatestCtx ¶
func BlockHashLatestCtx(r *http.Request, source DataSource) context.Context
BlockHashLatestCtx embeds the current block height and hash into a request context.
func BlockHashPathAndIndexCtx ¶
func BlockHashPathAndIndexCtx(r *http.Request, source DataSource) context.Context
BlockHashPathAndIndexCtx embeds the value at the url part {blockhash}, and the corresponding block index, into a request context.
func BlockHashPathCtx ¶
BlockHashPathCtx returns a http.HandlerFunc that embeds the value at the url part {blockhash} into the request context.
func BlockIndex0PathCtx ¶
BlockIndex0PathCtx returns a http.HandlerFunc that embeds the value at the url part {idx0} into the request context.
func BlockIndexLatestCtx ¶
func BlockIndexLatestCtx(r *http.Request, source DataSource) context.Context
BlockIndexLatestCtx embeds the current block height into a request context.
func BlockIndexOrHashPathCtx ¶
BlockIndexOrHashPathCtx returns a http.HandlerFunc that embeds the value at the url part {idxorhash} into the request context.
func BlockIndexPathCtx ¶
BlockIndexPathCtx returns a http.HandlerFunc that embeds the value at the url part {idx} into the request context.
func BlockStepPathCtx ¶
BlockStepPathCtx returns a http.HandlerFunc that embeds the value at the url part {step} into the request context.
func CacheControl ¶
CacheControl creates a new middleware to set the HTTP response header with "Cache-Control: max-age=maxAge" where maxAge is in seconds.
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
func GetAddressCtx ¶
GetAddressCtx retrieves the ctxAddress data from the request context. If not set, the return value is an empty string.
func GetBlockDateCtx ¶
GetBlockDateCtx retrieves the ctxBlockDate data from the request context. If not set, the return value is an empty string.
func GetBlockHashCtx ¶
GetBlockHashCtx retrieves the ctxBlockHash data from the request context. If not set, the return value is an empty string.
func GetBlockHeightCtx ¶
func GetBlockHeightCtx(r *http.Request, source DataSource) int64
GetBlockHeightCtx returns the block height for the block index or hash specified on the URL path.
func GetBlockIndex0Ctx ¶
GetBlockStepCtx retrieves the ctxBlockIndex0 data from the request context. If not set, the return value is -1.
func GetBlockIndexCtx ¶
GetBlockIndexCtx retrieves the ctxBlockIndex data from the request context. If not set, the return -1.
func GetBlockStepCtx ¶
GetBlockStepCtx retrieves the ctxBlockStep data from the request context. If not set, the return value is -1.
func GetCountCtx ¶
GetCountCtx retrieves the ctxCount data ("to") URL path element from the request context. If not set, the return value is 20. TODO: rename this function.
func GetLatestVoteVersionCtx ¶
GetLatestVoteVersionCtx attempts to retrieve the latest stake version embedded in the request context.
func GetMCtx ¶
GetMCtx retrieves the ctxM data from the request context. If not set, the return value is -1.
func GetNCtx ¶
GetNCtx retrieves the ctxN data from the request context. If not set, the return value is -1.
func GetOffsetCtx ¶
GetCountCtx retrieves the ctxOffset data ("from") from the request context. If not set, the return value is 0. TODO: rename this function.
func GetRawHexTx ¶
GetRawHexTx retrieves the ctxRawHexTx data from the request context. If not set, the return value is an empty string.
func GetStatusInfoCtx ¶
GetStatusInfoCtx retrieves the ctxGetStatus data ("q" POST form data) from the request context. If not set, the return value is an empty string.
func GetTxIDCtx ¶
GetTxIDCtx retrieves the ctxTxHash data from the request context. If not set, the return value is an empty string.
func GetTxIOIndexCtx ¶
GetTxIOIndexCtx retrieves the ctxTxInOutIndex data from the request context. If not set, the return value is -1.
func GetTxnsCtx ¶
GetTxnsCtx retrieves the ctxTxns data from the request context. If not set, the return value is an empty string slice.
func MPathCtx ¶
MPathCtx returns a http.HandlerFunc that embeds the value at the url part {M} into the request context
func NPathCtx ¶
NPathCtx returns a http.HandlerFunc that embeds the value at the url part {N} into the request context.
func PaginationCtx ¶
PaginationCtx returns a http.Handlerfunc that embeds the {to,from} value in the request into the request context.
func PostTxnsCtx ¶
PostTxnsCtx extract transaction IDs from the POST body
func SearchPathCtx ¶
SearchPathCtx returns a http.HandlerFunc that embeds the value at the url part {search} into the request context (Still need this for the error page) TODO: make new error system
func StakeVersionLatestCtx ¶
func StakeVersionLatestCtx(r *http.Request, stakeVerFun StakeVersionsLatest) context.Context
StakeVersionLatestCtx embeds the specified StakeVersionsLatest function into a request context.
func StatusInfoCtx ¶
func StatusInfoCtx(r *http.Request, source DataSource) context.Context
StatusInfoCtx embeds the best block index and the POST form data for parameter "q" into a request context.
func TransactionHashCtx ¶
TransactionHashCtx returns a http.HandlerFunc that embeds the value at the url part {txid} into the request context.
func TransactionIOIndexCtx ¶
TransactionIOIndexCtx returns a http.HandlerFunc that embeds the value at the url part {txinoutindex} into the request context
func TransactionsCtx ¶
TransactionsCtx returns a http.Handlerfunc that embeds the {address, blockhash} value in the request into the request context.
Types ¶
type DataSource ¶
type StakeVersionsLatest ¶
type StakeVersionsLatest func() (*dcrjson.StakeVersions, error)