Skip to content

Commit

Permalink
Merge pull request #4 from drand/new/wip
Browse files Browse the repository at this point in the history
renaming repo
  • Loading branch information
AnomalRoil authored Jul 24, 2024
2 parents 59b065a + 54e9dd0 commit d572926
Show file tree
Hide file tree
Showing 30 changed files with 60 additions and 64 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
drand-relay-gossip:
go build -o drand-relay-gossip ./gossip-relay/main.go

client-tool:
go build -o drand-cli ./main.go
4 changes: 2 additions & 2 deletions client/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"testing"
"time"

clientMock "github.com/drand/drand-cli/client/mock"
"github.com/drand/drand-cli/client/test/result/mock"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/common/log"
clientMock "github.com/drand/go-clients/client/mock"
"github.com/drand/go-clients/client/test/result/mock"
)

func TestAggregatorClose(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"sync"
"testing"

clientMock "github.com/drand/drand-cli/client/mock"
"github.com/drand/drand-cli/client/test/result/mock"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/common/log"
clientMock "github.com/drand/go-clients/client/mock"
"github.com/drand/go-clients/client/test/result/mock"
)

func TestCacheGet(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
clock "github.com/jonboulle/clockwork"
"github.com/stretchr/testify/require"

client2 "github.com/drand/drand-cli/client"
"github.com/drand/drand-cli/client/http"
clientMock "github.com/drand/drand-cli/client/mock"
httpmock "github.com/drand/drand-cli/client/test/http/mock"
"github.com/drand/drand-cli/client/test/result/mock"
"github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/crypto"
client2 "github.com/drand/go-clients/client"
"github.com/drand/go-clients/client/http"
clientMock "github.com/drand/go-clients/client/mock"
httpmock "github.com/drand/go-clients/client/test/http/mock"
"github.com/drand/go-clients/client/test/result/mock"
)

func TestClientConstraints(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions client/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ Example:
The "From" option allows you to specify clients that work over particular
transports. HTTP, gRPC and libp2p PubSub clients are provided as
subpackages https://pkg.go.dev/github.com/drand/drand-cli/internal/client/http,
https://pkg.go.dev/github.com/drand/drand-cli/internal/client/grpc and
https://pkg.go.dev/github.com/drand/drand-cli/internal/lp2p/clientlp2p/client
subpackages https://pkg.go.dev/github.com/drand/go-clients/internal/client/http,
https://pkg.go.dev/github.com/drand/go-clients/internal/client/grpc and
https://pkg.go.dev/github.com/drand/go-clients/internal/lp2p/clientlp2p/client
respectively. Note that you are not restricted to just one client. You can use
multiple clients of the same type or of different types. The base client will
periodically "speed test" it's clients, failover, cache results and aggregate
Expand Down
4 changes: 2 additions & 2 deletions client/http/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"encoding/hex"
"fmt"

client2 "github.com/drand/drand-cli/client"
"github.com/drand/drand-cli/client/http"
"github.com/drand/drand/v2/crypto"
client2 "github.com/drand/go-clients/client"
"github.com/drand/go-clients/client/http"
)

