types

package
v0.24.1 Latest Latest
Warning

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

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

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

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

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

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

func (pr *PeerRecord) GetSchema() string

func (PeerRecord) MarshalJSON

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

func (*PeerRecord) UnmarshalJSON

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

type Record

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

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

func (ur *UnknownRecord) GetSchema() string

func (UnknownRecord) MarshalJSON

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

func (*UnknownRecord) UnmarshalJSON

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

type WriteBitswapRecord deprecated

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

func (wr *WriteBitswapRecord) GetSchema() string

func (*WriteBitswapRecord) IsSigned

func (p *WriteBitswapRecord) IsSigned() bool

func (*WriteBitswapRecord) Sign

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

func (*WriteBitswapRecord) UnmarshalJSON

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

func (*WriteBitswapRecord) Verify

func (p *WriteBitswapRecord) Verify() error

type WriteBitswapRecordResponse deprecated

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

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

func (*WriteBitswapRecordResponse) GetSchema

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