Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb83b2be3b | ||
|
|
ade76e9f24 | ||
|
|
7ea3bf01f5 | ||
|
|
d0c07b4375 | ||
|
|
cf54ec3440 | ||
|
|
18c881f040 | ||
|
|
a01aa6dc06 | ||
|
|
e6a3f40029 | ||
|
|
ced09b22ca | ||
|
|
fa55e82bc1 | ||
|
|
77944ba3af | ||
|
|
5f52a995a7 | ||
|
|
014adbb315 | ||
|
|
73228d1bfb | ||
|
|
69cfd7f798 | ||
|
|
41555cbda2 | ||
|
|
2adb8af5b6 | ||
|
|
9130630afe | ||
|
|
8e6d493fbf | ||
|
|
e19facdded | ||
|
|
365d23f0e2 | ||
|
|
e5ab0f883e | ||
|
|
d0aeb0c22b | ||
|
|
306db74279 | ||
|
|
a0391bec79 | ||
|
|
5d62502bde |
No files matched your search
-29
@@ -1,29 +0,0 @@
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: go
|
||||
go:
|
||||
- 1.15.x
|
||||
|
||||
env:
|
||||
global:
|
||||
- GO111MODULE=on
|
||||
#GITHUB_TOKEN
|
||||
- secure: "P4YMfllsq/guf5swmBl80IHGvNfUM+5X2b+0LvQQxGJpY9TD6d+PW6U1C90HIT0CDk6UZbtlHyGN+oo+shsWnwMIaM4qmbGdRgtG4TZolXY1QtYQZFW9fTWeHM0wnJeXLV8V4vpTRHnkLrvT8PctbGp5pVOEtcV4y3sEnMP1rkxnMPeHtrDbTlpBmBYEziByEpbg3pe3CE9xVaDD9DqgW7VOOZnQQl7exTtjsIeJYI7OYvdidf/04p632/8WZP2EJbmA2HunfTydWtcD51lCF8V3IvhKKqH4/7sNOKfmUwTDyhLltk9eDcFsYR/FYsy8njH4QDBBrKo/bPq3jzgKF9BY7g28/jMTDY4vDY0Na+4a3+7sDqwdsZ+eiZrgWYUbZ4MwYtpUtcvp8gUz7Avs3v7BBgYsYpgLEW47bT6uNLGO+SdfSwBCYuxT5P0IGCv6wkgYcYgfqVafk+9FiwJlayP2j3wPOdauiYh4WnYX1Rt0zNvaiP5iBhkXwIv3VvUcI1Yu9k0eLDibzZlpR8fkGw3USl+omdjCvXDfJQW1ghMONTm0d7VPG84P/MRhJ+thoh1UwMaT3S0sdPznRnNL6XDntCRT1CZW4l0jfyCPDBW2qw8dWunULYsQZTPWnv4s+BuRRDsfGjyamH5b8evh0TOF+XNOFewmNvflWBNG2y0="
|
||||
install: true
|
||||
|
||||
script:
|
||||
# Fail if a .go file hasn't been formatted with gofmt
|
||||
- test -z $(gofmt -s -l $(find . -iname '*.go' -type f))
|
||||
- make
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
deploy:
|
||||
provider: script
|
||||
skip_cleanup: true
|
||||
script: ./scripts/deploy.sh
|
||||
file: bin/lbry
|
||||
on:
|
||||
repo: lbryio/lbry.go
|
||||
tags: true
|
||||
+9
-10
@@ -67,10 +67,9 @@ func (b Bitmap) Big() *big.Int {
|
||||
|
||||
// Cmp compares b and other and returns:
|
||||
//
|
||||
// -1 if b < other
|
||||
// 0 if b == other
|
||||
// +1 if b > other
|
||||
//
|
||||
// -1 if b < other
|
||||
// 0 if b == other
|
||||
// +1 if b > other
|
||||
func (b Bitmap) Cmp(other Bitmap) int {
|
||||
for k := range b {
|
||||
if b[k] < other[k] {
|
||||
@@ -282,13 +281,13 @@ func FromBytesP(data []byte) Bitmap {
|
||||
return bmp
|
||||
}
|
||||
|
||||
//FromString returns a bitmap by converting the string to bytes and creating from bytes as long as the byte array
|
||||
// FromString returns a bitmap by converting the string to bytes and creating from bytes as long as the byte array
|
||||
// is of a specific length specified in the parameters
|
||||
func FromString(data string) (Bitmap, error) {
|
||||
return FromBytes([]byte(data))
|
||||
}
|
||||
|
||||
//FromStringP returns a bitmap by converting the string to bytes and creating from bytes as long as the byte array
|
||||
// FromStringP returns a bitmap by converting the string to bytes and creating from bytes as long as the byte array
|
||||
// is of a specific length specified in the parameters otherwise it wil panic.
|
||||
func FromStringP(data string) Bitmap {
|
||||
bmp, err := FromString(data)
|
||||
@@ -298,7 +297,7 @@ func FromStringP(data string) Bitmap {
|
||||
return bmp
|
||||
}
|
||||
|
||||
//FromHex returns a bitmap by converting the hex string to bytes and creating from bytes as long as the byte array
|
||||
// FromHex returns a bitmap by converting the hex string to bytes and creating from bytes as long as the byte array
|
||||
// is of a specific length specified in the parameters
|
||||
func FromHex(hexStr string) (Bitmap, error) {
|
||||
decoded, err := hex.DecodeString(hexStr)
|
||||
@@ -308,7 +307,7 @@ func FromHex(hexStr string) (Bitmap, error) {
|
||||
return FromBytes(decoded)
|
||||
}
|
||||
|
||||
//FromHexP returns a bitmap by converting the hex string to bytes and creating from bytes as long as the byte array
|
||||
// FromHexP returns a bitmap by converting the hex string to bytes and creating from bytes as long as the byte array
|
||||
// is of a specific length specified in the parameters otherwise it wil panic.
|
||||
func FromHexP(hexStr string) Bitmap {
|
||||
bmp, err := FromHex(hexStr)
|
||||
@@ -318,13 +317,13 @@ func FromHexP(hexStr string) Bitmap {
|
||||
return bmp
|
||||
}
|
||||
|
||||
//FromShortHex returns a bitmap by converting the hex string to bytes, adding the leading zeros prefix to the
|
||||
// FromShortHex returns a bitmap by converting the hex string to bytes, adding the leading zeros prefix to the
|
||||
// hex string and creating from bytes as long as the byte array is of a specific length specified in the parameters
|
||||
func FromShortHex(hexStr string) (Bitmap, error) {
|
||||
return FromHex(strings.Repeat("0", NumBytes*2-len(hexStr)) + hexStr)
|
||||
}
|
||||
|
||||
//FromShortHexP returns a bitmap by converting the hex string to bytes, adding the leading zeros prefix to the
|
||||
// FromShortHexP returns a bitmap by converting the hex string to bytes, adding the leading zeros prefix to the
|
||||
// hex string and creating from bytes as long as the byte array is of a specific length specified in the parameters
|
||||
// otherwise it wil panic.
|
||||
func FromShortHexP(hexStr string) Bitmap {
|
||||
|
||||
+1
-1
@@ -468,7 +468,7 @@ func (n *Node) Store(hash bits.Bitmap, c Contact) {
|
||||
n.store.Upsert(hash, c)
|
||||
}
|
||||
|
||||
//AddKnownNode adds a known-good node to the routing table
|
||||
// AddKnownNode adds a known-good node to the routing table
|
||||
func (n *Node) AddKnownNode(c Contact) {
|
||||
n.rt.Update(c)
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/dht/bits"
|
||||
|
||||
"github.com/lyoshenka/bencode"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
"github.com/lbryio/lbry.go/v2/extras/util"
|
||||
"github.com/lbryio/lbry.go/v2/extras/validator"
|
||||
|
||||
v "github.com/lbryio/ozzo-validation"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
|
||||
+74
-20
@@ -10,21 +10,35 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/structs"
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
|
||||
"github.com/fatih/structs"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/shopspring/decimal"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/ybbus/jsonrpc"
|
||||
"github.com/ybbus/jsonrpc/v2"
|
||||
)
|
||||
|
||||
const DefaultPort = 5279
|
||||
|
||||
const (
|
||||
ErrorWalletNotLoaded = "WalletNotLoadedError"
|
||||
ErrorWalletAlreadyLoaded = "WalletAlreadyLoadedError"
|
||||
ErrorWalletNotFound = "WalletNotFoundError"
|
||||
ErrorWalletAlreadyExists = "WalletAlreadyExistsError"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
conn jsonrpc.RPCClient
|
||||
address string
|
||||
}
|
||||
|
||||
type Error struct {
|
||||
Code int
|
||||
Name string
|
||||
Message string
|
||||
}
|
||||
|
||||
func NewClient(address string) *Client {
|
||||
d := Client{}
|
||||
|
||||
@@ -70,6 +84,15 @@ func Decode(data interface{}, targetStruct interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// WrapError adds error metadata from JSONRPC error response for clients to access
|
||||
func WrapError(rpcError *jsonrpc.RPCError) Error {
|
||||
e := Error{Code: rpcError.Code, Message: rpcError.Message}
|
||||
if d, ok := rpcError.Data.(map[string]interface{}); ok {
|
||||
e.Name = d["name"].(string)
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
func decodeNumber(data interface{}) (decimal.Decimal, error) {
|
||||
var number string
|
||||
|
||||
@@ -106,6 +129,10 @@ func debugParams(params map[string]interface{}) string {
|
||||
return strings.Join(s, " ")
|
||||
}
|
||||
|
||||
func (e Error) Error() string {
|
||||
return fmt.Sprintf("Error in daemon: %s", e.Message)
|
||||
}
|
||||
|
||||
func (d *Client) callNoDecode(command string, params map[string]interface{}) (interface{}, error) {
|
||||
log.Debugln("jsonrpc: " + command + " " + debugParams(params))
|
||||
r, err := d.conn.Call(command, params)
|
||||
@@ -114,7 +141,7 @@ func (d *Client) callNoDecode(command string, params map[string]interface{}) (in
|
||||
}
|
||||
|
||||
if r.Error != nil {
|
||||
return nil, errors.Err("Error in daemon: " + r.Error.Message)
|
||||
return nil, WrapError(r.Error)
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
@@ -138,6 +165,21 @@ func (d *Client) SetRPCTimeout(timeout time.Duration) {
|
||||
// NEW SDK
|
||||
//============================================
|
||||
|
||||
func (d *Client) AccountSend(accountID *string, amount, toAddress string) (*TransactionSummary, error) {
|
||||
response := new(TransactionSummary)
|
||||
args := struct {
|
||||
AccountID *string `json:"account_id"`
|
||||
Amount string `json:"amount"`
|
||||
Addresses string `json:"addresses"`
|
||||
}{
|
||||
AccountID: accountID,
|
||||
Amount: amount,
|
||||
Addresses: toAddress,
|
||||
}
|
||||
structs.DefaultTagName = "json"
|
||||
return response, d.call(response, "account_send", structs.Map(args))
|
||||
}
|
||||
|
||||
func (d *Client) AccountList(page uint64, pageSize uint64) (*AccountListResponse, error) {
|
||||
response := new(AccountListResponse)
|
||||
return response, d.call(response, "account_list", map[string]interface{}{
|
||||
@@ -277,6 +319,7 @@ type ChannelCreateOptions struct {
|
||||
CoverURL *string `json:"cover_url,omitempty"`
|
||||
Featured []string `json:"featured,omitempty"`
|
||||
AccountID *string `json:"account_id,omitempty"`
|
||||
FundingAccountIDs []string `json:"funding_account_ids,omitempty"`
|
||||
}
|
||||
|
||||
func (d *Client) ChannelCreate(name string, bid float64, options ChannelCreateOptions) (*TransactionSummary, error) {
|
||||
@@ -536,24 +579,35 @@ func (d *Client) Resolve(urls string) (*ResolveResponse, error) {
|
||||
})
|
||||
}
|
||||
|
||||
func (d *Client) ClaimSearch(claimName, claimID, txid *string, nout *uint, page uint64, pageSize uint64) (*ClaimSearchResponse, error) {
|
||||
type ClaimSearchArgs struct {
|
||||
ClaimID *string `json:"claim_id,omitempty"`
|
||||
TXID *string `json:"txid,omitempty"`
|
||||
Nout *uint `json:"nout,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
ClaimType []string `json:"claim_type,omitempty"`
|
||||
OrderBy []string `json:"order_by,omitempty"`
|
||||
LimitClaimsPerChannel *int `json:"limit_claims_per_channel,omitempty"`
|
||||
HasNoSource *bool `json:"has_no_source,omitempty"`
|
||||
ReleaseTime string `json:"release_time,omitempty"`
|
||||
ChannelIDs []string `json:"channel_ids,omitempty"`
|
||||
NoTotals *bool `json:"no_totals,omitempty"`
|
||||
IncludeProtobuf *bool `json:"include_protobuf,omitempty"`
|
||||
AnyTags []string `json:"any_tags,omitempty"`
|
||||
|
||||
Page uint64 `json:"page"`
|
||||
PageSize uint64 `json:"page_size"`
|
||||
}
|
||||
|
||||
func (d *Client) ClaimSearch(args ClaimSearchArgs) (*ClaimSearchResponse, error) {
|
||||
response := new(ClaimSearchResponse)
|
||||
args := struct {
|
||||
ClaimID *string `json:"claim_id,omitempty"`
|
||||
TXID *string `json:"txid,omitempty"`
|
||||
Nout *uint `json:"nout,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
IncludeProtobuf bool `json:"include_protobuf"`
|
||||
Page uint64 `json:"page"`
|
||||
PageSize uint64 `json:"page_size"`
|
||||
}{
|
||||
ClaimID: claimID,
|
||||
TXID: txid,
|
||||
Nout: nout,
|
||||
Name: claimName,
|
||||
IncludeProtobuf: true,
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
if args.NoTotals == nil {
|
||||
nototals := true
|
||||
args.NoTotals = ¬otals
|
||||
}
|
||||
|
||||
if args.IncludeProtobuf == nil {
|
||||
include := true
|
||||
args.IncludeProtobuf = &include
|
||||
}
|
||||
structs.DefaultTagName = "json"
|
||||
return response, d.call(response, "claim_search", structs.Map(args))
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/util"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func prettyPrint(i interface{}) {
|
||||
@@ -54,6 +54,32 @@ func TestClient_AccountFund(t *testing.T) {
|
||||
prettyPrint(*got)
|
||||
}
|
||||
|
||||
func TestClient_AccountSend(t *testing.T) {
|
||||
d := NewClient("")
|
||||
accounts, err := d.AccountList(1, 20)
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
if !assert.NotEmpty(t, accounts.Items[1].ID) {
|
||||
return
|
||||
}
|
||||
account := (accounts.Items)[1].ID
|
||||
|
||||
addressess, err := d.AddressList(&account, nil, 1, 20)
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
if !assert.NotEmpty(t, addressess.Items) {
|
||||
return
|
||||
}
|
||||
|
||||
got, err := d.AccountSend(&account, "0.01", string(addressess.Items[0].Address))
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
prettyPrint(*got)
|
||||
}
|
||||
|
||||
func TestClient_AccountList(t *testing.T) {
|
||||
d := NewClient("")
|
||||
got, err := d.AccountList(1, 20)
|
||||
@@ -130,11 +156,11 @@ func TestClient_ChannelCreate(t *testing.T) {
|
||||
State: util.PtrToString("Ticino"),
|
||||
City: util.PtrToString("Lugano"),
|
||||
}},
|
||||
ThumbnailURL: util.PtrToString("https://scrn.storni.info/2019-04-12_15-43-25-001592625.png"),
|
||||
ThumbnailURL: util.PtrToString("https://scrn.storni.info/2022-06-10_17-18-29-409175881.png"),
|
||||
},
|
||||
Email: util.PtrToString("niko@lbry.com"),
|
||||
WebsiteURL: util.PtrToString("https://lbry.com"),
|
||||
CoverURL: util.PtrToString("https://scrn.storni.info/2019-04-12_15-43-25-001592625.png"),
|
||||
CoverURL: util.PtrToString("https://scrn.storni.info/2022-06-10_17-18-29-409175881.png"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -463,7 +489,14 @@ func TestClient_TxoSpendTest(t *testing.T) {
|
||||
|
||||
func TestClient_ClaimSearch(t *testing.T) {
|
||||
d := NewClient("")
|
||||
got, err := d.ClaimSearch(nil, util.PtrToString(channelID), nil, nil, 1, 20)
|
||||
got, err := d.ClaimSearch(ClaimSearchArgs{
|
||||
ChannelIDs: []string{channelID},
|
||||
ReleaseTime: ">1633350820",
|
||||
HasNoSource: util.PtrToBool(true),
|
||||
OrderBy: []string{"^release_time"},
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
@@ -743,11 +776,15 @@ func TestClient_WalletList(t *testing.T) {
|
||||
d := NewClient("")
|
||||
|
||||
id := "lbry#wallet#id:" + fmt.Sprintf("%d", rand.Int())
|
||||
wList, err := d.WalletList(id, 1, 20)
|
||||
_, err := d.WalletList(id, 1, 20)
|
||||
if err == nil {
|
||||
t.Fatalf("wallet %v was unexpectedly found", id)
|
||||
}
|
||||
if !strings.Contains(err.Error(), fmt.Sprintf("Couldn't find wallet: %v.", id)) {
|
||||
derr, ok := err.(Error)
|
||||
if !ok {
|
||||
t.Fatalf("unknown error returned: %s", err)
|
||||
}
|
||||
if derr.Name != ErrorWalletNotLoaded {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -756,7 +793,7 @@ func TestClient_WalletList(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
wList, err = d.WalletList(id, 1, 20)
|
||||
wList, err := d.WalletList(id, 1, 20)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -793,7 +830,7 @@ func TestClient_WalletRemoveWalletAdd(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClient_TransactionSummary(t *testing.T) {
|
||||
d := NewClient("https://api.lbry.tv/api/v1/proxy")
|
||||
d := NewClient("https://api.na-backend.odysee.com/api/v1/proxy")
|
||||
r, err := d.TransactionShow("d104a1616c6af581e2046819de678f370d624e97cf176f95acaec4b183a42db6")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -7,11 +7,12 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
schema "github.com/lbryio/lbry.go/v2/schema/stake"
|
||||
"github.com/lbryio/lbry.go/v2/stream"
|
||||
|
||||
schema "github.com/lbryio/lbry.go/v2/schema/stake"
|
||||
lbryschema "github.com/lbryio/types/v2/go"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
@@ -49,11 +50,10 @@ type File struct {
|
||||
Height int `json:"height"`
|
||||
IsFullyReflected bool `json:"is_fully_reflected"`
|
||||
Key string `json:"key"`
|
||||
Metadata *lbryschema.Claim `json:"protobuf"`
|
||||
Value *lbryschema.Claim `json:"protobuf"`
|
||||
MimeType string `json:"mime_type"`
|
||||
Nout int `json:"nout"`
|
||||
Outpoint string `json:"outpoint"`
|
||||
Protobuf string `json:"protobuf"`
|
||||
PurchaseReceipt interface{} `json:"purchase_receipt"`
|
||||
ReflectorProgress int `json:"reflector_progress"`
|
||||
SdHash string `json:"sd_hash"`
|
||||
@@ -253,10 +253,9 @@ type Transaction struct {
|
||||
PermanentUrl string `json:"permanent_url"`
|
||||
SigningChannel *Claim `json:"signing_channel,omitempty"`
|
||||
TimeStamp uint64 `json:"time_stamp"`
|
||||
Protobuf string `json:"protobuf,omitempty"`
|
||||
Txid string `json:"txid"`
|
||||
Type string `json:"type"`
|
||||
Value *lbryschema.Claim `json:"protobuf"`
|
||||
Value *lbryschema.Claim `json:"protobuf,omitempty"`
|
||||
}
|
||||
|
||||
type TransactionSummary struct {
|
||||
@@ -265,6 +264,7 @@ type TransactionSummary struct {
|
||||
Inputs []Transaction `json:"inputs"`
|
||||
Outputs []Transaction `json:"outputs"`
|
||||
TotalFee string `json:"total_fee"`
|
||||
TotalInput string `json:"total_input"`
|
||||
TotalOutput string `json:"total_output"`
|
||||
Txid string `json:"txid"`
|
||||
}
|
||||
@@ -427,6 +427,33 @@ func (c *Claim) GetStreamSizeByMagic() (streamSize uint64, e error) {
|
||||
return streamSize, nil
|
||||
}
|
||||
|
||||
const (
|
||||
ProtectedContentTag = SpecialContentType("c:members-only")
|
||||
PurchaseContentTag = SpecialContentType("c:purchase:")
|
||||
RentalContentTag = SpecialContentType("c:rental:")
|
||||
PreorderContentTag = SpecialContentType("c:preorder:")
|
||||
LegacyPurchaseContentTag = SpecialContentType("purchase:")
|
||||
LegacyRentalContentTag = SpecialContentType("rental:")
|
||||
LegacyPreorderContentTag = SpecialContentType("preorder:")
|
||||
ScheduledShowContentTag = SpecialContentType("c:scheduled:show")
|
||||
ScheduledHideContentTag = SpecialContentType("c:scheduled:hide")
|
||||
UnlistedContentTag = SpecialContentType("c:unlisted")
|
||||
)
|
||||
|
||||
type SpecialContentType string
|
||||
|
||||
// IsContentSpecial returns true if the claim is of a special content type
|
||||
func (c *Claim) IsContentSpecial(specialTags ...SpecialContentType) bool {
|
||||
for _, t := range c.Value.GetTags() {
|
||||
for _, ct := range specialTags {
|
||||
if strings.Contains(t, string(ct)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type StreamListResponse struct {
|
||||
Items []Claim `json:"items"`
|
||||
Page uint64 `json:"page"`
|
||||
@@ -572,7 +599,7 @@ type transactionListBlob struct {
|
||||
Nout int `json:"nout"`
|
||||
}
|
||||
|
||||
//TODO: this repeats all the fields from transactionListBlob which doesn't make sense
|
||||
// TODO: this repeats all the fields from transactionListBlob which doesn't make sense
|
||||
// but if i extend the type with transactionListBlob it doesn't fill the fields. does our unmarshaller crap out on these?
|
||||
type supportBlob struct {
|
||||
Address string `json:"address"`
|
||||
|
||||
+86
-17
@@ -10,13 +10,12 @@ import (
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultServerAddress = "https://api.lbry.com"
|
||||
defaultServerAddress = "https://api.odysee.tv"
|
||||
timeout = 5 * time.Second
|
||||
headerForwardedFor = "X-Forwarded-For"
|
||||
|
||||
@@ -44,9 +43,36 @@ type ClientOpts struct {
|
||||
|
||||
// APIResponse reflects internal-apis JSON response format.
|
||||
type APIResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Error *string `json:"error"`
|
||||
Data *ResponseData `json:"data"`
|
||||
Success bool `json:"success"`
|
||||
Error *string `json:"error"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type data struct {
|
||||
obj map[string]interface{}
|
||||
array []interface{}
|
||||
}
|
||||
|
||||
func (d data) IsObject() bool {
|
||||
return d.obj != nil
|
||||
}
|
||||
|
||||
func (d data) IsArray() bool {
|
||||
return d.array != nil
|
||||
}
|
||||
|
||||
func (d data) Object() (map[string]interface{}, error) {
|
||||
if d.obj == nil {
|
||||
return nil, errors.New("no object data found")
|
||||
}
|
||||
return d.obj, nil
|
||||
}
|
||||
|
||||
func (d data) Array() ([]interface{}, error) {
|
||||
if d.array == nil {
|
||||
return nil, errors.New("no array data found")
|
||||
}
|
||||
return d.array, nil
|
||||
}
|
||||
|
||||
// APIError wraps errors returned by LBRY API server to discern them from other kinds (like http errors).
|
||||
@@ -59,7 +85,12 @@ func (e APIError) Error() string {
|
||||
}
|
||||
|
||||
// ResponseData is a map containing parsed json response.
|
||||
type ResponseData map[string]interface{}
|
||||
type ResponseData interface {
|
||||
IsObject() bool
|
||||
IsArray() bool
|
||||
Object() (map[string]interface{}, error)
|
||||
Array() ([]interface{}, error)
|
||||
}
|
||||
|
||||
func makeMethodPath(obj, method string) string {
|
||||
return fmt.Sprintf("/%s/%s", obj, method)
|
||||
@@ -111,6 +142,10 @@ func (c Client) getEndpointURL(object, method string) string {
|
||||
return fmt.Sprintf("%s%s", c.serverAddress, makeMethodPath(object, method))
|
||||
}
|
||||
|
||||
func (c Client) getEndpointURLFromPath(path string) string {
|
||||
return fmt.Sprintf("%s%s", c.serverAddress, path)
|
||||
}
|
||||
|
||||
func (c Client) prepareParams(params map[string]interface{}) (string, error) {
|
||||
form := url.Values{}
|
||||
if c.AuthToken != "" {
|
||||
@@ -164,36 +199,70 @@ func (c Client) doCall(url string, payload string) ([]byte, error) {
|
||||
return ioutil.ReadAll(r.Body)
|
||||
}
|
||||
|
||||
// Call calls a remote internal-apis server, returning a response,
|
||||
// CallResource calls a remote internal-apis server resource, returning a response,
|
||||
// wrapped into standardized API Response struct.
|
||||
func (c Client) Call(object, method string, params map[string]interface{}) (ResponseData, error) {
|
||||
var rd ResponseData
|
||||
func (c Client) CallResource(object, method string, params map[string]interface{}) (ResponseData, error) {
|
||||
var d data
|
||||
payload, err := c.prepareParams(params)
|
||||
if err != nil {
|
||||
return rd, err
|
||||
return d, err
|
||||
}
|
||||
|
||||
body, err := c.doCall(c.getEndpointURL(object, method), payload)
|
||||
if err != nil {
|
||||
return rd, err
|
||||
return d, err
|
||||
}
|
||||
var ar APIResponse
|
||||
err = json.Unmarshal(body, &ar)
|
||||
if err != nil {
|
||||
return rd, err
|
||||
return d, err
|
||||
}
|
||||
if !ar.Success {
|
||||
return rd, APIError{errors.New(*ar.Error)}
|
||||
return d, APIError{errors.New(*ar.Error)}
|
||||
}
|
||||
return *ar.Data, err
|
||||
if v, ok := ar.Data.([]interface{}); ok {
|
||||
d.array = v
|
||||
} else if v, ok := ar.Data.(map[string]interface{}); ok {
|
||||
d.obj = v
|
||||
}
|
||||
return d, err
|
||||
}
|
||||
|
||||
// Call calls a remote internal-apis server, returning a response,
|
||||
// wrapped into standardized API Response struct.
|
||||
func (c Client) Call(path string, params map[string]interface{}) (ResponseData, error) {
|
||||
var d data
|
||||
payload, err := c.prepareParams(params)
|
||||
if err != nil {
|
||||
return d, err
|
||||
}
|
||||
|
||||
body, err := c.doCall(c.getEndpointURLFromPath(path), payload)
|
||||
if err != nil {
|
||||
return d, err
|
||||
}
|
||||
var ar APIResponse
|
||||
err = json.Unmarshal(body, &ar)
|
||||
if err != nil {
|
||||
return d, err
|
||||
}
|
||||
if !ar.Success {
|
||||
return d, APIError{errors.New(*ar.Error)}
|
||||
}
|
||||
if v, ok := ar.Data.([]interface{}); ok {
|
||||
d.array = v
|
||||
} else if v, ok := ar.Data.(map[string]interface{}); ok {
|
||||
d.obj = v
|
||||
}
|
||||
return d, err
|
||||
}
|
||||
|
||||
// UserMe returns user details for the user associated with the current auth_token.
|
||||
func (c Client) UserMe() (ResponseData, error) {
|
||||
return c.Call(userObjectPath, userMeMethod, map[string]interface{}{})
|
||||
return c.CallResource(userObjectPath, userMeMethod, map[string]interface{}{})
|
||||
}
|
||||
|
||||
// UserHasVerifiedEmail calls has_verified_email method.
|
||||
func (c Client) UserHasVerifiedEmail() (ResponseData, error) {
|
||||
return c.Call(userObjectPath, userHasVerifiedEmailMethod, map[string]interface{}{})
|
||||
return c.CallResource(userObjectPath, userHasVerifiedEmailMethod, map[string]interface{}{})
|
||||
}
|
||||
@@ -6,9 +6,8 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
func launchDummyServer(lastReq **http.Request, path, response string, status int) *httptest.Server {
|
||||
@@ -42,7 +41,25 @@ func TestUserMe(t *testing.T) {
|
||||
c := NewClient("realToken", &ClientOpts{ServerAddress: ts.URL})
|
||||
r, err := c.UserMe()
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "user@lbry.tv", r["primary_email"])
|
||||
robj, err := r.Object()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, "user@lbry.tv", robj["primary_email"])
|
||||
}
|
||||
|
||||
func TestListFiltered(t *testing.T) {
|
||||
ts := launchDummyServer(nil, "/file/list_filtered", listFilteredResponse, http.StatusOK)
|
||||
defer ts.Close()
|
||||
|
||||
c := NewClient("realToken", &ClientOpts{ServerAddress: ts.URL})
|
||||
r, err := c.CallResource("file", "list_filtered", map[string]interface{}{"with_claim_id": "true"})
|
||||
assert.Nil(t, err)
|
||||
assert.True(t, r.IsArray())
|
||||
_, err = r.Array()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUserHasVerifiedEmail(t *testing.T) {
|
||||
@@ -52,8 +69,12 @@ func TestUserHasVerifiedEmail(t *testing.T) {
|
||||
c := NewClient("realToken", &ClientOpts{ServerAddress: ts.URL})
|
||||
r, err := c.UserHasVerifiedEmail()
|
||||
assert.Nil(t, err)
|
||||
assert.EqualValues(t, 12345, r["user_id"])
|
||||
assert.Equal(t, true, r["has_verified_email"])
|
||||
robj, err := r.Object()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
assert.EqualValues(t, 12345, robj["user_id"])
|
||||
assert.Equal(t, true, robj["has_verified_email"])
|
||||
}
|
||||
|
||||
func TestUserHasVerifiedEmailOAuth(t *testing.T) {
|
||||
@@ -63,8 +84,12 @@ func TestUserHasVerifiedEmailOAuth(t *testing.T) {
|
||||
c := NewOauthClient(oauth2.StaticTokenSource(&oauth2.Token{AccessToken: "Test-Access-Token"}), &ClientOpts{ServerAddress: ts.URL})
|
||||
r, err := c.UserHasVerifiedEmail()
|
||||
assert.Nil(t, err)
|
||||
assert.EqualValues(t, 12345, r["user_id"])
|
||||
assert.Equal(t, true, r["has_verified_email"])
|
||||
robj, err := r.Object()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
assert.EqualValues(t, 12345, robj["user_id"])
|
||||
assert.Equal(t, true, robj["has_verified_email"])
|
||||
}
|
||||
|
||||
func TestRemoteIP(t *testing.T) {
|
||||
@@ -82,7 +107,7 @@ func TestWrongToken(t *testing.T) {
|
||||
c := NewClient("zcasdasc", nil)
|
||||
|
||||
r, err := c.UserHasVerifiedEmail()
|
||||
assert.Nil(t, r)
|
||||
assert.False(t, r.IsObject())
|
||||
assert.EqualError(t, err, "api error: could not authenticate user")
|
||||
assert.ErrorAs(t, err, &APIError{})
|
||||
}
|
||||
@@ -91,7 +116,7 @@ func TestHTTPError(t *testing.T) {
|
||||
c := NewClient("zcasdasc", &ClientOpts{ServerAddress: "http://lolcathost"})
|
||||
|
||||
r, err := c.UserHasVerifiedEmail()
|
||||
assert.Nil(t, r)
|
||||
assert.False(t, r.IsObject())
|
||||
assert.EqualError(t, err, `Post "http://lolcathost/user/has_verified_email": dial tcp: lookup lolcathost: no such host`)
|
||||
}
|
||||
|
||||
@@ -102,7 +127,7 @@ func TestGatewayError(t *testing.T) {
|
||||
c := NewClient("zcasdasc", &ClientOpts{ServerAddress: ts.URL})
|
||||
|
||||
r, err := c.UserHasVerifiedEmail()
|
||||
assert.Nil(t, r)
|
||||
assert.False(t, r.IsObject())
|
||||
assert.EqualError(t, err, `server returned non-OK status: 502`)
|
||||
}
|
||||
|
||||
@@ -139,3 +164,18 @@ const userHasVerifiedEmailResponse = `{
|
||||
"has_verified_email": true
|
||||
}
|
||||
}`
|
||||
|
||||
const listFilteredResponse = `{
|
||||
"success": true,
|
||||
"error": null,
|
||||
"data": [
|
||||
{
|
||||
"claim_id": "322ce77e9085d9da42279c790f7c9755b4916fca",
|
||||
"outpoint": "20e04af21a569061ced7aa1801a43b4ed4839dfeb79919ea49a4059c7fe114c5:0"
|
||||
},
|
||||
{
|
||||
"claim_id": "61496c567badcd98b82d9a700a8d56fd8a5fa8fb",
|
||||
"outpoint": "657e4ec774524b326f9d3ecb9f468ea085bd1f3d450565f0330feca02e8fd25b:0"
|
||||
}
|
||||
]
|
||||
}`
|
||||
@@ -56,7 +56,7 @@ func (o *Map) Set(key string, value interface{}) {
|
||||
|
||||
const outOfRange = "position value %d is outside of the range %d - %d"
|
||||
|
||||
//InsertAt This is a zero based position index: 0,1,2,3..n(from left) OR -1,-2,-3...-n(from right) where -1 is the last place.
|
||||
// InsertAt This is a zero based position index: 0,1,2,3..n(from left) OR -1,-2,-3...-n(from right) where -1 is the last place.
|
||||
func (o *Map) InsertAt(key string, value interface{}, position int) error {
|
||||
o.l.Lock()
|
||||
defer o.l.Unlock()
|
||||
|
||||
+8
-6
@@ -1,7 +1,9 @@
|
||||
/*Package stop implements the stopper pattern for golang concurrency management. The main use case is to gracefully
|
||||
exit an application. The pattern allows for a hierarchy of stoppers. Each package should have its own unexported stopper.
|
||||
The package should maintain startup and shutdown exported methods. If the stopper should stop when another stopper for
|
||||
a different package stops, the parent argument for the initialization of a stopper be used to create the dependency.
|
||||
/*
|
||||
Package stop implements the stopper pattern for golang concurrency management. The main use case is to gracefully
|
||||
|
||||
exit an application. The pattern allows for a hierarchy of stoppers. Each package should have its own unexported stopper.
|
||||
The package should maintain startup and shutdown exported methods. If the stopper should stop when another stopper for
|
||||
a different package stops, the parent argument for the initialization of a stopper be used to create the dependency.
|
||||
|
||||
The package also comes with a debugging tool to help in determining why and where a stopper is not stopping as expected.
|
||||
If a more complex concurrency is used, it is recommended to implement the library using `DoneNamed` and `AddNamed`.
|
||||
@@ -75,7 +77,7 @@ func (s *Group) Child() *Group {
|
||||
return New(s)
|
||||
}
|
||||
|
||||
//AddNamed is the same as Add but will register the functional name of the routine for later output. See `DoneNamed`.
|
||||
// AddNamed is the same as Add but will register the functional name of the routine for later output. See `DoneNamed`.
|
||||
func (s *Group) AddNamed(delta int, name string) {
|
||||
s.Add(delta)
|
||||
|
||||
@@ -95,7 +97,7 @@ func (s *Group) AddNamed(delta int, name string) {
|
||||
}
|
||||
}
|
||||
|
||||
//DoneNamed is the same as `Done` but will output the functional name of all remaining named routines and the waiting on count.
|
||||
// DoneNamed is the same as `Done` but will output the functional name of all remaining named routines and the waiting on count.
|
||||
func (s *Group) DoneNamed(name string) {
|
||||
defer s.Done()
|
||||
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
package travis
|
||||
|
||||
/*
|
||||
Copyright 2017 Shapath Neupane (@theshapguy)
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------
|
||||
Listener - written in Go because it's native web server is much more robust than Python. Plus its fun to write Go!
|
||||
NOTE: Make sure you are using the right domain for travis [.com] or [.org]
|
||||
Modified by wilsonk@lbry.io for LBRY internal-apis
|
||||
*/
|
||||
|
||||
import (
|
||||
"crypto"
|
||||
"crypto/rsa"
|
||||
"crypto/sha1"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"net/http"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
)
|
||||
|
||||
func publicKey(isPrivateRepo bool) (*rsa.PublicKey, error) {
|
||||
var response *http.Response
|
||||
var err error
|
||||
if !isPrivateRepo {
|
||||
response, err = http.Get("https://api.travis-ci.org/config")
|
||||
} else {
|
||||
response, err = http.Get("https://api.travis-ci.com/config")
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Err("cannot fetch travis public key")
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
type configKey struct {
|
||||
Config struct {
|
||||
Notifications struct {
|
||||
Webhook struct {
|
||||
PublicKey string `json:"public_key"`
|
||||
} `json:"webhook"`
|
||||
} `json:"notifications"`
|
||||
} `json:"config"`
|
||||
}
|
||||
|
||||
var t configKey
|
||||
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
err = decoder.Decode(&t)
|
||||
if err != nil {
|
||||
return nil, errors.Err("cannot decode travis public key")
|
||||
}
|
||||
|
||||
keyBlock, _ := pem.Decode([]byte(t.Config.Notifications.Webhook.PublicKey))
|
||||
if keyBlock == nil || keyBlock.Type != "PUBLIC KEY" {
|
||||
return nil, errors.Err("invalid travis public key")
|
||||
}
|
||||
|
||||
publicKey, err := x509.ParsePKIXPublicKey(keyBlock.Bytes)
|
||||
if err != nil {
|
||||
return nil, errors.Err("invalid travis public key")
|
||||
}
|
||||
|
||||
return publicKey.(*rsa.PublicKey), nil
|
||||
}
|
||||
|
||||
func payloadDigest(payload string) []byte {
|
||||
hash := sha1.New()
|
||||
hash.Write([]byte(payload))
|
||||
return hash.Sum(nil)
|
||||
}
|
||||
|
||||
func ValidateSignature(isPrivateRepo bool, r *http.Request) error {
|
||||
key, err := publicKey(isPrivateRepo)
|
||||
if err != nil {
|
||||
return errors.Err(err)
|
||||
}
|
||||
|
||||
signature, err := base64.StdEncoding.DecodeString(r.Header.Get("Signature"))
|
||||
if err != nil {
|
||||
return errors.Err("cannot decode signature")
|
||||
}
|
||||
|
||||
payload := payloadDigest(r.FormValue("payload"))
|
||||
|
||||
err = rsa.VerifyPKCS1v15(key, crypto.SHA1, payload, signature)
|
||||
if err != nil {
|
||||
if err == rsa.ErrVerification {
|
||||
return errors.Err("invalid payload signature")
|
||||
}
|
||||
return errors.Err(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewFromRequest(r *http.Request) (*Webhook, error) {
|
||||
w := new(Webhook)
|
||||
|
||||
err := json.Unmarshal([]byte(r.FormValue("payload")), w)
|
||||
if err != nil {
|
||||
return nil, errors.Err(err)
|
||||
}
|
||||
|
||||
return w, nil
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package travis
|
||||
|
||||
import "time"
|
||||
|
||||
// https://docs.travis-ci.com/user/notifications/#Webhooks-Delivery-Format
|
||||
|
||||
const (
|
||||
statusSuccess = 0
|
||||
statusNotSuccess = 1
|
||||
)
|
||||
|
||||
type Webhook struct {
|
||||
ID int `json:"id"`
|
||||
Number string `json:"number"`
|
||||
Type string `json:"type"`
|
||||
State string `json:"state"`
|
||||
Status int `json:"status"` // status and result are the same
|
||||
Result int `json:"result"`
|
||||
StatusMessage string `json:"status_message"` // status_message and result_message are the same
|
||||
ResultMessage string `json:"result_message"`
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
FinishedAt time.Time `json:"finished_at"`
|
||||
Duration int `json:"duration"`
|
||||
BuildURL string `json:"build_url"`
|
||||
CommitID int `json:"commit_id"`
|
||||
Commit string `json:"commit"`
|
||||
BaseCommit string `json:"base_commit"`
|
||||
HeadCommit string `json:"head_commit"`
|
||||
Branch string `json:"branch"`
|
||||
Message string `json:"message"`
|
||||
CompareURL string `json:"compare_url"`
|
||||
CommittedAt time.Time `json:"committed_at"`
|
||||
AuthorName string `json:"author_name"`
|
||||
AuthorEmail string `json:"author_email"`
|
||||
CommitterName string `json:"committer_name"`
|
||||
CommitterEmail string `json:"committer_email"`
|
||||
PullRequest bool `json:"pull_request"`
|
||||
PullRequestNumber int `json:"pull_request_number"`
|
||||
PullRequestTitle string `json:"pull_request_title"`
|
||||
Tag string `json:"tag"`
|
||||
Repository Repository `json:"repository"`
|
||||
}
|
||||
|
||||
type Repository struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
OwnerName string `json:"owner_name"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// IsMatch make sure the webhook is for you...
|
||||
func (w Webhook) IsMatch(branch string, repo string, owner string) bool {
|
||||
return w.Branch == branch &&
|
||||
w.Repository.Name == repo &&
|
||||
w.Repository.OwnerName == owner
|
||||
}
|
||||
|
||||
func (w Webhook) ShouldDeploy() bool {
|
||||
// when travis builds a pull request, Branch is the target branch, not the origin branch
|
||||
// source: https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
|
||||
return w.Status == statusSuccess && w.Branch == "master" && !w.PullRequest
|
||||
}
|
||||
|
||||
func (w Webhook) DeploySummary() string {
|
||||
return w.Commit[:8] + ": " + w.Message
|
||||
}
|
||||
+23
-3
@@ -2,12 +2,15 @@ package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
|
||||
"github.com/nlopes/slack"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/slack-go/slack"
|
||||
)
|
||||
|
||||
var defaultChannel string
|
||||
@@ -16,7 +19,18 @@ var slackApi *slack.Client
|
||||
|
||||
// InitSlack Initializes a slack client with the given token and sets the default channel.
|
||||
func InitSlack(token string, channel string, username string) {
|
||||
slackApi = slack.New(token)
|
||||
c := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).DialContext,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ResponseHeaderTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
},
|
||||
}
|
||||
slackApi = slack.New(token, slack.OptionHTTPClient(c))
|
||||
defaultChannel = channel
|
||||
defaultUsername = username
|
||||
}
|
||||
@@ -65,7 +79,13 @@ func sendToSlack(channel, username, message string) error {
|
||||
err = errors.Err("no slack token provided")
|
||||
} else {
|
||||
log.Debugln("slack: " + channel + ": " + message)
|
||||
_, _, err = slackApi.PostMessage(channel, slack.MsgOptionText(message, false), slack.MsgOptionUsername(username))
|
||||
for {
|
||||
_, _, err = slackApi.PostMessage(channel, slack.MsgOptionText(message, false), slack.MsgOptionUsername(username))
|
||||
if err != nil && strings.Contains(err.Error(), "timeout awaiting response headers") {
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -2,9 +2,10 @@ package util
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/unicode/norm"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func StringSplitArg(stringToSplit, separator string) []interface{} {
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
go 1.25
|
||||
|
||||
module github.com/lbryio/lbry.go/v2
|
||||
|
||||
replace github.com/btcsuite/btcd => github.com/lbryio/lbrycrd.go v0.0.0-20200203050410-e1076f12bf19
|
||||
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
|
||||
github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32
|
||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
github.com/fatih/structs v1.1.0
|
||||
github.com/go-errors/errors v1.1.1
|
||||
github.com/go-ini/ini v1.48.0
|
||||
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible // indirect
|
||||
github.com/golang/protobuf v1.3.2
|
||||
github.com/google/go-cmp v0.3.1 // indirect
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190915194858-d3ddacdb130f // indirect
|
||||
github.com/gorilla/mux v1.7.3
|
||||
github.com/gorilla/rpc v1.2.0
|
||||
github.com/gorilla/websocket v1.4.1 // indirect
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/lbryio/ozzo-validation v0.0.0-20170323141101-d1008ad1fd04
|
||||
github.com/lbryio/types v0.0.0-20201019032447-f0b4476ef386
|
||||
github.com/go-errors/errors v1.5.1
|
||||
github.com/golang/protobuf v1.5.4
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/gorilla/rpc v1.2.1
|
||||
github.com/lbryio/ozzo-validation v3.0.3-0.20170512160344-202201e212ec+incompatible
|
||||
github.com/lbryio/types v0.0.0-20220224142228-73610f6654a6
|
||||
github.com/lyoshenka/bencode v0.0.0-20180323155644-b7abd7672df5
|
||||
github.com/mitchellh/mapstructure v1.1.2
|
||||
github.com/nlopes/slack v0.6.0
|
||||
github.com/onsi/gomega v1.7.0 // indirect
|
||||
github.com/pkg/errors v0.8.1 // indirect
|
||||
github.com/sebdah/goldie v0.0.0-20190531093107-d313ffb52c77
|
||||
github.com/sergi/go-diff v1.0.0
|
||||
github.com/shopspring/decimal v0.0.0-20191009025716-f1972eb1d1f5
|
||||
github.com/sirupsen/logrus v1.4.2
|
||||
github.com/smartystreets/assertions v1.0.1 // indirect
|
||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
|
||||
github.com/spf13/cast v1.3.0
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/ybbus/jsonrpc v0.0.0-20180411222309-2a548b7d822d
|
||||
go.uber.org/atomic v1.4.0
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
|
||||
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
|
||||
golang.org/x/sys v0.0.0-20191009170203-06d7bd2c5f4f // indirect
|
||||
golang.org/x/text v0.3.2
|
||||
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0
|
||||
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03 // indirect
|
||||
google.golang.org/grpc v1.24.0
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||
gopkg.in/ini.v1 v1.48.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/sebdah/goldie v1.0.0
|
||||
github.com/sergi/go-diff v1.4.0
|
||||
github.com/shopspring/decimal v1.4.0
|
||||
github.com/sirupsen/logrus v1.9.4
|
||||
github.com/slack-go/slack v0.17.3
|
||||
github.com/spf13/cast v1.10.0
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/ybbus/jsonrpc/v2 v2.1.7
|
||||
go.uber.org/atomic v1.11.0
|
||||
golang.org/x/crypto v0.47.0
|
||||
golang.org/x/net v0.49.0
|
||||
golang.org/x/oauth2 v0.34.0
|
||||
golang.org/x/text v0.33.0
|
||||
golang.org/x/time v0.14.0
|
||||
google.golang.org/grpc v1.78.0
|
||||
gopkg.in/ini.v1 v1.67.1
|
||||
gopkg.in/nullbio/null.v6 v6.0.0-20161116030900-40264a2e6b79
|
||||
gopkg.in/yaml.v2 v2.2.4 // indirect
|
||||
gotest.tools v2.2.0+incompatible
|
||||
)
|
||||
|
||||
go 1.16
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect
|
||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
|
||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/onsi/gomega v1.7.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/protobuf v1.36.10 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
@@ -1,5 +1,3 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
@@ -14,163 +12,148 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
|
||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc=
|
||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
||||
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/go-errors/errors v1.1.1 h1:ljK/pL5ltg3qoN+OtN6yCv9HWSfMwxSx90GJCZQxYNg=
|
||||
github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs=
|
||||
github.com/go-ini/ini v1.48.0 h1:TvO60hO/2xgaaTWp2P0wUe4CFxwdMzfbkv3+343Xzqw=
|
||||
github.com/go-ini/ini v1.48.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/GeYW1cILu7Nuuj1N3BBkE=
|
||||
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
|
||||
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U=
|
||||
github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190915194858-d3ddacdb130f h1:TyqzGm2z1h3AGhjOoRYyeLcW4WlW81MDQkWa+rx/000=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190915194858-d3ddacdb130f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk=
|
||||
github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ=
|
||||
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
|
||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
github.com/gorilla/rpc v1.2.1 h1:yC+LMV5esttgpVvNORL/xX4jvTTEUE30UZhZ5JF7K9k=
|
||||
github.com/gorilla/rpc v1.2.1/go.mod h1:uNpOihAlF5xRFLuTYhfR0yfCTm0WTQSQttkMSptRfGk=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
|
||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lbryio/lbrycrd.go v0.0.0-20200203050410-e1076f12bf19 h1:/zWD8dVIl7bV1TdJWqPqy9tpqixzX2Qxgit48h3hQcY=
|
||||
github.com/lbryio/lbrycrd.go v0.0.0-20200203050410-e1076f12bf19/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||
github.com/lbryio/ozzo-validation v0.0.0-20170323141101-d1008ad1fd04 h1:Nze+C2HbeKvhjI/kVn+9Poj/UuEW5sOQxcsxqO7L3GI=
|
||||
github.com/lbryio/ozzo-validation v0.0.0-20170323141101-d1008ad1fd04/go.mod h1:fbG/dzobG8r95KzMwckXiLMHfFjZaBRQqC9hPs2XAQ4=
|
||||
github.com/lbryio/types v0.0.0-20201019032447-f0b4476ef386 h1:JOQkGpeCM9FWkEHRx+kRPqySPCXElNW1em1++7tVS4M=
|
||||
github.com/lbryio/types v0.0.0-20201019032447-f0b4476ef386/go.mod h1:CG3wsDv5BiVYQd5i1Jp7wGsaVyjZTJshqXeWMVKsISE=
|
||||
github.com/lbryio/ozzo-validation v3.0.3-0.20170512160344-202201e212ec+incompatible h1:OH/jgRO/2lQ73n7PgtK/CvLZ0dwAVr5G5s635+YfUA4=
|
||||
github.com/lbryio/ozzo-validation v3.0.3-0.20170512160344-202201e212ec+incompatible/go.mod h1:fbG/dzobG8r95KzMwckXiLMHfFjZaBRQqC9hPs2XAQ4=
|
||||
github.com/lbryio/types v0.0.0-20220224142228-73610f6654a6 h1:IhL9D2QfDWhLNDQpZ3Uiiw0gZEUYeLBS6uDqOd59G5o=
|
||||
github.com/lbryio/types v0.0.0-20220224142228-73610f6654a6/go.mod h1:CG3wsDv5BiVYQd5i1Jp7wGsaVyjZTJshqXeWMVKsISE=
|
||||
github.com/lyoshenka/bencode v0.0.0-20180323155644-b7abd7672df5 h1:mG83tLXWSRdcXMWfkoumVwhcCbf3jHF9QKv/m37BkM0=
|
||||
github.com/lyoshenka/bencode v0.0.0-20180323155644-b7abd7672df5/go.mod h1:H0aPCWffGOaDcjkw1iB7W9DVLp6GXmfcJY/7YZCWPA4=
|
||||
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/nlopes/slack v0.6.0 h1:jt0jxVQGhssx1Ib7naAOZEZcGdtIhTzkP0nopK0AsRA=
|
||||
github.com/nlopes/slack v0.6.0/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
|
||||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sebdah/goldie v0.0.0-20190531093107-d313ffb52c77 h1:Msb6XRY62jQOueNNlB5LGin1rljK7c49NLniGwJG2bg=
|
||||
github.com/sebdah/goldie v0.0.0-20190531093107-d313ffb52c77/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shopspring/decimal v0.0.0-20191009025716-f1972eb1d1f5 h1:Gojs/hac/DoYEM7WEICT45+hNWczIeuL5D21e5/HPAw=
|
||||
github.com/shopspring/decimal v0.0.0-20191009025716-f1972eb1d1f5/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
|
||||
github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/sebdah/goldie v1.0.0 h1:9GNhIat69MSlz/ndaBg48vl9dF5fI+NBB6kfOxgfkMc=
|
||||
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
|
||||
github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
|
||||
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
|
||||
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
|
||||
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
|
||||
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
|
||||
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
|
||||
github.com/slack-go/slack v0.17.3 h1:zV5qO3Q+WJAQ/XwbGfNFrRMaJ5T/naqaonyPV/1TP4g=
|
||||
github.com/slack-go/slack v0.17.3/go.mod h1:X+UqOufi3LYQHDnMG1vxf0J8asC6+WllXrVrhl8/Prk=
|
||||
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
|
||||
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/ybbus/jsonrpc v0.0.0-20180411222309-2a548b7d822d h1:tQo6hjclyv3RHUgZOl6iWb2Y44A/sN9bf9LAYfuioEg=
|
||||
github.com/ybbus/jsonrpc v0.0.0-20180411222309-2a548b7d822d/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE=
|
||||
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/ybbus/jsonrpc/v2 v2.1.7 h1:QjoXuZhkXZ3oLBkrONBe2avzFkYeYLorpeA+d8175XQ=
|
||||
github.com/ybbus/jsonrpc/v2 v2.1.7/go.mod h1:rIuG1+ORoiqocf9xs/v+ecaAVeo3zcZHQgInyKFMeg0=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
|
||||
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
|
||||
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
|
||||
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
|
||||
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
|
||||
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc h1:c0o/qxkaO2LF5t6fQrT4b5hzyggAkLLlCUjqfRxd8Q4=
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
|
||||
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb h1:TR699M2v0qoKTOHxeLgp6zPqaQNs74f01a/ob9W0qko=
|
||||
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
||||
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
||||
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
|
||||
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191009170203-06d7bd2c5f4f h1:hjzMYz/7Ea1mNKfOnFOfktR0mlA5jqhvywClCMHM/qw=
|
||||
golang.org/x/sys v0.0.0-20191009170203-06d7bd2c5f4f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
||||
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 h1:xQwXv67TxFo9nC1GJFyab5eq/5B590r6RlnL/G8Sz7w=
|
||||
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03 h1:4HYDjxeNXAOTv3o1N2tjo8UUSlhQgAD52FVkwxnWgM8=
|
||||
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s=
|
||||
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
|
||||
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
|
||||
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
|
||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w=
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
|
||||
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
|
||||
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
|
||||
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
|
||||
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/ini.v1 v1.48.0 h1:URjZc+8ugRY5mL5uUeQH/a63JcHwdX9xZaWvmNWD7z8=
|
||||
gopkg.in/ini.v1 v1.48.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.67.1 h1:tVBILHy0R6e4wkYOn3XmiITt/hEVH4TFMYvAX2Ytz6k=
|
||||
gopkg.in/ini.v1 v1.67.1/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss=
|
||||
gopkg.in/nullbio/null.v6 v6.0.0-20161116030900-40264a2e6b79 h1:FpCr9V8wuOei4BAen+93HtVJ+XSi+KPbaPKm0Vj5R64=
|
||||
gopkg.in/nullbio/null.v6 v6.0.0-20161116030900-40264a2e6b79/go.mod h1:gWkaRU7CoXpezCBWfWjm3999QqS+1pYPXGbqQCTMzo8=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
+3
-1
@@ -1,11 +1,13 @@
|
||||
package lbrycrd
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
"github.com/lbryio/lbry.go/v2/schema/keys"
|
||||
c "github.com/lbryio/lbry.go/v2/schema/stake"
|
||||
|
||||
pb "github.com/lbryio/types/v2/go"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
)
|
||||
|
||||
func NewChannel() (*c.StakeHelper, *btcec.PrivateKey, error) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
c "github.com/lbryio/lbry.go/v2/schema/stake"
|
||||
|
||||
pb "github.com/lbryio/types/v2/go"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/go-ini/ini"
|
||||
"gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
const DefaultPort = 9245
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
lbry.go is a set of tools and projects implemented in Golang. See each subfolder for more details
|
||||
|
||||
[](https://travis-ci.org/lbryio/lbry.go)
|
||||
**there are significant updates in the [v3 branch](https://github.com/lbryio/lbry.go/tree/v3). if you're starting a new project, strongly consider using that version instead**
|
||||
|
||||
This project uses Go modules. Make sure you have Go 1.11+ installed.
|
||||
This project uses Go modules. Make sure you have Go 1.25+ installed.
|
||||
|
||||
- Ubuntu: https://launchpad.net/~longsleep/+archive/ubuntu/golang-backports or https://github.com/golang/go/wiki/Ubuntu
|
||||
- OSX: `brew install go`
|
||||
@@ -24,7 +24,7 @@ Make sure you `go fmt` your code before submitting PRs.
|
||||
|
||||
This codebase follows the semver standards. You can find the releases [here](https://github.com/lbryio/lbry.go/releases)
|
||||
|
||||
You can include the libraries by running `go get github.com/lbryio/lbry.go@latest`.
|
||||
You can include the libraries by running `go get github.com/lbryio/lbry.go/v2@master`.
|
||||
You can lock (and you should) to a version whenever you make use of this set of libraries.
|
||||
|
||||
## License
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.15.x
|
||||
|
||||
script:
|
||||
- ./build_and_test.sh
|
||||
+6
-3
@@ -42,7 +42,7 @@ func PublicKeyToDER(publicKey *btcec.PublicKey) ([]byte, error) {
|
||||
|
||||
}
|
||||
|
||||
//This type provides compatibility with the btcec package
|
||||
// This type provides compatibility with the btcec package
|
||||
type ecPrivateKey struct {
|
||||
Version int
|
||||
PrivateKey []byte
|
||||
@@ -62,12 +62,15 @@ func PrivateKeyToDER(key *btcec.PrivateKey) ([]byte, error) {
|
||||
}
|
||||
|
||||
func GetPublicKeyFromBytes(pubKeyBytes []byte) (*btcec.PublicKey, error) {
|
||||
if len(pubKeyBytes) == 33 {
|
||||
return btcec.ParsePubKey(pubKeyBytes, btcec.S256())
|
||||
}
|
||||
PKInfo := publicKeyInfo{}
|
||||
_, err := asn1.Unmarshal(pubKeyBytes, &PKInfo)
|
||||
if err != nil {
|
||||
return nil, errors.Err(err)
|
||||
}
|
||||
pubkeyBytes1 := []byte(PKInfo.PublicKey.Bytes)
|
||||
pubkeyBytes1 := PKInfo.PublicKey.Bytes
|
||||
return btcec.ParsePubKey(pubkeyBytes1, btcec.S256())
|
||||
}
|
||||
|
||||
@@ -81,7 +84,7 @@ func GetPrivateKeyFromBytes(privKeyBytes []byte) (*btcec.PrivateKey, *btcec.Publ
|
||||
return priv, publ, nil
|
||||
}
|
||||
|
||||
//Returns a btec.Private key object if provided a correct secp256k1 encoded pem.
|
||||
// Returns a btec.Private key object if provided a correct secp256k1 encoded pem.
|
||||
func ExtractKeyFromPem(pm string) (*btcec.PrivateKey, *btcec.PublicKey) {
|
||||
byta := []byte(pm)
|
||||
blck, _ := pem.Decode(byta)
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
|
||||
v1pb "github.com/lbryio/types/v1/go"
|
||||
pb "github.com/lbryio/types/v2/go"
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
|
||||
legacy "github.com/lbryio/types/v1/go"
|
||||
pb "github.com/lbryio/types/v2/go"
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
pb "github.com/lbryio/types/v2/go"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/schema/keys"
|
||||
|
||||
pb "github.com/lbryio/types/v2/go"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"gotest.tools/assert"
|
||||
)
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
"github.com/lbryio/lbry.go/v2/schema/address"
|
||||
"github.com/lbryio/lbry.go/v2/schema/keys"
|
||||
|
||||
legacy_pb "github.com/lbryio/types/v1/go"
|
||||
pb "github.com/lbryio/types/v2/go"
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
GO111MODULE=off go get github.com/caarlos0/svu
|
||||
go install github.com/caarlos0/svu@latest
|
||||
git tag `svu "$1"`
|
||||
git push --tags
|
||||
@@ -3,6 +3,7 @@ package stream
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha512"
|
||||
"fmt"
|
||||
"hash"
|
||||
"io"
|
||||
"math"
|
||||
@@ -170,6 +171,7 @@ func (e *Encoder) Next() (Blob, error) {
|
||||
}
|
||||
|
||||
// Stream creates the whole stream in one call
|
||||
// TODO: Can be refactored to use Encode method
|
||||
func (e *Encoder) Stream() (Stream, error) {
|
||||
s := make(Stream, 1, 1+int(math.Ceil(float64(e.srcSizeHint)/maxBlobDataSize))) // len starts at 1 and cap is +1 to leave room for sd blob
|
||||
|
||||
@@ -196,6 +198,37 @@ func (e *Encoder) Stream() (Stream, error) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// Encode splits the source into blobs and feeds them into handler function
|
||||
func (e *Encoder) Encode(handler func(string, []byte) error) ([]string, error) {
|
||||
manifest := []string{}
|
||||
|
||||
for {
|
||||
blob, err := e.Next()
|
||||
if err != nil {
|
||||
if errors.Is(err, io.EOF) {
|
||||
break
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = handler(blob.HashHex(), blob)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot process blob: %w", err)
|
||||
}
|
||||
manifest = append(manifest, blob.HashHex())
|
||||
}
|
||||
|
||||
sdb := e.SDBlob().ToBlob()
|
||||
h := sdb.HashHex()
|
||||
err := handler(h, sdb)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot handle SD blob: %w", err)
|
||||
}
|
||||
manifest = append([]string{h}, manifest...)
|
||||
|
||||
return manifest, nil
|
||||
}
|
||||
|
||||
// SDBlob returns the sd blob so far
|
||||
func (e *Encoder) SDBlob() *SDBlob {
|
||||
e.sd.updateStreamHash()
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
"crypto/sha512"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
@@ -55,6 +57,9 @@ func TestStreamToFile(t *testing.T) {
|
||||
|
||||
enc := NewEncoderFromSD(bytes.NewBuffer(data), sdBlob)
|
||||
newStream, err := enc.Stream()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(newStream) != len(testdataBlobHashes) {
|
||||
t.Fatalf("stream length mismatch. got %d blobs, expected %d", len(newStream), len(testdataBlobHashes))
|
||||
@@ -138,6 +143,78 @@ func TestMakeStream(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncode(t *testing.T) {
|
||||
blobsToRead := 3
|
||||
totalBlobs := blobsToRead + 3
|
||||
|
||||
data := make([]byte, ((totalBlobs-1)*maxBlobDataSize)+1000) // last blob is partial
|
||||
_, err := rand.Read(data)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
buf := bytes.NewBuffer(data)
|
||||
|
||||
enc := NewEncoder(buf)
|
||||
|
||||
stream := make(Stream, blobsToRead+1) // +1 for sd blob
|
||||
for i := 1; i < blobsToRead+1; i++ { // start at 1 to skip sd blob
|
||||
stream[i], err = enc.Next()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
sdBlob := enc.SDBlob()
|
||||
|
||||
if len(sdBlob.BlobInfos) != blobsToRead {
|
||||
t.Errorf("expected %d blobs in partial sdblob, got %d", blobsToRead, len(sdBlob.BlobInfos))
|
||||
}
|
||||
if enc.SourceLen() != maxBlobDataSize*blobsToRead {
|
||||
t.Errorf("expected length of %d , got %d", maxBlobDataSize*blobsToRead, enc.SourceLen())
|
||||
}
|
||||
|
||||
// now finish the stream, reusing key and IVs
|
||||
buf = bytes.NewBuffer(data) // rewind to the beginning of the data
|
||||
|
||||
enc = NewEncoderFromSD(buf, sdBlob)
|
||||
|
||||
outPath := t.TempDir()
|
||||
handler := func(h string, b []byte) error {
|
||||
return os.WriteFile(path.Join(outPath, h), b, os.ModePerm)
|
||||
}
|
||||
writtenManifest, err := enc.Encode(handler)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(writtenManifest) != totalBlobs+1 { // +1 for the terminating blob at the end
|
||||
t.Errorf("expected %d blobs in stream, got %d", totalBlobs+1, len(writtenManifest))
|
||||
}
|
||||
if enc.SourceLen() != len(data) {
|
||||
t.Errorf("expected length of %d , got %d", len(data), enc.SourceLen())
|
||||
}
|
||||
|
||||
sdb, err := os.ReadFile(path.Join(outPath, writtenManifest[0]))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
osdb := enc.SDBlob().ToBlob()
|
||||
|
||||
if !bytes.Equal(osdb, sdb) {
|
||||
t.Errorf("written sd blob does not match original sd blob")
|
||||
}
|
||||
for i := 1; i < len(stream); i++ { // start at 1 to skip sd blob
|
||||
b, err := os.ReadFile(path.Join(outPath, writtenManifest[i]))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !bytes.Equal(stream[i], b) {
|
||||
t.Errorf("blob %d of reconstructed stream does not match original stream", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyStream(t *testing.T) {
|
||||
enc := NewEncoder(bytes.NewBuffer(nil))
|
||||
_, err := enc.Next()
|
||||
|
||||
+1
-1
@@ -311,7 +311,7 @@ func parseModifier(modSeparator string, modValue string) (*UriModifier, error) {
|
||||
if modSeparator == "#" {
|
||||
claimId = modValue
|
||||
} else if modSeparator == ":" {
|
||||
claimSequence = parseInt(modValue, -1)
|
||||
claimId = modValue
|
||||
} else if modSeparator == "$" {
|
||||
bidPosition = parseInt(modValue, -1)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user