apiutil

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRouter

func InitRouter(opts RouterOptions) (routing.Router, error)

InitRouter initializes a router. If an event bus is provided, InitRouter will use that. Otherwise, InitRouter will use the node to query the network to determine the initial routing table.

func NewMessageRouter added in v1.4.0

func NewMessageRouter(scan *NetworkScan) message.Router

func RouteAccount

func RouteAccount(table *protocol.RoutingTable, account *url.URL) (string, error)

Types

type AnchorData added in v1.4.0

type AnchorData struct {
	Block uint64    `json:"block,omitempty" form:"block" query:"block" validate:"required"`
	Time  time.Time `json:"time,omitempty" form:"time" query:"time" validate:"required"`
	// contains filtered or unexported fields
}

func (*AnchorData) Copy added in v1.4.0

func (v *AnchorData) Copy() *AnchorData

func (*AnchorData) CopyAsInterface added in v1.4.0

func (v *AnchorData) CopyAsInterface() interface{}

func (*AnchorData) Equal added in v1.4.0

func (v *AnchorData) Equal(u *AnchorData) bool

func (*AnchorData) IsValid added in v1.4.0

func (v *AnchorData) IsValid() error

func (*AnchorData) MarshalBinary added in v1.4.0

func (v *AnchorData) MarshalBinary() ([]byte, error)

func (*AnchorData) MarshalJSON added in v1.4.0

func (v *AnchorData) MarshalJSON() ([]byte, error)

func (*AnchorData) UnmarshalBinary added in v1.4.0

func (v *AnchorData) UnmarshalBinary(data []byte) error

func (*AnchorData) UnmarshalBinaryFrom added in v1.4.0

func (v *AnchorData) UnmarshalBinaryFrom(rd io.Reader) error

func (*AnchorData) UnmarshalJSON added in v1.4.0

func (v *AnchorData) UnmarshalJSON(b []byte) error

type ChainData added in v1.4.0

type ChainData struct {
	Account *url.URL  `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	Chain   string    `json:"chain,omitempty" form:"chain" query:"chain" validate:"required"`
	Block   uint64    `json:"block,omitempty" form:"block" query:"block" validate:"required"`
	Time    time.Time `json:"time,omitempty" form:"time" query:"time" validate:"required"`
	// contains filtered or unexported fields
}

func (*ChainData) Copy added in v1.4.0

func (v *ChainData) Copy() *ChainData

func (*ChainData) CopyAsInterface added in v1.4.0

func (v *ChainData) CopyAsInterface() interface{}

func (*ChainData) Equal added in v1.4.0

func (v *ChainData) Equal(u *ChainData) bool

func (*ChainData) IsValid added in v1.4.0

func (v *ChainData) IsValid() error

func (*ChainData) MarshalBinary added in v1.4.0

func (v *ChainData) MarshalBinary() ([]byte, error)

func (*ChainData) MarshalJSON added in v1.4.0

func (v *ChainData) MarshalJSON() ([]byte, error)

func (*ChainData) UnmarshalBinary added in v1.4.0

func (v *ChainData) UnmarshalBinary(data []byte) error

func (*ChainData) UnmarshalBinaryFrom added in v1.4.0

func (v *ChainData) UnmarshalBinaryFrom(rd io.Reader) error

func (*ChainData) UnmarshalJSON added in v1.4.0

func (v *ChainData) UnmarshalJSON(b []byte) error

type MessageData added in v1.4.0

type MessageData struct {
	LastUpdated time.Time    `json:"lastUpdated,omitempty" form:"lastUpdated" query:"lastUpdated" validate:"required"`
	Chains      []*ChainData `json:"chains" form:"chains" query:"chains" validate:"required"`
	// contains filtered or unexported fields
}

func (*MessageData) Copy added in v1.4.0

func (v *MessageData) Copy() *MessageData

func (*MessageData) CopyAsInterface added in v1.4.0

func (v *MessageData) CopyAsInterface() interface{}

func (*MessageData) Equal added in v1.4.0

func (v *MessageData) Equal(u *MessageData) bool

func (*MessageData) IsValid added in v1.4.0

func (v *MessageData) IsValid() error

func (*MessageData) MarshalBinary added in v1.4.0

func (v *MessageData) MarshalBinary() ([]byte, error)

func (*MessageData) MarshalJSON added in v1.4.0

func (v *MessageData) MarshalJSON() ([]byte, error)

func (*MessageData) UnmarshalBinary added in v1.4.0

func (v *MessageData) UnmarshalBinary(data []byte) error

func (*MessageData) UnmarshalBinaryFrom added in v1.4.0

func (v *MessageData) UnmarshalBinaryFrom(rd io.Reader) error

func (*MessageData) UnmarshalJSON added in v1.4.0

func (v *MessageData) UnmarshalJSON(b []byte) error

type NetworkScan added in v1.4.0

type NetworkScan = healing.NetworkInfo

func LoadNetworkScan added in v1.4.0

func LoadNetworkScan(file string) (*NetworkScan, error)

type RouterOptions added in v1.4.0

type RouterOptions struct {
	Context context.Context
	Node    *p2p.Node
	Network string
	Events  *events.Bus
	Logger  log.Logger
	Dialer  message.Dialer
}

type StaticDialer added in v1.4.0

type StaticDialer struct {
	Scan   *healing.NetworkInfo
	Dialer message.Dialer
	Nodes  api.NodeService
	// contains filtered or unexported fields
}

func (*StaticDialer) BadDial added in v1.4.0

func (h *StaticDialer) BadDial(ctx context.Context, addr multiaddr.Multiaddr, stream message.Stream, err error) bool

func (*StaticDialer) Dial added in v1.4.0

func (h *StaticDialer) Dial(ctx context.Context, addr multiaddr.Multiaddr) (message.Stream, error)

type TimestampService added in v1.4.0

type TimestampService struct {
	Querier api.Querier
	Cache   keyvalue.Beginner
}

func (*TimestampService) GetTimestamp added in v1.4.0

func (s *TimestampService) GetTimestamp(ctx context.Context, id *url.TxID) (_ *MessageData, err error)

Jump to

Keyboard shortcuts

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