Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into remove-pkarr
Browse files Browse the repository at this point in the history
* origin/main:
  remove migration and fix typos (#197)
  Bump github.com/miekg/dns from 1.1.58 to 1.1.59 in /impl (#194)
  fix republish and migration (#195)
  revert (#193)
  remove db migration (#192)
  Bump github.com/anacrolix/torrent from 1.52.5 to 1.55.0 in /impl (#187)
  Bump go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp (#184)
  renames + better logging around republishing (#191)
  Bump go.opentelemetry.io/contrib/instrumentation/runtime in /impl (#185)
  Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp (#186)

# Conflicts:
#	impl/pkg/service/pkarr.go
#	spec/spec.md
  • Loading branch information
gabe committed Apr 22, 2024
2 parents f381558 + 26ea0ad commit 357d785
Show file tree
Hide file tree
Showing 36 changed files with 987 additions and 710 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/dependabot-auto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Dependabot auto-approve and merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
approve:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
if: contains(steps.metadata.outputs.dependency-names, 'my-dependency') && steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
4 changes: 2 additions & 2 deletions impl/cmd/cli/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var identityAddCmd = &cobra.Command{
Answer: rrds,
}
// generate put request
putReq, err := dht.CreatePkarrPublishRequest(privKey, msg)
putReq, err := dht.CreateDNSPublishRequest(privKey, msg)
if err != nil {
logrus.WithError(err).Error("failed to create put request")
return err
Expand Down Expand Up @@ -170,7 +170,7 @@ var identityGetCmd = &cobra.Command{
return err
}

msg, err := dht.ParsePkarrGetResponse(*gotResp)
msg, err := dht.ParseDNSGetResponse(*gotResp)
if err != nil {
logrus.WithError(err).Error("failed to parse get response")
return err
Expand Down
2 changes: 1 addition & 1 deletion impl/concurrencytest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func generateDIDPutRequest() (string, []byte, error) {
return "", nil, err
}

bep44Put, err := dht.CreatePkarrPublishRequest(sk, *packet)
bep44Put, err := dht.CreateDNSPublishRequest(sk, *packet)
if err != nil {
return "", nil, err
}
Expand Down
22 changes: 8 additions & 14 deletions impl/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ func (e EnvironmentVariable) String() string {
}

type Config struct {
Log LogConfig `toml:"log"`
ServerConfig ServerConfig `toml:"server"`
DHTConfig DHTServiceConfig `toml:"dht"`
PkarrConfig PkarrServiceConfig `toml:"pkarr"`
Log LogConfig `toml:"log"`
ServerConfig ServerConfig `toml:"server"`
DHTConfig DHTServiceConfig `toml:"dht"`
}

type ServerConfig struct {
Expand All @@ -57,13 +56,10 @@ type ServerConfig struct {
}

type DHTServiceConfig struct {
BootstrapPeers []string `toml:"bootstrap_peers"`
}

type PkarrServiceConfig struct {
RepublishCRON string `toml:"republish_cron"`
CacheTTLSeconds int `toml:"cache_ttl_seconds"`
CacheSizeLimitMB int `toml:"cache_size_limit_mb"`
BootstrapPeers []string `toml:"bootstrap_peers"`
RepublishCRON string `toml:"republish_cron"`
CacheTTLSeconds int `toml:"cache_ttl_seconds"`
CacheSizeLimitMB int `toml:"cache_size_limit_mb"`
}

type LogConfig struct {
Expand All @@ -81,9 +77,7 @@ func GetDefaultConfig() Config {
Telemetry: false,
},
DHTConfig: DHTServiceConfig{
BootstrapPeers: GetDefaultBootstrapPeers(),
},
PkarrConfig: PkarrServiceConfig{
BootstrapPeers: GetDefaultBootstrapPeers(),
RepublishCRON: "0 */3 * * *",
CacheTTLSeconds: 600,
CacheSizeLimitMB: 1000,
Expand Down
2 changes: 0 additions & 2 deletions impl/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ telemetry = false
[dht]
bootstrap_peers = ["router.magnets.im:6881", "router.bittorrent.com:6881", "dht.transmissionbt.com:6881",
"router.utorrent.com:6881", "router.nuh.dev:6881"]

[pkarr]
republish_cron = "0 */3 * * *" # every 3 hours
cache_ttl_seconds = 600 # 10 minutes
cache_size_limit_mb = 1000 # 1000 MB
12 changes: 6 additions & 6 deletions impl/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ paths:
get:
consumes:
- application/octet-stream
description: GetRecord a Pkarr record from the DHT
description: GetRecord a BEP44 DNS record from the DHT
parameters:
- description: ID to get
in: path
Expand Down Expand Up @@ -48,13 +48,13 @@ paths:
description: Internal server error
schema:
type: string
summary: GetRecord a Pkarr record from the DHT
summary: GetRecord a BEP44 DNS record from the DHT
tags:
- Pkarr
- DHT
put:
consumes:
- application/octet-stream
description: PutRecord a Pkarr record into the DHT
description: PutRecord a BEP44 DNS record into the DHT
parameters:
- description: ID of the record to put
in: path
Expand All @@ -80,9 +80,9 @@ paths:
description: Internal server error
schema:
type: string
summary: PutRecord a Pkarr record into the DHT
summary: PutRecord a BEP44 DNS record into the DHT
tags:
- Pkarr
- DHT
/health:
get:
consumes:
Expand Down
31 changes: 15 additions & 16 deletions impl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/allegro/bigcache/v3 v3.1.0
github.com/anacrolix/dht/v2 v2.21.1
github.com/anacrolix/log v0.15.2
github.com/anacrolix/torrent v1.52.5
github.com/anacrolix/torrent v1.55.0
github.com/gin-contrib/cors v1.7.1
github.com/gin-gonic/gin v1.9.1
github.com/go-co-op/gocron v1.37.0
Expand All @@ -17,7 +17,7 @@ require (
github.com/joho/godotenv v1.5.1
github.com/lestrrat-go/jwx/v2 v2.0.21
github.com/magefile/mage v1.15.0
github.com/miekg/dns v1.1.58
github.com/miekg/dns v1.1.59
github.com/mitchellh/go-homedir v1.1.0
github.com/mr-tron/base58 v1.2.0
github.com/pkg/errors v0.9.1
Expand All @@ -31,10 +31,10 @@ require (
github.com/tv42/zbase32 v0.0.0-20220222190657-f76a9fc892fa
go.etcd.io/bbolt v1.3.9
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.50.0
go.opentelemetry.io/contrib/instrumentation/runtime v0.49.0
go.opentelemetry.io/contrib/instrumentation/runtime v0.50.0
go.opentelemetry.io/otel v1.25.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.24.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.1
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.25.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0
go.opentelemetry.io/otel/sdk v1.25.0
go.opentelemetry.io/otel/sdk/metric v1.25.0
go.opentelemetry.io/otel/trace v1.25.0
Expand All @@ -46,18 +46,18 @@ require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/anacrolix/chansync v0.3.0 // indirect
github.com/anacrolix/generics v0.0.0-20230428105757-683593396d68 // indirect
github.com/anacrolix/generics v0.0.0-20230911070922-5dd7545c6b13 // indirect
github.com/anacrolix/missinggo v1.3.0 // indirect
github.com/anacrolix/missinggo/perf v1.0.0 // indirect
github.com/anacrolix/missinggo/v2 v2.7.2-0.20230527121029-a582b4f397b9 // indirect
github.com/anacrolix/missinggo/v2 v2.7.3 // indirect
github.com/anacrolix/multiless v0.3.1-0.20221221005021-2d12701f83f7 // indirect
github.com/anacrolix/stm v0.4.1-0.20221221005312-96d17df0e496 // indirect
github.com/anacrolix/sync v0.4.0 // indirect
github.com/anacrolix/sync v0.5.1 // indirect
github.com/benbjohnson/immutable v0.4.1-0.20221220213129-8932b999621d // indirect
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
Expand All @@ -76,7 +76,6 @@ require (
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down Expand Up @@ -130,23 +129,23 @@ require (
github.com/swaggo/swag v1.8.12 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/grpc v1.61.1 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 357d785

Please sign in to comment.