types

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaBitswap = "bitswap"

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 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 ProviderResponse

type ProviderResponse interface {
	GetProtocol() string
	GetSchema() string
}

ProviderResponse is implemented for any ProviderResponse. It needs to have a Protocol field.

type ReadBitswapProviderRecord

type ReadBitswapProviderRecord struct {
	Protocol string
	Schema   string
	ID       *peer.ID
	Addrs    []Multiaddr
}

ReadBitswapProviderRecord is a provider result with parameters for bitswap providers

func (*ReadBitswapProviderRecord) GetProtocol

func (rbpr *ReadBitswapProviderRecord) GetProtocol() string

func (*ReadBitswapProviderRecord) GetSchema

func (rbpr *ReadBitswapProviderRecord) GetSchema() string

func (*ReadBitswapProviderRecord) IsReadProviderRecord

func (*ReadBitswapProviderRecord) IsReadProviderRecord()

type ReadProviderRecord

type ReadProviderRecord interface {
	IsReadProviderRecord()
}

ReadProviderRecord is a type that enforces structs to imlement it to avoid confusion

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 UnknownProviderRecord

type UnknownProviderRecord struct {
	Protocol string
	Schema   string
	Bytes    []byte
}

UnknownProviderRecord is used when we cannot parse the provider record using `GetProtocol`

func (*UnknownProviderRecord) GetProtocol

func (u *UnknownProviderRecord) GetProtocol() string

func (*UnknownProviderRecord) GetSchema

func (u *UnknownProviderRecord) GetSchema() string

func (*UnknownProviderRecord) IsReadProviderRecord

func (u *UnknownProviderRecord) IsReadProviderRecord()

func (UnknownProviderRecord) IsWriteProviderRecord

func (u UnknownProviderRecord) IsWriteProviderRecord()

func (UnknownProviderRecord) MarshalJSON

func (u UnknownProviderRecord) MarshalJSON() ([]byte, error)

func (*UnknownProviderRecord) UnmarshalJSON

func (u *UnknownProviderRecord) UnmarshalJSON(b []byte) error

type WriteBitswapProviderRecord

type WriteBitswapProviderRecord struct {
	Protocol  string
	Schema    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:"-"`
}

WriteBitswapProviderRecord is used when we want to add a new provider record that is using bitswap.

func (*WriteBitswapProviderRecord) IsSigned

func (p *WriteBitswapProviderRecord) IsSigned() bool

func (*WriteBitswapProviderRecord) IsWriteProviderRecord

func (*WriteBitswapProviderRecord) IsWriteProviderRecord()

func (*WriteBitswapProviderRecord) Sign

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

func (*WriteBitswapProviderRecord) UnmarshalJSON

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

func (*WriteBitswapProviderRecord) Verify

func (p *WriteBitswapProviderRecord) Verify() error

type WriteBitswapProviderRecordResponse

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

WriteBitswapProviderRecordResponse will be returned as a result of WriteBitswapProviderRecord

func (*WriteBitswapProviderRecordResponse) GetProtocol

func (wbprr *WriteBitswapProviderRecordResponse) GetProtocol() string

func (*WriteBitswapProviderRecordResponse) GetSchema

func (wbprr *WriteBitswapProviderRecordResponse) GetSchema() string

type WriteProviderRecord

type WriteProviderRecord interface {
	IsWriteProviderRecord()
}

WriteProviderRecord is a type that enforces structs to imlement it to avoid confusion

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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