gateway

package
v1.18.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0, MIT Imports: 35 Imported by: 7

Documentation

Index

Constants

View Source
const (
	DefaultLookbackCap            = time.Hour * 24
	DefaultStateWaitLookbackLimit = abi.ChainEpoch(20)
	DefaultRateLimitTimeout       = time.Second * 5
)

Variables

This section is empty.

Functions

func Handler

func Handler(gwapi lapi.Gateway, api lapi.FullNode, rateLimit int64, connPerMinute int64, opts ...jsonrpc.ServerOption) (http.Handler, error)

Handler returns a gateway http.Handler, to be mounted as-is on the server.

Types

type ConnectionRateLimiterHandler added in v1.17.0

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

func NewConnectionRateLimiterHandler added in v1.17.0

func NewConnectionRateLimiterHandler(handler http.Handler, connPerMinute int64) *ConnectionRateLimiterHandler

this blocks new connections if there have already been too many.

func (*ConnectionRateLimiterHandler) ServeHTTP added in v1.17.0

type Node

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

func NewNode

func NewNode(api TargetAPI, lookbackCap time.Duration, stateWaitLookbackLimit abi.ChainEpoch, rateLimit int64, rateLimitTimeout time.Duration) *Node

NewNode creates a new gateway node.

func (*Node) ChainGetBlockMessages

func (gw *Node) ChainGetBlockMessages(ctx context.Context, c cid.Cid) (*api.BlockMessages, error)

func (*Node) ChainGetGenesis added in v1.13.2

func (gw *Node) ChainGetGenesis(ctx context.Context) (*types.TipSet, error)

func (*Node) ChainGetMessage

func (gw *Node) ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)

func (*Node) ChainGetNode

func (gw *Node) ChainGetNode(ctx context.Context, p string) (*api.IpldObject, error)

func (*Node) ChainGetParentMessages added in v1.13.2

func (gw *Node) ChainGetParentMessages(ctx context.Context, c cid.Cid) ([]api.Message, error)

func (*Node) ChainGetParentReceipts added in v1.13.2

func (gw *Node) ChainGetParentReceipts(ctx context.Context, c cid.Cid) ([]*types.MessageReceipt, error)

func (*Node) ChainGetPath added in v1.11.3

func (gw *Node) ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*api.HeadChange, error)

func (*Node) ChainGetTipSet

func (gw *Node) ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)

func (*Node) ChainGetTipSetAfterHeight added in v1.11.2

func (gw *Node) ChainGetTipSetAfterHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)

func (*Node) ChainGetTipSetByHeight

func (gw *Node) ChainGetTipSetByHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)

func (*Node) ChainHasObj

func (gw *Node) ChainHasObj(ctx context.Context, c cid.Cid) (bool, error)

func (*Node) ChainHead

func (gw *Node) ChainHead(ctx context.Context) (*types.TipSet, error)

func (*Node) ChainNotify

func (gw *Node) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, error)

func (*Node) ChainPutObj added in v1.16.0

func (gw *Node) ChainPutObj(context.Context, blocks.Block) error

func (*Node) ChainReadObj

func (gw *Node) ChainReadObj(ctx context.Context, c cid.Cid) ([]byte, error)

func (*Node) Discover added in v1.17.0

func (gw *Node) Discover(ctx context.Context) (apitypes.OpenRPCDocument, error)

func (*Node) GasEstimateMessageGas

func (gw *Node) GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)

func (*Node) MpoolPush

func (gw *Node) MpoolPush(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error)

func (*Node) MsigGetAvailableBalance

func (gw *Node) MsigGetAvailableBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.BigInt, error)

func (*Node) MsigGetPending

func (gw *Node) MsigGetPending(ctx context.Context, addr address.Address, tsk types.TipSetKey) ([]*api.MsigTransaction, error)

func (*Node) MsigGetVested

func (gw *Node) MsigGetVested(ctx context.Context, addr address.Address, start types.TipSetKey, end types.TipSetKey) (types.BigInt, error)

func (*Node) MsigGetVestingSchedule added in v1.15.1

func (gw *Node) MsigGetVestingSchedule(ctx context.Context, addr address.Address, tsk types.TipSetKey) (api.MsigVesting, error)

func (*Node) StateAccountKey

func (gw *Node) StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)

func (*Node) StateCirculatingSupply

func (gw *Node) StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error)

func (*Node) StateDealProviderCollateralBounds

func (gw *Node) StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (api.DealCollateralBounds, error)

func (*Node) StateGetActor

func (gw *Node) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)

func (*Node) StateListMiners

func (gw *Node) StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error)

func (*Node) StateLookupID

func (gw *Node) StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)

func (*Node) StateMarketBalance

func (gw *Node) StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (api.MarketBalance, error)

func (*Node) StateMarketStorageDeal

func (gw *Node) StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*api.MarketDeal, error)

func (*Node) StateMinerAvailableBalance

