fcrmessages

package
v0.0.0-...-efc3c05 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ClientEstablishmentRequestType              = 0
	ClientEstablishmentResponseType             = 1
	ClientStandardDiscoverRequestType           = 2
	ClientStandardDiscoverResponseType          = 3
	ClientDHTDiscoverRequestType                = 4
	ClientDHTDiscoverResponseType               = 5
	ClientCIDGroupPublishDHTAckRequestType      = 6
	ClientCIDGroupPublishDHTAckResponseType     = 7
	ProviderPublishGroupCIDRequestType          = 8
	ProviderPublishGroupCIDResponseType         = 302
	ProviderDHTPublishGroupCIDRequestType       = 9
	ProviderDHTPublishGroupCIDAckType           = 10
	GatewaySingleCIDOfferPublishRequestType     = 11
	GatewaySingleCIDOfferPublishResponseType    = 12
	GatewaySingleCIDOfferPublishResponseAckType = 13
	GatewayDHTDiscoverRequestType               = 14
	GatewayDHTDiscoverResponseType              = 15
	ProtocolChangeResponseType                  = 100
	ProtocolMismatchResposneType                = 101
	InvalidMessageResponseType                  = 102
	InsufficientFundsResponseType               = 103
	AdminGetReputationChallengeType             = 200
	AdminGetReputationResponseType              = 201
	AdminSetReputationChallengeType             = 202
	AdminSetReputationResponseType              = 203
	AdminAcceptKeyChallengeType                 = 204
	AdminAcceptKeyResponseType                  = 205
	ProviderAdminGetGroupCIDRequestType         = 300
	ProviderAdminGetGroupCIDResponseType        = 301
)

Message types The enum should remain the same for client, admin clients,provider and gateway.

View Source
const (
	CidGroupOfferDigestSize = sha512.Size256
)

Variables

This section is empty.

Functions

func DecodeAdminAcceptKeyChallenge

func DecodeAdminAcceptKeyChallenge(fcrMsg *FCRMessage) (string, uint32, error)

DecodeAdminAcceptKeyChallenge is used to get the fields from FCRMessage of AdminAcceptKeysChallenge

func DecodeAdminAcceptKeyResponse

func DecodeAdminAcceptKeyResponse(fcrMsg *FCRMessage) (
	bool,
	error,
)

DecodeAdminAcceptKeyResponse is used to get the fields from FCRMessage of AdminAcceptKeysResponse

func DecodeAdminGetReputationChallenge

func DecodeAdminGetReputationChallenge(fcrMsg *FCRMessage) (
	*nodeid.NodeID,
	error,
)

DecodeAdminGetReputationChallenge is used to get the fields from FCRMessage of AdminGetReputationChallenge

func DecodeAdminGetReputationResponse

func DecodeAdminGetReputationResponse(fcrMsg *FCRMessage) (
	*nodeid.NodeID,
	int64,
	bool,
	error,
)

DecodeAdminGetReputationResponse is used to get the fields from FCRMessage of AdminGetReputationResponse

func DecodeAdminSetReputationChallenge

func DecodeAdminSetReputationChallenge(fcrMsg *FCRMessage) (
	*nodeid.NodeID,
	int64,
	error,
)

DecodeAdminSetReputationChallenge is used to get the fields from FCRMessage of AdminSetReputationChallenge

func DecodeAdminSetReputationResponse

func DecodeAdminSetReputationResponse(fcrMsg *FCRMessage) (
	*nodeid.NodeID,
	int64,
	bool,
	error,
)

DecodeAdminSetReputationResponse is used to get the fields from FCRMessage of AdminSetReputationResponse

func DecodeClientCIDGroupPublishDHTAckRequest

func DecodeClientCIDGroupPublishDHTAckRequest(fcrMsg *FCRMessage) (
	*cid.ContentID,
	*nodeid.NodeID,
	error,
)

DecodeClientCIDGroupPublishDHTAckRequest is used to get the fields from FCRMessage of ClientCIDGroupPublishDHTAckRequest

func DecodeClientCIDGroupPublishDHTAckResponse

func DecodeClientCIDGroupPublishDHTAckResponse(fcrMsg *FCRMessage) (
	*cid.ContentID,
	*nodeid.NodeID,
	bool,
	*FCRMessage,
	*FCRMessage,
	error,
)

