types

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 10

Documentation

Index

Constants

View Source
const SchemaBitswap = "bitswap"

Deprecated: use the more versatile SchemaPeer instead. For more information, read IPIP-417.

View Source
const SchemaPeer = "peer"

Variables

This section is empty.

Functions

This section is empty.

Types

type BitswapPayload

type BitswapPayload struct {
	Keys        []CID
	Timestamp   *Time
	AdvisoryTTL *Duration
	ID          *peer.ID
	Addrs       []Multiaddr
}

type BitswapRecord deprecated added in v0.13.0

type BitswapRecord struct {
	Schema   string
	Protocol string
	ID       *peer.ID
	Addrs    []Multiaddr `json:",omitempty"`
}

Deprecated: use the more versatile PeerRecord instead. For more information, read IPIP-417.

func (*BitswapRecord) GetSchema added in v0.13.0

func (br *BitswapRecord) GetSchema() string

type CID

type CID struct{ cid.Cid }

func (*CID) MarshalJSON

func (c *CID) MarshalJSON() ([]byte, error)

func (*CID) UnmarshalJSON

func (c *CID) UnmarshalJSON(b []byte) error

type Duration

type Duration struct{ time.Duration }

func (*Duration) MarshalJSON

func (d *Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type Multiaddr

type Multiaddr struct{ multiaddr.Multiaddr }

func (*Multiaddr) UnmarshalJSON

func (m *Multiaddr) UnmarshalJSON(b []byte) error

type PeerRecord added in v0.13.0

type PeerRecord struct {
	Schema    string
	ID        *peer.ID
	Addrs     []Multiaddr
	Protocols []string

	// Extra contains extra fields that were included in the original JSON raw
	// message, except for the known ones represented by the remaining fields.
	Extra map[string]json.RawMessage
}

func (*PeerRecord) GetSchema added in v0.13.0

func (pr *PeerRecord) GetSchema() string

func (PeerRecord) MarshalJSON added in v0.13.0

func (pr PeerRecord) MarshalJSON() ([]byte, error)

func (*PeerRecord) UnmarshalJSON added in v0.13.0

func (pr *PeerRecord) UnmarshalJSON(b []byte) error

type Record added in v0.13.0

type Record interface {
	GetSchema() string
}

Record is implemented for any record.

type Time

type Time struct{ time.Time }

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

type UnknownRecord added in v0.13.0

type UnknownRecord struct {
	Schema string

	// Bytes contains the raw JSON bytes that were used to unmarshal this record.
	// This value can be used, for example, to unmarshal de record into a different
	// type if Schema is of a known value.
	Bytes []byte
}

func (*UnknownRecord) GetSchema added in v0.13.0

func (ur *UnknownRecord) GetSchema() string

func (UnknownRecord) MarshalJSON added in v0.13.0

func (ur UnknownRecord) MarshalJSON() ([]byte, error)

func (*UnknownRecord) UnmarshalJSON added in v0.13.0

func (ur *UnknownRecord) UnmarshalJSON(b []byte) error

type WriteBitswapRecord deprecated added in v0.13.0

type WriteBitswapRecord struct {
	Schema    string
	Protocol  string
	Signature string

	// this content must be untouched because it is signed and we need to verify it
	RawPayload json.RawMessage `json:"Payload"`
	Payload    BitswapPayload  `json:"-"`
}

Deprecated: protocol-agnostic provide is being worked on in IPIP-378:

func (*WriteBitswapRecord) GetSchema added in v0.13.0

func (wr *WriteBitswapRecord) GetSchema() string

func (*WriteBitswapRecord) IsSigned added in v0.13.0

func (p *WriteBitswapRecord) IsSigned() bool

func (*WriteBitswapRecord) Sign added in v0.13.0

func (p *WriteBitswapRecord) Sign(peerID peer.ID, key crypto.PrivKey) error

func (*WriteBitswapRecord) UnmarshalJSON added in v0.13.0

func (p *WriteBitswapRecord) UnmarshalJSON(b []byte) error

func (*WriteBitswapRecord) Verify added in v0.13.0

func (p *WriteBitswapRecord) Verify() error

type WriteBitswapRecordResponse deprecated added in v0.13.0

type WriteBitswapRecordResponse struct {
	Schema      string
	Protocol    string
	AdvisoryTTL *Duration
}

Deprecated: protocol-agnostic provide is being worked on in IPIP-378:

func (*WriteBitswapRecordResponse) GetSchema added in v0.13.0

func (r *WriteBitswapRecordResponse) GetSchema() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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