Compare commits

..
Author SHA1 Message Date
Victor Shyba 7d9731d68a middleware/hooks: preserve response changes 2022-09-26 21:39:46 -03:00
Leo Balduf acf2a5a75d Merge pull request #581 from chihaya/dependabot/go_modules/github.com/stretchr/testify-1.8.0
build(deps): bump github.com/stretchr/testify from 1.7.0 to 1.8.0
2022-07-06 10:02:20 +02:00
Leo Balduf cd6dfd8a2a Merge pull request #575 from CptTZ/patch-1
Remove unused import 'os/signal' for windows
2022-07-06 10:01:40 +02:00
CptTony f68a946f96 Remove unused import 'os/signal' for windows 2022-07-05 16:01:38 -07:00
dependabot[bot] dc6453417d build(deps): bump github.com/stretchr/testify from 1.7.0 to 1.8.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 08:59:21 +00:00
Leo Balduf 3d70aa6bb8 Merge pull request #583 from chihaya/dependabot/go_modules/github.com/spf13/cobra-1.5.0
build(deps): bump github.com/spf13/cobra from 1.3.0 to 1.5.0
2022-07-04 10:58:31 +02:00
dependabot[bot] cc3bce129e build(deps): bump github.com/spf13/cobra from 1.3.0 to 1.5.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.3.0 to 1.5.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.3.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 08:50:44 +00:00
Leo Balduf 6cecc0d6d8 Merge pull request #577 from chihaya/dependabot/go_modules/github.com/prometheus/client_golang-1.12.2
build(deps): bump github.com/prometheus/client_golang from 1.11.0 to 1.12.2
2022-07-04 10:49:44 +02:00
dependabot[bot] b0ac6089f4 build(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.11.0 to 1.12.2.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.11.0...v1.12.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 08:38:04 +00:00
Jimmy Zelinskie e0145c0688 Merge pull request #586 from mrd0ll4r/fix-ci
Fix CI
2022-07-02 23:51:58 -04:00
Jimmy Zelinskie d4e425a251 *: pass golangci-lint 2022-07-01 10:36:48 +02:00
Jimmy Zelinskie f8aa553d5c .github: update workflows 2022-07-01 10:33:20 +02:00
Leo Balduf 956e7af11f Merge pull request #562 from chihaya/dependabot/github_actions/actions/checkout-3
build(deps): bump actions/checkout from 2 to 3
2022-07-01 10:22:50 +02:00
dependabot[bot] fc47a98a74 build(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-01 08:02:23 +00:00
Jimmy Zelinskie 7455c2ad4a Merge pull request #555 from jzelinskie/deps
gomod: bump all deps (mostly redis)
2022-01-19 11:49:06 -05:00
Jimmy Zelinskie bb5460fccc gomod: bump all deps (mostly redis) 2022-01-18 22:00:57 -05:00
9 changed files with 347 additions and 266 deletions

No files matched your search

@@ -1,43 +1,49 @@
---
name: "Build & Test"
on:
on: # yamllint disable-line rule:truthy
push:
branches:
- "!dependabot/*"
- "main"
- "*"
pull_request:
branches: ["*"]
branches:
- "*"
jobs:
build:
name: "Go Build"
name: "Build Binary"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
- name: "Build"
run: "go build ./cmd/..."
- uses: "authzed/actions/go-build@main"
image-build:
name: "Build Container Image"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: "authzed/actions/docker-build@main"
unit:
name: "Run Unit Tests"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
- name: "Run `go test`"
run: "go test -race ./..."
go-version: "^1.18"
- uses: "authzed/actions/go-test@main"
e2e-mem:
name: "E2E Memory Tests"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
go-version: "^1.18"
- name: "Install and configure chihaya"
run: |
go install ./cmd/chihaya
@@ -59,10 +65,10 @@ jobs:
ports: ["6379:6379"]
options: "--entrypoint redis-server"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
go-version: "^1.18"
- name: "Install and configure chihaya"
run: |
go install ./cmd/chihaya
@@ -78,25 +84,11 @@ jobs:
chihaya e2e --debug
kill $pid
image-build:
name: "Docker Build"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "docker/setup-qemu-action@v1"
- uses: "docker/setup-buildx-action@v1"
with:
driver-opts: "image=moby/buildkit:master"
- uses: "docker/build-push-action@v1"
with:
push: false
tags: "latest"
helm:
name: "Helm Template"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/checkout@v3"
- name: "Install Helm"
uses: "engineerd/configurator@v0.0.5"
with:
+13 -54
View File
@@ -1,6 +1,6 @@
---
name: "Lint"
on:
on: # yamllint disable-line rule:truthy
push:
branches:
- "!dependabot/*"
@@ -8,63 +8,26 @@ on:
pull_request:
branches: ["*"]
jobs:
go-mod-tidy:
name: "Lint Go Modules"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.17"
- name: "Run `go mod tidy`"
run: "go mod tidy && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'"
go-fmt:
name: "Format Go"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.17"
- name: "Install gofumpt"
run: "go install mvdan.cc/gofumpt@latest"
- name: "Run `gofumpt`"
run: |
GOFUMPT_OUTPUT="$(find . -iname '*.go' -type f | xargs gofumpt -d)"
if [ -n "$GOFUMPT_OUTPUT" ]; then
echo "The following files are not correctly formatted:"
echo "${GOFUMPT_OUTPUT}"
exit 1
fi
go-lint:
name: "Lint Go"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
- uses: "golangci/golangci-lint-action@v2"
with:
version: "v1.43"
skip-go-installation: true
skip-pkg-cache: true
skip-build-cache: false
go-version: "^1.18"
- uses: "authzed/actions/gofumpt@main"
- uses: "authzed/actions/go-mod-tidy@main"
- uses: "authzed/actions/go-generate@main"
- uses: "authzed/actions/golangci-lint@main"
extra-lint:
name: "Lint YAML & Markdown"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "bewuethr/yamllint-action@v1.1.1"
with:
config-file: ".yamllint"
- uses: "nosborn/github-action-markdown-cli@v3.0.1"
with:
files: "."
config_file: ".markdownlint.yaml"
- uses: "actions/checkout@v3"
- uses: "authzed/actions/yaml-lint@main"
- uses: "authzed/actions/markdown-lint@main"
codeql:
name: "Analyze with CodeQL"
@@ -78,9 +41,5 @@ jobs:
matrix:
language: ["go"]
steps:
- uses: "actions/checkout@v2"
- uses: "github/codeql-action/init@v1"
with:
languages: "${{ matrix.language }}"
- uses: "github/codeql-action/autobuild@v1"
- uses: "github/codeql-action/analyze@v1"
- uses: "actions/checkout@v3"
- uses: "authzed/actions/codeql@main"
+4
View File
@@ -6,6 +6,10 @@ output:
linters-settings:
goimports:
local-prefixes: "github.com/chihaya/chihaya"
staticcheck:
checks:
- "all"
- "-SA1019" # Allow netErr.Temporary
gosec:
excludes:
- "G404" # Allow the usage of math/rand
-1
View File
@@ -5,7 +5,6 @@ package main
import (
"os"
"os/signal"
"syscall"
)
+1 -2
View File
@@ -21,8 +21,7 @@ func TestStartStopRaceIssue437(t *testing.T) {
t.Fatal(err)
}
errC := fe.Stop()
errs := <-errC
if len(errs) != 0 {
if errs := <-errC; len(errs) != 0 {
t.Fatal(errs[0])
}
}
+10 -7
View File
@@ -6,17 +6,20 @@ require (
github.com/SermoDigital/jose v0.9.2-0.20180104203859-803625baeddc
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 // indirect
github.com/alicebob/miniredis v2.5.0+incompatible
github.com/anacrolix/torrent v1.28.0
github.com/go-redsync/redsync v1.4.2
github.com/gomodule/redigo v2.0.0+incompatible
github.com/anacrolix/dht/v2 v2.15.1 // indirect
github.com/anacrolix/missinggo/v2 v2.5.3 // indirect
github.com/anacrolix/torrent v1.40.0
github.com/go-redsync/redsync/v4 v4.5.0
github.com/gomodule/redigo v1.8.8
github.com/julienschmidt/httprouter v1.3.0
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103
github.com/minio/sha256-simd v0.1.1
github.com/minio/sha256-simd v1.0.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_golang v1.12.2
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.0
github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb // indirect
gopkg.in/yaml.v2 v2.4.0
)
+272 -148
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -124,9 +124,9 @@ func (h *responseHook) appendPeers(req *bittorrent.AnnounceRequest, resp *bittor
switch req.IP.AddressFamily {
case bittorrent.IPv4:
resp.IPv4Peers = peers
resp.IPv4Peers = append(resp.IPv4Peers, peers...)
case bittorrent.IPv6:
resp.IPv6Peers = peers
resp.IPv6Peers = append(resp.IPv6Peers, peers...)
default:
panic("attempted to append peer that is neither IPv4 nor IPv6")
}
+19 -18
View File
@@ -7,13 +7,14 @@ import (
"strings"
"time"
"github.com/go-redsync/redsync"
"github.com/gomodule/redigo/redis"
"github.com/go-redsync/redsync/v4"
"github.com/go-redsync/redsync/v4/redis/redigo"
redigolib "github.com/gomodule/redigo/redis"
)
// redisBackend represents a redis handler.
type redisBackend struct {
pool *redis.Pool
pool *redigolib.Pool
redsync *redsync.Redsync
}
@@ -27,7 +28,7 @@ func newRedisBackend(cfg *Config, u *redisURL, socketPath string) *redisBackend
ConnectTimeout: cfg.RedisConnectTimeout,
}
pool := rc.NewPool()
redsync := redsync.New([]redsync.Pool{pool})
redsync := redsync.New(redigo.NewPool(pool))
return &redisBackend{
pool: pool,
redsync: redsync,
@@ -35,7 +36,7 @@ func newRedisBackend(cfg *Config, u *redisURL, socketPath string) *redisBackend
}
// open returns or creates instance of Redis connection.
func (rb *redisBackend) open() redis.Conn {
func (rb *redisBackend) open() redigolib.Conn {
return rb.pool.Get()
}
@@ -48,11 +49,11 @@ type redisConnector struct {
}
// NewPool returns a new pool of Redis connections
func (rc *redisConnector) NewPool() *redis.Pool {
return &redis.Pool{
func (rc *redisConnector) NewPool() *redigolib.Pool {
return &redigolib.Pool{
MaxIdle: 3,
IdleTimeout: 240 * time.Second,
Dial: func() (redis.Conn, error) {
Dial: func() (redigolib.Conn, error) {
c, err := rc.open()
if err != nil {
return nil, err
@@ -68,7 +69,7 @@ func (rc *redisConnector) NewPool() *redis.Pool {
return c, err
},
// PINGs connections that have been idle more than 10 seconds
TestOnBorrow: func(c redis.Conn, t time.Time) error {
TestOnBorrow: func(c redigolib.Conn, t time.Time) error {
if time.Since(t) < 10*time.Second {
return nil
}
@@ -79,23 +80,23 @@ func (rc *redisConnector) NewPool() *redis.Pool {
}
// Open a new Redis connection
func (rc *redisConnector) open() (redis.Conn, error) {
opts := []redis.DialOption{
redis.DialDatabase(rc.URL.DB),
redis.DialReadTimeout(rc.ReadTimeout),
redis.DialWriteTimeout(rc.WriteTimeout),
redis.DialConnectTimeout(rc.ConnectTimeout),
func (rc *redisConnector) open() (redigolib.Conn, error) {
opts := []redigolib.DialOption{
redigolib.DialDatabase(rc.URL.DB),
redigolib.DialReadTimeout(rc.ReadTimeout),
redigolib.DialWriteTimeout(rc.WriteTimeout),
redigolib.DialConnectTimeout(rc.ConnectTimeout),
}
if rc.URL.Password != "" {
opts = append(opts, redis.DialPassword(rc.URL.Password))
opts = append(opts, redigolib.DialPassword(rc.URL.Password))
}
if rc.SocketPath != "" {
return redis.Dial("unix", rc.SocketPath, opts...)
return redigolib.Dial("unix", rc.SocketPath, opts...)
}
return redis.Dial("tcp", rc.URL.Host, opts...)
return redigolib.Dial("tcp", rc.URL.Host, opts...)
}
// A redisURL represents a parsed redisURL