DecodeClientCIDGroupPublishDHTAckResponse is used to get the fields from FCRMessage of ClientCIDGroupPublishDHTAckResponse

func DecodeClientDHTDiscoverRequest

func DecodeClientDHTDiscoverRequest(fcrMsg *FCRMessage) (
	*cid.ContentID,
	int64,
	int64,
	int64,
	bool,
	error,
)

DecodeClientDHTDiscoverRequest is used to get the fields from FCRMessage of ClientDHTDiscoverRequest

func DecodeClientEstablishmentRequest

func DecodeClientEstablishmentRequest(fcrMsg *FCRMessage) (
	*nodeid.NodeID,
	string,
	int64,
	error,
)

DecodeClientEstablishmentRequest is used to get the fields from FCRMessage of ClientEstablishmentRequest

func DecodeClientEstablishmentResponse

func DecodeClientEstablishmentResponse(fcrMsg *FCRMessage) (
	*nodeid.NodeID,
	string,
	error,
)

DecodeClientEstablishmentResponse is used to get the fields from FCRMessage of ClientEstablishmentResponse

func DecodeClientStandardDiscoverRequest

func DecodeClientStandardDiscoverRequest(fcrMsg *FCRMessage) (
	*cid.ContentID,
	int64,
	int64,
	error,
)

DecodeClientStandardDiscoverRequest is used to get the fields from FCRMessage of ClientStandardDiscoverRequest

func DecodeClientStandardDiscoverResponse

func DecodeClientStandardDiscoverResponse(fcrMsg *FCRMessage) (
	*cid.ContentID,
	int64,
	bool,
	[]cidoffer.CidGroupOffer,
	[]string,
	[]fcrmerkletree.FCRMerkleProof,
	[]bool,
	error,
)

DecodeClientStandardDiscoverResponse is used to get the fields from FCRMessage of ClientStandardDiscoverResponse

func DecodeGatewayDHTDiscoverRequest

func DecodeGatewayDHTDiscoverRequest(fcrMsg *FCRMessage) (
	*cid.ContentID,
	int64,
	int64,
	error,
)

DecodeGatewayDHTDiscoverRequest is used to get the fields from FCRMessage of GatewayDHTDiscoverRequest

func DecodeGatewayDHTDiscoverResponse

func DecodeGatewayDHTDiscoverResponse(fcrMsg *FCRMessage) (
	*cid.ContentID,
	int64,
	bool,
	[]cidoffer.CidGroupOffer,
	[]string,
	[]fcrmerkletree.FCRMerkleProof,
	[]bool,
	error,
)

DecodeGatewayDHTDiscoverResponse is used to get the fields from FCRMessage of GatewayDHTDiscoverResponse

func DecodeGatewaySingleCIDOfferPublishRequest

func DecodeGatewaySingleCIDOfferPublishRequest(fcrMsg *FCRMessage) (
	*nodeid.NodeID,
	*cid.ContentID,
	*cid.ContentID,
	string,
	string,
	string,
	*fcrmerkletree.FCRMerkleProof,
	error,
)

DecodeGatewaySingleCIDOfferPublishRequest is used to get the fields from FCRMessage of GatewaySingleCIDOfferPublishRequest

func DecodeInsufficientFundsResponse

func DecodeInsufficientFundsResponse(fcrMsg *FCRMessage) (
	int64,
	error,
)

DecodeInsufficientFundsResponse is used to get the fields from FCRMessage of InsufficientFundsResponse

func DecodeInvalidMessageResponse

func DecodeInvalidMessageResponse(fcrMsg *FCRMessage) error

DecodeInvalidMessageResponse is used to get the fields from FCRMessage of InvalidMessageResponse

func DecodeProtocolChangeResponse

func DecodeProtocolChangeResponse(fcrMsg *FCRMessage) (
	int32,
	error,
)

DecodeProtocolChangeResponse is used to get the fields from FCRMessage of ProtocolChangeResponse

func DecodeProtocolMismatchResponse

func DecodeProtocolMismatchResponse(fcrMsg *FCRMessage) error

DecodeProtocolMismatchResponse is used to get the fields from FCRMessage of ProtocolMismatchResponse

func DecodeProviderAdminGetGroupCIDRequest

func DecodeProviderAdminGetGroupCIDRequest(fcrMsg *FCRMessage) (
	[]nodeid.NodeID,
	error,
)

