Skip to content

Commit

Permalink
Update deps & go version (#237)
Browse files Browse the repository at this point in the history
* use fork

* update go version
  • Loading branch information
decentralgabe authored Jun 8, 2024
1 parent eace066 commit 55436d3
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 210 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.3
go-version: 1.22.4

- name: Install Mage
run: go install github.com/magefile/mage
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.3
go-version: 1.22.4

- name: Install Mage
run: go install github.com/magefile/mage
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This guide is for you.

| Requirement | Tested Version | Installation Instructions |
|-------------|----------------|-------------------------------------------------------|
| Go | 1.22.3 | [go.dev](https://go.dev/doc/tutorial/compile-install) |
| Go | 1.22.4 | [go.dev](https://go.dev/doc/tutorial/compile-install) |
| Mage | 1.15.0-5 | [magefile.org](https://magefile.org/) |

### Go
Expand All @@ -27,7 +27,7 @@ You may verify your `go` installation via the terminal:

```
$> go version
go version go1.22.3 darwin/amd64
go version go1.22.4 darwin/amd64
```

If you do not have go, we recommend installing it by:
Expand All @@ -54,7 +54,7 @@ $> mage --version
Mage Build Tool v1.15.0-5-g2385abb
Build Date: 2024-03-21T12:20:13-07:00
Commit: 2385abb
built with: go1.22.3
built with: go1.22.4
```

#### MacOS
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![godoc did-dht](https://img.shields.io/badge/godoc-did_dht-blue)](https://github.com/TBD54566975/did-dht/impl)
[![go version 1.22.3](https://img.shields.io/badge/go_version-1.22.3-brightgreen)](https://go.dev/)
[![go version 1.22.4](https://img.shields.io/badge/go_version-1.22.4-brightgreen)](https://go.dev/)
[![license Apache 2](https://img.shields.io/badge/license-Apache%202-black)](https://github.com/TBD54566975/did-dht/blob/main/LICENSE)
[![issues](https://img.shields.io/github/issues/TBD54566975/did-dht)](https://github.com/TBD54566975/did-dht/issues)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/TBD54566975/did-dht/ci.yml)
Expand Down
2 changes: 1 addition & 1 deletion impl/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.3-alpine
FROM golang:1.22.4-alpine

# Create directory for our app inside the container
WORKDIR /app
Expand Down
2 changes: 2 additions & 0 deletions impl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,5 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/anacrolix/dht/v2 => github.com/TBD54566975/dht/v2 v2.0.0-20240608032934-ba76f42385e2
4 changes: 2 additions & 2 deletions impl/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrX
github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/TBD54566975/dht/v2 v2.0.0-20240608032934-ba76f42385e2 h1:0GTtlMBSXdqzLVFLAIVCOI2M4E7uO16Z6QFbpwRdKLg=
github.com/TBD54566975/dht/v2 v2.0.0-20240608032934-ba76f42385e2/go.mod h1:SDGC+sEs1pnO2sJGYuhvIis7T8749dDHNfcjtdH4e3g=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20240410030603-dcd73d6ce8b3 h1:JgCGL4PSKuSHVRQL9onEf+e3Ti1DpCnLWTIP2tg9iDg=
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20240410030603-dcd73d6ce8b3/go.mod h1:nyTjplXnrari2nQg63ztI4C0rgMb7Jjn3gfn0OM656g=
github.com/alecthomas/assert/v2 v2.0.0-alpha3 h1:pcHeMvQ3OMstAWgaeaXIAL8uzB9xMm2zlxt+/4ml8lk=
Expand All @@ -30,8 +32,6 @@ github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3b
github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I=
github.com/anacrolix/chansync v0.3.0 h1:lRu9tbeuw3wl+PhMu/r+JJCRu5ArFXIluOgdF0ao6/U=
github.com/anacrolix/chansync v0.3.0/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k=
github.com/anacrolix/dht/v2 v2.21.1 h1:s1rKkfLLcmBHKv4v/mtMkIeHIEptzEFiB6xVu54+5/o=
github.com/anacrolix/dht/v2 v2.21.1/go.mod h1:SDGC+sEs1pnO2sJGYuhvIis7T8749dDHNfcjtdH4e3g=
github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
github.com/anacrolix/envpprof v1.0.0/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
github.com/anacrolix/envpprof v1.1.0/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4=
Expand Down
194 changes: 0 additions & 194 deletions impl/internal/dht/getput.go

This file was deleted.

8 changes: 4 additions & 4 deletions impl/pkg/dht/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
errutil "github.com/TBD54566975/ssi-sdk/util"
"github.com/anacrolix/dht/v2"
"github.com/anacrolix/dht/v2/bep44"
"github.com/anacrolix/dht/v2/exts/getput"
"github.com/anacrolix/log"
"github.com/anacrolix/torrent/types/infohash"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"golang.org/x/time/rate"

dhtint "github.com/TBD54566975/did-dht/internal/dht"
"github.com/TBD54566975/did-dht/internal/util"
"github.com/TBD54566975/did-dht/pkg/telemetry"
)
Expand Down Expand Up @@ -92,7 +92,7 @@ func (d *DHT) Put(ctx context.Context, request bep44.Put) (string, error) {
}

key := util.Z32Encode(request.K[:])
t, err := dhtint.Put(ctx, request.Target(), d.Server, nil, func(int64) bep44.Put {
t, err := getput.Put(ctx, request.Target(), d.Server, nil, func(int64) bep44.Put {
return request
})
if err != nil {
Expand All @@ -109,15 +109,15 @@ func (d *DHT) Put(ctx context.Context, request bep44.Put) (string, error) {
// GetFull returns the full BEP-44 result for the given key from the DHT, using our modified
// implementation of getput.Get. It should ONLY be used when it's needed to get the signature
// data for a record.
func (d *DHT) GetFull(ctx context.Context, key string) (*dhtint.FullGetResult, error) {
func (d *DHT) GetFull(ctx context.Context, key string) (*getput.GetResult, error) {
ctx, span := telemetry.GetTracer().Start(ctx, "DHT.GetFull")
defer span.End()

z32Decoded, err := util.Z32Decode(key)
if err != nil {
return nil, errors.Wrapf(err, "failed to decode key [%s]", key)
}
res, t, err := dhtint.Get(ctx, infohash.HashBytes(z32Decoded), d.Server, nil, nil)
res, t, err := getput.Get(ctx, infohash.HashBytes(z32Decoded), d.Server, nil, nil)
if err != nil {
return nil, fmt.Errorf("failed to get key[%s] from dht; tried %d nodes, got %d responses", key, t.NumAddrsTried, t.NumResponses)
}
Expand Down
5 changes: 2 additions & 3 deletions impl/pkg/dht/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import (

"github.com/TBD54566975/ssi-sdk/util"
"github.com/anacrolix/dht/v2/bep44"
"github.com/anacrolix/dht/v2/exts/getput"
"github.com/anacrolix/torrent/bencode"
"github.com/miekg/dns"

"github.com/TBD54566975/did-dht/internal/dht"
)

// CreateDNSPublishRequest creates a put request for the given records. Requires a public/private keypair and
Expand Down Expand Up @@ -51,7 +50,7 @@ func CreateDNSPublishRequest(privateKey ed25519.PrivateKey, msg dns.Msg) (*bep44

// ParseDNSGetResponse parses the response from a get request.
// The response is expected to be a slice of DNS resource records.
func ParseDNSGetResponse(response dht.FullGetResult) (*dns.Msg, error) {
func ParseDNSGetResponse(response getput.GetResult) (*dns.Msg, error) {
var payload string
if err := bencode.Unmarshal(response.V, &payload); err != nil {
return nil, util.LoggingErrorMsg(err, "failed to unmarshal payload value")
Expand Down

0 comments on commit 55436d3

Please sign in to comment.