func Example_http_New() {
Expand Down
2 changes: 1 addition & 1 deletion client/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"strings"
"time"

client2 "github.com/drand/drand-cli/client"
"github.com/drand/drand/v2/crypto"
client2 "github.com/drand/go-clients/client"

json "github.com/nikkolasg/hexjson"

Expand Down
4 changes: 2 additions & 2 deletions client/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (

"github.com/drand/drand/v2/common/log"

"github.com/drand/drand-cli/client"
"github.com/drand/drand-cli/client/test/http/mock"
"github.com/drand/drand/v2/crypto"
"github.com/drand/go-clients/client"
"github.com/drand/go-clients/client/test/http/mock"
)

func TestHTTPClient(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/http/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/drand/drand-cli/internal/metrics"
"github.com/drand/drand/v2/common"
"github.com/drand/go-clients/internal/metrics"

chain2 "github.com/drand/drand/v2/common/client"
)
Expand Down
2 changes: 1 addition & 1 deletion client/lp2p/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (
dnsaddr "github.com/multiformats/go-multiaddr-dns"
"google.golang.org/protobuf/proto"

client2 "github.com/drand/drand-cli/client"
"github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/common/log"
"github.com/drand/drand/v2/crypto"
"github.com/drand/drand/v2/protobuf/drand"
client2 "github.com/drand/go-clients/client"
)

// Client is a concrete pubsub client implementation
Expand Down
6 changes: 3 additions & 3 deletions client/lp2p/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import (
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"

dhttp "github.com/drand/drand-cli/client/http"
httpmock "github.com/drand/drand-cli/client/test/http/mock"
"github.com/drand/drand-cli/internal/lp2p"
chain2 "github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/common/log"
"github.com/drand/drand/v2/crypto"
dhttp "github.com/drand/go-clients/client/http"
httpmock "github.com/drand/go-clients/client/test/http/mock"
"github.com/drand/go-clients/internal/lp2p"
)

//
Expand Down
2 changes: 1 addition & 1 deletion client/lp2p/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (

clock "github.com/jonboulle/clockwork"

gclient "github.com/drand/drand-cli/client/lp2p"
"github.com/drand/drand/v2/common"
"github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/log"
gclient "github.com/drand/go-clients/client/lp2p"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/lp2p/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"context"
"time"

"github.com/drand/drand-cli/client"
commonutils "github.com/drand/drand/v2/common"
"github.com/drand/go-clients/client"

clock "github.com/jonboulle/clockwork"
pubsub "github.com/libp2p/go-libp2p-pubsub"
Expand Down
4 changes: 2 additions & 2 deletions client/lp2p/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"google.golang.org/protobuf/proto"

"github.com/drand/drand-cli/client"
"github.com/drand/drand-cli/client/test/cache"
chain2 "github.com/drand/drand/v2/common/chain"
dcrypto "github.com/drand/drand/v2/crypto"
"github.com/drand/drand/v2/protobuf/drand"
"github.com/drand/go-clients/client"
"github.com/drand/go-clients/client/test/cache"
)

type randomDataWrapper struct {
Expand Down
2 changes: 1 addition & 1 deletion client/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"sync"
"time"

"github.com/drand/drand-cli/client/test/result/mock"
commonutils "github.com/drand/drand/v2/common"
chain2 "github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/client"
"github.com/drand/go-clients/client/test/result/mock"
)

var _ client.Client = &Client{}
Expand Down
4 changes: 2 additions & 2 deletions client/optimizing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"testing"
"time"

clientMock "github.com/drand/drand-cli/client/mock"
"github.com/drand/drand-cli/client/test/result/mock"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/common/log"
clientMock "github.com/drand/go-clients/client/mock"
"github.com/drand/go-clients/client/test/result/mock"
)

// waitForSpeedTest waits until all clients have had their initial speed test.
Expand Down
2 changes: 1 addition & 1 deletion client/test/http/mock/httpserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"

localClient "github.com/drand/drand-cli/client"
"github.com/drand/drand/v2/common"
"github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/client"
dhttp "github.com/drand/drand/v2/handler/http"
"github.com/drand/drand/v2/protobuf/drand"
"github.com/drand/drand/v2/test/mock"
localClient "github.com/drand/go-clients/client"

"github.com/drand/drand/v2/crypto"
)
Expand Down
6 changes: 3 additions & 3 deletions client/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

"github.com/stretchr/testify/require"

client2 "github.com/drand/drand-cli/client"
clientMock "github.com/drand/drand-cli/client/mock"
"github.com/drand/drand-cli/client/test/result/mock"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/common/log"
"github.com/drand/drand/v2/crypto"
client2 "github.com/drand/go-clients/client"
clientMock "github.com/drand/go-clients/client/mock"
"github.com/drand/go-clients/client/test/result/mock"
)

func mockClientWithVerifiableResults(ctx context.Context, t *testing.T, l log.Logger, n int, strictRounds bool) (client.Client, []mock.Result) {
Expand Down
4 changes: 2 additions & 2 deletions client/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"testing"
"time"

clientMock "github.com/drand/drand-cli/client/mock"
"github.com/drand/drand-cli/client/test/result/mock"
"github.com/drand/drand/v2/common/client"
clientMock "github.com/drand/go-clients/client/mock"
"github.com/drand/go-clients/client/test/result/mock"
)