DecodeProviderAdminGetGroupCIDRequest is used to get the fields from FCRMessage of ProviderAdminGetGroupCIDRequest

func DecodeProviderDHTPublishGroupCIDAck

func DecodeProviderDHTPublishGroupCIDAck(fcrMsg *FCRMessage) (
	int64,
	string,
	error,
)

DecodeProviderDHTPublishGroupCIDAck is used to get the fields from FCRMessage of ProviderDHTPublishGroupCIDAck

func DecodeProviderDHTPublishGroupCIDRequest

func DecodeProviderDHTPublishGroupCIDRequest(fcrMsg *FCRMessage) (
	int64,
	*nodeid.NodeID,
	[]cidoffer.CidGroupOffer,
	error,
)

DecodeProviderDHTPublishGroupCIDRequest is used to get the fields from FCRMessage of ProviderDHTPublishGroupCIDRequest

func DecodeProviderPublishGroupCIDRequest

func DecodeProviderPublishGroupCIDRequest(fcrMsg *FCRMessage) (
	int64,
	*cidoffer.CidGroupOffer,
	error,
)

DecodeProviderPublishGroupCIDRequest is used to get the fields from FCRMessage of ProviderPublishGroupCIDRequest

func DecodeProviderPublishGroupCIDResponse

func DecodeProviderPublishGroupCIDResponse(fcrMsg *FCRMessage) (
	*nodeid.NodeID,
	[CidGroupOfferDigestSize]byte,
	error,
)

DecodeProviderPublishGroupCIDResponse is used to get the fields from FCRMessage of ProviderPublishGroupCIDResponse

func FCRMsgToBytes

func FCRMsgToBytes(fcrMsg *FCRMessage) ([]byte, error)

FCRMsgToBytes converts a FCRMessage to bytes

func GetProtocolVersion

func GetProtocolVersion() (int32, []int32)

GetProtocolVersion gets the current protocol version of all messages

func SetProtocolVersion

func SetProtocolVersion(newProtocolVersion int32, newProtocolSupported []int32)

SetProtocolVersion sets the current protocol version of all messages

Types

type AdminAcceptKeyChallenge

type AdminAcceptKeyChallenge struct {
	PrivateKey        string `json:"privatekey"`
	PrivateKeyVersion uint32 `json:"privatekeyversion"`
}

AdminAcceptKeyChallenge is the request from an admin client to a gateway to generate an initial key pair.

type AdminAcceptKeyResponse

type AdminAcceptKeyResponse struct {
	Exists bool `json:"exists"`
}

AdminAcceptKeyResponse is the response to AdminAcceptKeysResponse

type AdminGetReputationChallenge

type AdminGetReputationChallenge struct {
	ClientID nodeid.NodeID `json:"client_id"`
}

AdminGetReputationChallenge is the request from an admin client to a gateway to discover a client's reputation

type AdminGetReputationResponse

type AdminGetReputationResponse struct {
	ClientID   nodeid.NodeID `json:"clientid"`
	Reputation int64         `json:"reputation"`
	Exists     bool          `json:"exists"`
}

AdminGetReputationResponse is the response to AdminGetReputationChallenge

type AdminSetReputationChallenge

type AdminSetReputationChallenge struct {
	ClientID   nodeid.NodeID `json:"clientid"`
	Reputation int64         `json:"reputation"`
}

AdminSetReputationChallenge is the request from an admin client to a gateway to set a client's reputation

type AdminSetReputationResponse

type AdminSetReputationResponse struct {
	ClientID   nodeid.NodeID `json:"clientid"`
	Reputation int64         `json:"reputation"`
	Exists     bool          `json:"exists"`
}

AdminSetReputationResponse is the response to AdminSetReputationChallenge

type CIDGroupInformation

type CIDGroupInformation struct {
	ProviderID           nodeid.NodeID `json:"provider_id"`
	Price                uint64        `json:"price_per_byte"`
	Expiry               int64         `json:"expiry_date"`
	QoS                  uint64        `json:"qos"`
	Signature            string        `json:"signature"`
	MerkleRoot           string        `json:"merkle_root"`
	FundedPaymentChannel bool          `json:"funded_payment_channel"` // TODO: Is this boolean?
}

CIDGroupInformation represents a cid group information

func DecodeProviderAdminGetGroupCIDResponse