func (gw *Node) StateMinerAvailableBalance(ctx context.Context, m address.Address, tsk types.TipSetKey) (types.BigInt, error)

func (*Node) StateMinerDeadlines

func (gw *Node) StateMinerDeadlines(ctx context.Context, m address.Address, tsk types.TipSetKey) ([]api.Deadline, error)

func (*Node) StateMinerFaults

func (gw *Node) StateMinerFaults(ctx context.Context, m address.Address, tsk types.TipSetKey) (bitfield.BitField, error)

func (*Node) StateMinerInfo

func (gw *Node) StateMinerInfo(ctx context.Context, m address.Address, tsk types.TipSetKey) (api.MinerInfo, error)

func (*Node) StateMinerPower

func (gw *Node) StateMinerPower(ctx context.Context, m address.Address, tsk types.TipSetKey) (*api.MinerPower, error)

func (*Node) StateMinerProvingDeadline

func (gw *Node) StateMinerProvingDeadline(ctx context.Context, m address.Address, tsk types.TipSetKey) (*dline.Info, error)

func (*Node) StateMinerRecoveries

func (gw *Node) StateMinerRecoveries(ctx context.Context, m address.Address, tsk types.TipSetKey) (bitfield.BitField, error)

func (*Node) StateNetworkVersion

func (gw *Node) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)

func (*Node) StateReadState

func (gw *Node) StateReadState(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*api.ActorState, error)

func (*Node) StateSearchMsg

func (gw *Node) StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)

func (*Node) StateSectorGetInfo

func (gw *Node) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)

func (*Node) StateVMCirculatingSupplyInternal

func (gw *Node) StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (api.CirculatingSupply, error)

func (*Node) StateVerifiedClientStatus

func (gw *Node) StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)

func (*Node) StateWaitMsg

func (gw *Node) StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)

func (*Node) Version

func (gw *Node) Version(ctx context.Context) (api.APIVersion, error)

func (*Node) WalletBalance

func (gw *Node) WalletBalance(ctx context.Context, k address.Address) (types.BigInt, error)

func (*Node) WalletVerify

func (gw *Node) WalletVerify(ctx context.Context, k address.Address, msg []byte, sig *crypto.Signature) (bool, error)

type RateLimiterHandler added in v1.17.0

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

Adds a rate limiter to the request context for per-connection rate limiting

func NewRateLimiterHandler added in v1.17.0

func NewRateLimiterHandler(handler http.Handler, rateLimit int64) *RateLimiterHandler

func (RateLimiterHandler) ServeHTTP added in v1.17.0

func (h RateLimiterHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TargetAPI

type TargetAPI interface {
	Version(context.Context) (api.APIVersion, error)
	ChainGetParentMessages(context.Context, cid.Cid) ([]api.Message, error)
	ChainGetParentReceipts(context.Context, cid.Cid) ([]*types.MessageReceipt, error)
	ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
	ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
	ChainGetNode(ctx context.Context, p string) (*api.IpldObject, error)
	ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
	ChainGetTipSetByHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
	ChainGetTipSetAfterHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
	ChainHasObj(context.Context, cid.Cid) (bool, error)
	ChainHead(ctx context.Context) (*types.TipSet, error)
	ChainNotify(context.Context) (<-chan []*api.HeadChange, error)
	ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*api.HeadChange, error)
	ChainReadObj(context.Context, cid.Cid) ([]byte, error)
	ChainPutObj(context.Context, blocks.Block) error
	ChainGetGenesis(context.Context) (*types.TipSet, error)
	GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)
	MpoolPushUntrusted(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error)
	MsigGetAvailableBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.BigInt, error)
	MsigGetVested(ctx context.Context, addr address.Address, start types.TipSetKey, end types.TipSetKey) (types.BigInt, error)
	MsigGetVestingSchedule(context.Context, address.Address, types.TipSetKey) (api.MsigVesting, error)
	MsigGetPending(ctx context.Context, addr address.Address, ts types.TipSetKey) ([]*api.MsigTransaction, error)
	StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
	StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (api.DealCollateralBounds, error)
	StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
	StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
	StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error)
	StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (api.MarketBalance, error)
	StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*api.MarketDeal, error)
	StateNetworkVersion(context.Context, types.TipSetKey) (network.Version, error)
	StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
	StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
	StateReadState(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*api.ActorState, error)
	StateMinerPower(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error)
	StateMinerFaults(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
	StateMinerRecoveries(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
	StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
	StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]api.Deadline, error)
	StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error)
	StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
	StateCirculatingSupply(context.Context, types.TipSetKey) (abi.TokenAmount, error)
	StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
	StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
	StateVMCirculatingSupplyInternal(context.Context, types.TipSetKey) (api.CirculatingSupply, error)
	WalletBalance(context.Context, address.Address) (types.BigInt, error) //perm:read
}

TargetAPI defines the API methods that the Node depends on (to make it easy to mock for tests)

Jump to

Keyboard shortcuts

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