44 lines
1 KiB
Go
44 lines
1 KiB
Go
package peer
|
|
|
|
import "github.com/lbryio/errors.go"
|
|
|
|
const maxRequestSize = 64 * (2 ^ 10) // 64kb
|
|
|
|
var errRequestTooLarge = errors.Base("request is too large")
|
|
|
|
type availabilityRequest struct {
|
|
LbrycrdAddress bool `json:"lbrycrd_address"`
|
|
RequestedBlobs []string `json:"requested_blobs"`
|
|
}
|
|
|
|
type availabilityResponse struct {
|
|
LbrycrdAddress string `json:"lbrycrd_address"`
|
|
AvailableBlobs []string `json:"available_blobs"`
|
|
}
|
|
|
|
const (
|
|
paymentRateAccepted = "RATE_ACCEPTED"
|
|
paymentRateTooLow = "RATE_TOO_LOW"
|
|
paymentRateUnset = "RATE_UNSET"
|
|
)
|
|
|
|
type paymentRateRequest struct {
|
|
BlobDataPaymentRate float64 `json:"blob_data_payment_rate"`
|
|
}
|
|
|
|
type paymentRateResponse struct {
|
|
BlobDataPaymentRate string `json:"blob_data_payment_rate"`
|
|
}
|
|
|
|
type blobRequest struct {
|
|
RequestedBlob string `json:"requested_blob"`
|
|
}
|
|
|
|
type incomingBlob struct {
|
|
Error string `json:"error,omitempty"`
|
|
BlobHash string `json:"blob_hash"`
|
|
Length int `json:"length"`
|
|
}
|
|
type blobResponse struct {
|
|
IncomingBlob incomingBlob `json:"incoming_blob"`
|
|
}
|