func DecodeProviderAdminGetGroupCIDResponse(fcrMsg *FCRMessage) (
	bool,
	[]CIDGroupInformation,
	error,
)

DecodeProviderAdminGetGroupCIDResponse is used to get the fields from FCRMessage of ProviderAdminGetGroupCIDResponse

type ClientCIDGroupPublishDHTAckRequest

type ClientCIDGroupPublishDHTAckRequest struct {
	PieceCID  cid.ContentID `json:"piece_cid"`
	GatewayID nodeid.NodeID `json:"gateway_id"`
}

ClientCIDGroupPublishDHTAckRequest is the request from client to provider to request the signed ack of a cid group publish

type ClientCIDGroupPublishDHTAckResponse

type ClientCIDGroupPublishDHTAckResponse struct {
	PieceCID                cid.ContentID `json:"piece_cid"`
	GatewayID               nodeid.NodeID `json:"gateway_id"`
	Found                   bool          `json:"found"`
	CIDGroupPublishToDHT    FCRMessage    `json:"cid_group_publish_to_dht"`
	CIDGroupPublishToDHTAck FCRMessage    `json:"cid_group_publish_to_dht_ack"`
}

ClientCIDGroupPublishDHTAckResponse is the response to ClientCIDGroupPublishDHTAckRequest

type ClientDHTDiscoverRequest

type ClientDHTDiscoverRequest struct {
	PieceCID           cid.ContentID `json:"piece_cid"`
	Nonce              int64         `json:"nonce"`
	TTL                int64         `json:"ttl"`
	NumDHT             int64         `json:"num_dht"`
	IncrementalResults bool          `json:"incremental_results"`
}

ClientDHTDiscoverRequest is the request from client to gateway to ask for cid offer using DHT

type ClientDHTDiscoverResponse

type ClientDHTDiscoverResponse struct {
	Contacted     []FCRMessage    `json:"contacted_gateways"`
	UnContactable []nodeid.NodeID `json:"uncontactable_gateways"`
	Nonce         int64           `json:"nonce"`
}

ClientDHTDiscoverResponse is the response to ClientDHTDiscoverRequest

type ClientEstablishmentRequest

type ClientEstablishmentRequest struct {
	ClientID  nodeid.NodeID `json:"client_id"`
	Challenge string        `json:"challenge"`
	TTL       int64         `json:"ttl"`
}

ClientEstablishmentRequest is the request from client to gateway to establish connection

type ClientEstablishmentResponse

type ClientEstablishmentResponse struct {
	GatewayID nodeid.NodeID `json:"gateway_id"`
	Challenge string        `json:"challenge"`
}

ClientEstablishmentResponse is the response to ClientEstablishmentRequest

type ClientStandardDiscoverRequest

type ClientStandardDiscoverRequest struct {
	PieceCID cid.ContentID `json:"piece_cid"`
	Nonce    int64         `json:"nonce"`
	TTL      int64         `json:"ttl"`
}

ClientStandardDiscoverRequest is the requset from client to gateway to ask for cid offer

type ClientStandardDiscoverResponse

type ClientStandardDiscoverResponse struct {
	PieceCID     cid.ContentID         `json:"piece_cid"`
	Nonce        int64                 `json:"nonce"`
	Found        bool                  `json:"found"`
	CIDGroupInfo []CIDGroupInformation `json:"cid_group_information"`
}

ClientStandardDiscoverResponse is the response to ClientStandardDiscoverResponse

type FCRMessage

type FCRMessage struct {
	MessageType       int32   `json:"message_type"`
	ProtocolVersion   int32   `json:"protocol_version"`
	ProtocolSupported []int32 `json:"protocol_supported"`
	MessageBody       []byte  `json:"message_body"`
	Signature         string  `json:"message_signature"`
}

FCRMessage is the message used in communication between filecoin retrieval entities

func DecodeClientDHTDiscoverResponse

func DecodeClientDHTDiscoverResponse(fcrMsg *FCRMessage) (
	[]FCRMessage,
	[]nodeid.NodeID,
	int64,
	error,
)

DecodeClientDHTDiscoverResponse is used to get the fields from FCRMessage of ClientDHTDiscoverResponse

func DecodeGatewaySingleCIDOfferPublishResponse

