2018-01-29 20:37:26 +01:00
|
|
|
package peer
|
|
|
|
|
2018-02-22 19:48:46 +01:00
|
|
|
import "github.com/lbryio/lbry.go/errors"
|
2018-01-31 02:15:21 +01:00
|
|
|
|
|
|
|
const maxRequestSize = 64 * (2 ^ 10) // 64kb
|
|
|
|
|
|
|
|
var errRequestTooLarge = errors.Base("request is too large")
|
|
|
|
|
2018-01-29 20:37:26 +01:00
|
|
|
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"`
|
|
|
|
}
|