func TestWatcherWatch(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/drand/drand-cli
module github.com/drand/go-clients

go 1.22

Expand Down
7 changes: 0 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs=
Expand Down Expand Up @@ -102,7 +101,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
Expand Down Expand Up @@ -286,7 +284,6 @@ github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJE
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
github.com/nikkolasg/hexjson v0.1.0 h1:Cgi1MSZVQFoJKYeRpBNEcdF3LB+Zo4fYKsDz7h8uJYQ=
github.com/nikkolasg/hexjson v0.1.0/go.mod h1:fbGbWFZ0FmJMFbpCMtJpwb0tudVxSSZ+Es2TsCg57cA=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
Expand Down Expand Up @@ -638,12 +635,8 @@ google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk
google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade h1:WxZOF2yayUHpHSbUE6NMzumUzBxYc3YGwo0YHnbzsJY=
google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0=
google.golang.org/genproto/googleapis/api v0.0.0-20240723171418-e6d459c13d2a h1:YIa/rzVqMEokBkPtydCkx1VLmv3An1Uw7w1P1m6EhOY=
google.golang.org/genproto/googleapis/api v0.0.0-20240723171418-e6d459c13d2a/go.mod h1:AHT0dDg3SoMOgZGnZk29b5xTbPHMoEC8qthmBLJCpys=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade h1:oCRSWfwGXQsqlVdErcyTt4A93Y8fo0/9D4b1gnI++qo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a h1:hqK4+jJZXCU4pW7jsAdGOVFIfLHQeV7LaizZKnZ84HI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
Expand Down
12 changes: 6 additions & 6 deletions gossip-relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Publish topic=/drand/pubsub/v0.0.0/<chain-hash> data={randomness}

```sh
# Clone this repo
git clone https://github.com/drand/drand-cli.git
git clone https://github.com/drand/go-clients.git
cd drand
# Build the executable
make relay-gossip-relay
Expand Down Expand Up @@ -175,8 +175,8 @@ import (

clock "github.com/jonboulle/clockwork"

"github.com/drand/drand-cli/client"
p2pClient "github.com/drand/drand-cli/client/lp2p"
"github.com/drand/go-clients/client"
p2pClient "github.com/drand/go-clients/client/lp2p"
"github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/log"
)
Expand Down Expand Up @@ -232,9 +232,9 @@ import (

clock "github.com/jonboulle/clockwork"

"github.com/drand/drand-cli/client"
"github.com/drand/drand-cli/client/http"
gclient "github.com/drand/drand-cli/client/lp2p"
"github.com/drand/go-clients/client"
"github.com/drand/go-clients/client/http"
gclient "github.com/drand/go-clients/client/lp2p"
"github.com/drand/drand/v2/common/log"
)

Expand Down
4 changes: 2 additions & 2 deletions gossip-relay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/urfave/cli/v2"

"github.com/drand/drand-cli/internal/lib"
"github.com/drand/drand-cli/internal/lp2p"
"github.com/drand/drand/v2/common/log"
"github.com/drand/go-clients/internal/lib"
"github.com/drand/go-clients/internal/lp2p"
)

// Automatically set through -ldflags
Expand Down
2 changes: 1 addition & 1 deletion internal/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

client "github.com/drand/drand/v2/common/client"

"github.com/drand/drand-cli/internal/lib"
"github.com/drand/drand/v2/common"
"github.com/drand/go-clients/internal/lib"
)

// Automatically set through -ldflags
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (

"github.com/drand/drand/v2/crypto"

localClient "github.com/drand/drand-cli/client"
commonutils "github.com/drand/drand/v2/common"
"github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/common/log"
"github.com/drand/drand/v2/protobuf/drand"
localClient "github.com/drand/go-clients/client"
)

const grpcDefaultTimeout = 5 * time.Second
Expand Down
10 changes: 5 additions & 5 deletions internal/lib/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (

"github.com/drand/drand/v2/common/key"

pubClient "github.com/drand/drand-cli/client"
http2 "github.com/drand/drand-cli/client/http"
gclient "github.com/drand/drand-cli/client/lp2p"
"github.com/drand/drand-cli/internal/grpc"
"github.com/drand/drand-cli/internal/lp2p"
commonutils "github.com/drand/drand/v2/common"
chainCommon "github.com/drand/drand/v2/common/chain"
"github.com/drand/drand/v2/common/client"
"github.com/drand/drand/v2/common/log"
pubClient "github.com/drand/go-clients/client"
http2 "github.com/drand/go-clients/client/http"
gclient "github.com/drand/go-clients/client/lp2p"
"github.com/drand/go-clients/internal/grpc"
"github.com/drand/go-clients/internal/lp2p"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions internal/lib/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
"github.com/stretchr/testify/require"
"github.com/urfave/cli/v2"

"github.com/drand/drand-cli/client"
httpmock "github.com/drand/drand-cli/client/test/http/mock"
commonutils "github.com/drand/drand/v2/common"
"github.com/drand/drand/v2/common/log"
"github.com/drand/drand/v2/crypto"
"github.com/drand/go-clients/client"
httpmock "github.com/drand/go-clients/client/test/http/mock"
)

var (
Expand Down
Loading

0 comments on commit d572926

Please sign in to comment.