func DecodeGatewaySingleCIDOfferPublishResponse(fcrMsg *FCRMessage) (
	[]FCRMessage,
	error,
)

DecodeGatewaySingleCIDOfferPublishResponse is used to get the fields from FCRMessage of GatewaySingleCIDOfferPublishResponse

func DecodeGatewaySingleCIDOfferPublishResponseAck

func DecodeGatewaySingleCIDOfferPublishResponseAck(fcrMsg *FCRMessage) (
	[]FCRMessage,
	error,
)

DecodeGatewaySingleCIDOfferPublishResponseAck is used to get the fields from FCRMessage of GatewaySingleCIDOfferPublishResponseAck

func EncodeAdminAcceptKeyChallenge

func EncodeAdminAcceptKeyChallenge(
	privateKey string,
	keyVersion uint32,
) (*FCRMessage, error)

EncodeAdminAcceptKeyChallenge is used to get the FCRMessage of AdminAcceptKeysChallenge

func EncodeAdminAcceptKeyResponse

func EncodeAdminAcceptKeyResponse(
	exists bool,
) (*FCRMessage, error)

EncodeAdminAcceptKeyResponse is used to get the FCRMessage of AdminAcceptKeysResponse TODO: Set fields

func EncodeAdminGetReputationChallenge

func EncodeAdminGetReputationChallenge(clientID *nodeid.NodeID) (*FCRMessage, error)

EncodeAdminGetReputationChallenge is used to get the FCRMessage of AdminGetReputationChallenge

func EncodeAdminGetReputationResponse

func EncodeAdminGetReputationResponse(
	clientID *nodeid.NodeID,
	reputation int64,
	exists bool,
) (*FCRMessage, error)

EncodeAdminGetReputationResponse is used to get the FCRMessage of AdminGetReputationResponse

func EncodeAdminSetReputationChallenge

func EncodeAdminSetReputationChallenge(
	clientID *nodeid.NodeID,
	reputation int64,
) (*FCRMessage, error)

EncodeAdminSetReputationChallenge is used to get the FCRMessage of AdminSetReputationChallenge

func EncodeAdminSetReputationResponse

func EncodeAdminSetReputationResponse(
	clientID *nodeid.NodeID,
	reputation int64,
	exists bool,
) (*FCRMessage, error)

EncodeAdminSetReputationResponse is used to get the FCRMessage of AdminSetReputationResponse

func EncodeClientCIDGroupPublishDHTAckRequest

func EncodeClientCIDGroupPublishDHTAckRequest(
	pieceCID *cid.ContentID,
	gatewayID *nodeid.NodeID,
) (*FCRMessage, error)

EncodeClientCIDGroupPublishDHTAckRequest is used to get the FCRMessage of ClientCIDGroupPublishDHTAckRequest

func EncodeClientCIDGroupPublishDHTAckResponse

func EncodeClientCIDGroupPublishDHTAckResponse(
	pieceCID *cid.ContentID,
	gatewayID *nodeid.NodeID,
	found bool,
	cidGroupPublishToDHT *FCRMessage,
	cidGroupPublishToDHTAck *FCRMessage,
) (*FCRMessage, error)

EncodeClientCIDGroupPublishDHTAckResponse is used to get the FCRMessage of ClientCIDGroupPublishDHTAckResponse

func EncodeClientDHTDiscoverRequest

func EncodeClientDHTDiscoverRequest(
	pieceCID *cid.ContentID,
	nonce int64,
	ttl int64,
	numDHT int64,
	incrementalResults bool,
) (*FCRMessage, error)

EncodeClientDHTDiscoverRequest is used to get the FCRMessage of ClientDHTDiscoverRequest

func EncodeClientDHTDiscoverResponse

func EncodeClientDHTDiscoverResponse(
	contacted []FCRMessage,
	unContactable []nodeid.NodeID,
	nonce int64,
) (*FCRMessage, error)

EncodeClientDHTDiscoverResponse is used to get the FCRMessage of ClientDHTDiscoverResponse

func EncodeClientEstablishmentRequest

func EncodeClientEstablishmentRequest(
	clientID *nodeid.NodeID,
	challenge string,
	ttl int64,
) (*FCRMessage, error)

EncodeClientEstablishmentRequest is used to get the FCRMessage of ClientEstablishmentRequest

func EncodeClientEstablishmentResponse

func EncodeClientEstablishmentResponse(
	gatewayID *nodeid.NodeID,
	challenge string,
) (*FCRMessage, error)

EncodeClientEstablishmentResponse is used to get the FCRMessage of ClientEstablishmentResponse

func EncodeClientStandardDiscoverRequest

func EncodeClientStandardDiscoverRequest(
	pieceCID *cid.ContentID,
	nonce int64,
	ttl int64,
) (*FCRMessage, error)

EncodeClientStandardDiscoverRequest is used to get the FCRMessage of ClientStandardDiscoverRequest

func EncodeClientStandardDiscoverResponse

func EncodeClientStandardDiscoverResponse(
	pieceCID *cid.ContentID,
	nonce int64,
	found bool,
	offers []*cidoffer.CidGroupOffer,
	roots []string,
	fundedPaymentChannel []bool,
) (*FCRMessage, error)

EncodeClientStandardDiscoverResponse is used to get the FCRMessage of ClientStandardDiscoverResponse

func EncodeGatewayDHTDiscoverRequest

func EncodeGatewayDHTDiscoverRequest(
	pieceCID *cid.ContentID,
	nonce int64,
	ttl int64,
) (*FCRMessage, error)

EncodeGatewayDHTDiscoverRequest is used to get the FCRMessage of GatewayDHTDiscoverRequest

func EncodeGatewayDHTDiscoverResponse

func EncodeGatewayDHTDiscoverResponse(
	pieceCID *cid.ContentID,
	nonce int64,
	found bool,
	offers []*cidoffer.CidGroupOffer,
	roots []string,
	fundedPaymentChannel []bool,
) (*FCRMessage, error)

EncodeGatewayDHTDiscoverResponse is used to get the FCRMessage of GatewayDHTDiscoverResponse

func EncodeGatewaySingleCIDOfferPublishRequest

func EncodeGatewaySingleCIDOfferPublishRequest(
	gatewayID *nodeid.NodeID,
	cidMin *cid.ContentID,
	cidMax *cid.ContentID,
	blockHash string,
	transactionReceipt string,
	merkleRoot string,
	merkleProof *fcrmerkletree.FCRMerkleProof,
) (*FCRMessage, error)

EncodeGatewaySingleCIDOfferPublishRequest is used to get the FCRMessage of GatewaySingleCIDOfferPublishRequest

func EncodeGatewaySingleCIDOfferPublishResponse

func EncodeGatewaySingleCIDOfferPublishResponse(
	publishedGroupCIDs []FCRMessage,
) (*FCRMessage, error)

EncodeGatewaySingleCIDOfferPublishResponse is used to get the FCRMessage of GatewaySingleCIDOfferPublishResponse

func EncodeGatewaySingleCIDOfferPublishResponseAck

func EncodeGatewaySingleCIDOfferPublishResponseAck(
	cidOffersAck []FCRMessage,
) (*FCRMessage, error)

EncodeGatewaySingleCIDOfferPublishResponseAck is used to get the FCRMessage of GatewaySingleCIDOfferPublishResponseAck

func EncodeInsufficientFundsResponse

func EncodeInsufficientFundsResponse(paymentChannelID int64) (*FCRMessage, error)

EncodeInsufficientFundsResponse is used to get the FCRMessage of InsufficientFundsResponse

func EncodeInvalidMessageResponse

func EncodeInvalidMessageResponse() (*FCRMessage, error)

EncodeInvalidMessageResponse is used to get the FCRMessage of InvalidMessageResponse

func EncodeProtocolChangeResponse

func EncodeProtocolChangeResponse(desiredVersion int32) (*FCRMessage, error)

EncodeProtocolChangeResponse is used to get the FCRMessage of ProtocolChangeResponse

func EncodeProtocolMismatchResponse

func EncodeProtocolMismatchResponse() (*FCRMessage, error)

EncodeProtocolMismatchResponse is used to get the FCRMessage of ProtocolMismatchResponse

func EncodeProviderAdminGetGroupCIDRequest

func EncodeProviderAdminGetGroupCIDRequest(
	gatewayIDs []nodeid.NodeID,
) (*FCRMessage, error)

EncodeProviderAdminGetGroupCIDRequest is used to get the FCRMessage of ProviderAdminGetGroupCIDRequest

func EncodeProviderAdminGetGroupCIDResponse

func EncodeProviderAdminGetGroupCIDResponse(
	found bool,
	offers []*cidoffer.CidGroupOffer,
	roots []string,
	fundedPaymentChannel []bool,
) (*FCRMessage, error)

EncodeProviderAdminGetGroupCIDResponse is used to get the FCRMessage of ProviderAdminGetGroupCIDResponse

func EncodeProviderDHTPublishGroupCIDAck

func EncodeProviderDHTPublishGroupCIDAck(
	nonce int64,
	signature string,
) (*FCRMessage, error)

EncodeProviderDHTPublishGroupCIDAck is used to get the FCRMessage of ProviderDHTPublishGroupCIDAck

func EncodeProviderDHTPublishGroupCIDRequest

func EncodeProviderDHTPublishGroupCIDRequest(
	nonce int64,
	providerID *nodeid.NodeID,
	offers []cidoffer.CidGroupOffer,
) (*FCRMessage, error)

EncodeProviderDHTPublishGroupCIDRequest is used to get the FCRMessage of ProviderDHTPublishGroupCIDRequest

func EncodeProviderPublishGroupCIDRequest

func EncodeProviderPublishGroupCIDRequest(
	nonce int64,
	offer *cidoffer.CidGroupOffer,
) (*FCRMessage, error)

EncodeProviderPublishGroupCIDRequest is used to get the FCRMessage of ProviderPublishGroupCIDRequest

func EncodeProviderPublishGroupCIDResponse

func EncodeProviderPublishGroupCIDResponse(
	gateaydID nodeid.NodeID,
	digest [CidGroupOfferDigestSize]byte,
) (*FCRMessage, error)

EncodeProviderPublishGroupCIDResponse is used to get the FCRMessage of ProviderPublishGroupCIDResponse

func FCRMsgFromBytes

func FCRMsgFromBytes(data []byte) (*FCRMessage, error)

FCRMsgFromBytes converts a bytes to FCRMessage

func (*FCRMessage) DumpMessage

func (fcrMsg *FCRMessage) DumpMessage() string

DumpMessage display a message with ASCII and hex

func (*FCRMessage) GetMessageBody

func (fcrMsg *FCRMessage) GetMessageBody() []byte

GetMessageBody is used to get the message body

func (*FCRMessage) GetMessageType

func (fcrMsg *FCRMessage) GetMessageType() int32

GetMessageType is used to get the message type of the message

func (*FCRMessage) GetProtocolSupported

func (fcrMsg *FCRMessage) GetProtocolSupported() []int32

GetProtocolSupported is used to get the protocol supported of peer

func (*FCRMessage) GetProtocolVersion

func (fcrMsg *FCRMessage) GetProtocolVersion() int32

GetProtocolVersion is used to get the protocol version of peer

func (*FCRMessage) SignMessage

func (fcrMsg *FCRMessage) SignMessage(sign func(msg interface{}) (string, error)) error

SignMessage is used to sign the message

func (*FCRMessage) VerifySignature

func (fcrMsg *FCRMessage) VerifySignature(verify func(sig string, msg interface{}) (bool, error)) (bool, error)

VerifySignature is used to verify the signature

type GatewayDHTDiscoverRequest

type GatewayDHTDiscoverRequest struct {
	PieceCID cid.ContentID `json:"piece_cid"`
	Nonce    int64         `json:"nonce"`
	TTL      int64         `json:"ttl"`
}

GatewayDHTDiscoverRequest is the request from gateway to gateway to discover cid offer

type GatewayDHTDiscoverResponse

type GatewayDHTDiscoverResponse struct {
	PieceCID     cid.ContentID         `json:"piece_cid"`
	Nonce        int64                 `json:"nonce"`
	Found        bool                  `json:"found"`
	CIDGroupInfo []CIDGroupInformation `json:"cid_group_information"`
}

GatewayDHTDiscoverResponse is the response to GatewayDHTDiscoverRequest

type GatewaySingleCIDOfferPublishRequest

type GatewaySingleCIDOfferPublishRequest struct {
	GatewayID          nodeid.NodeID                `json:"gateway_id"`
	CIDMin             cid.ContentID                `json:"cid_min"`
	CIDMax             cid.ContentID                `json:"cid_max"`
	BlockHash          string                       `json:"block_hash"`
	TransactionReceipt string                       `json:"transaction_receipt"`
	MerkleRoot         string                       `json:"merkle_root"`
	MerkleProof        fcrmerkletree.FCRMerkleProof `json:"merkle_proof"`
}

GatewaySingleCIDOfferPublishRequest is the request from gateway to provider during start-up asking for cid offers

type GatewaySingleCIDOfferPublishResponse

type GatewaySingleCIDOfferPublishResponse struct {
	PublishedGroupCIDs []FCRMessage `json:"published_dht_cid_offers"`
}

GatewaySingleCIDOfferPublishResponse is the repsonse to GatewaySingleCIDOfferPublishRequest

type GatewaySingleCIDOfferPublishResponseAck

type GatewaySingleCIDOfferPublishResponseAck struct {
	CIDOffersAck []FCRMessage `json:"published_dht_cid_offers_ack"`
}

GatewaySingleCIDOfferPublishResponseAck is the acknowledgement to GatewaySingleCIDOfferPublishResponse

type InsufficientFundsResponse

type InsufficientFundsResponse struct {
	PaymentChannelID int64 `json:"payment_channel_id"`
}

InsufficientFundsResponse message is sent to indicate the there are not sufficient funds to finish the request

type InvalidMessageResponse

type InvalidMessageResponse struct {
}

InvalidMessageResponse message is sent to indicate that the message is invalid

type ProtocolChangeResponse

type ProtocolChangeResponse struct {
	DesiredVersion int32 `json:"desired_version"`
}

ProtocolChangeResponse message is sent to indicate that the gateway is requesting the other entity change protocol version

type ProtocolMismatchResponse

type ProtocolMismatchResponse struct {
}

ProtocolMismatchResponse message is sent to indicate that there are no common protocol versions between the gateway and the requesting entity.

type ProviderAdminGetGroupCIDRequest

type ProviderAdminGetGroupCIDRequest struct {
	GatewayIDs []nodeid.NodeID `json:"gateway_id"`
}

ProviderAdminGetGroupCIDRequest is the requset from client to gateway to ask for cid offer

type ProviderAdminGetGroupCIDResponse

type ProviderAdminGetGroupCIDResponse struct {
	Found        bool                  `json:"found"`
	CIDGroupInfo []CIDGroupInformation `json:"cid_group_information"`
}

ProviderAdminGetGroupCIDResponse is the response to ProviderAdminGetGroupCIDResponse

type ProviderDHTPublishGroupCIDAck

type ProviderDHTPublishGroupCIDAck struct {
	Nonce     int64  `json:"nonce"`
	Signature string `json:"signature"`
}

ProviderDHTPublishGroupCIDAck is the acknowledgement to ProviderDHTPublishGroupCIDRequest

type ProviderDHTPublishGroupCIDRequest

type ProviderDHTPublishGroupCIDRequest struct {
	Nonce           int64         `json:"nonce"`
	ProviderID      nodeid.NodeID `json:"provider_id"`
	NumOffers       int64         `json:"num_of_offers"`
	SingleCIDOffers []struct {
		Price     uint64        `json:"price_per_byte"`
		Expiry    int64         `json:"expiry_date"`
		QoS       uint64        `json:"qos"`
		PieceCID  cid.ContentID `json:"piece_cid"`
		Signature string        `json:"signature"`
	} `json:"single_cid_offers"`
}

ProviderDHTPublishGroupCIDRequest is the request from provider to gateway to publish group cid offer using DHT

type ProviderPublishGroupCIDRequest

type ProviderPublishGroupCIDRequest struct {
	Nonce      int64           `json:"nonce"`
	ProviderID nodeid.NodeID   `json:"provider_id"`
	Price      uint64          `json:"price_per_byte"`
	Expiry     int64           `json:"expiry_date"`
	QoS        uint64          `json:"qos"`
	PieceCIDs  []cid.ContentID `json:"piece_cids"`
	Signature  string          `json:"signature"`
}

ProviderPublishGroupCIDRequest is the request from provider to gateway to publish group cid offer

type ProviderPublishGroupCIDResponse

type ProviderPublishGroupCIDResponse struct {
	GateaydID nodeid.NodeID                 `json:"provider_id"`
	Digest    [CidGroupOfferDigestSize]byte `json:"digest"`
}

ProviderPublishGroupCIDResponse is the response from gateway to provider after publishing group cid offer

Jump to

Keyboard shortcuts

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