From 59850f11bf945096781e7d6120eb5c5b6a6b03c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Adamski?= Date: Mon, 30 Dec 2024 23:03:41 +0100 Subject: [PATCH] tweaks --- .goreleaser.yaml | 38 +++++++++++++++++++++++++------------- Dockerfile | 2 +- Makefile | 2 +- README.md | 4 ++-- annnounce.go | 3 +-- docs/index.html | 4 ++-- main.go | 3 ++- storage.go | 2 +- 8 files changed, 35 insertions(+), 23 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 98e8fc6..23102f4 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,11 +1,20 @@ # This is an example .goreleaser.yml file with some sensible defaults. # Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + before: hooks: # You may remove this if you don't use go modules. - go mod tidy # you may remove this if you don't need go generate - go generate ./... + builds: - env: - CGO_ENABLED=0 @@ -19,7 +28,7 @@ builds: archives: - format: tar.gz - # this name template makes the OS and Arch compatible with the results of uname. + # this name template makes the OS and Arch compatible with the results of `uname`. name_template: >- {{ .ProjectName }}_ {{- title .Os }}_ @@ -29,20 +38,23 @@ archives: {{- if .Arm }}v{{ .Arm }}{{ end }} # use zip for windows archives format_overrides: - - goos: windows - format: zip -checksum: - name_template: 'checksums.txt' -snapshot: - name_template: "{{ incpatch .Version }}-next" + - goos: windows + format: zip + files: + - README.md + - LICENSE.txt + - docs/** + changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" -# The lines beneath this are called `modelines`. See `:help modeline` -# Feel free to remove those if you don't want/use them. -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj +release: + footer: >- + + --- + + Released by [GoReleaser](https://github.com/goreleaser/goreleaser). diff --git a/Dockerfile b/Dockerfile index 9b0c245..1726d53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,8 @@ RUN CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath # build runner FROM scratch -COPY --from=builder /src/privtracker / COPY docs /docs +COPY --from=builder /src/privtracker / EXPOSE 1337 diff --git a/Makefile b/Makefile index 4864e28..ae32be5 100644 --- a/Makefile +++ b/Makefile @@ -2,4 +2,4 @@ build: CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath deploy: build - rsync -avzL docs privtracker privtracker:web/ + rsync -avzL --exclude '*.fiber.gz' docs privtracker privtracker:web/ diff --git a/README.md b/README.md index b5b8d9a..8c4ca39 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # [Private BitTorrent tracker for everyone](https://privtracker.com/) -PrivTracker allows to share torrent files just with your friends, nobody else. -Unlike public trackers, it shares peers only within a group which is using the same Announce URL. +PrivTracker allows you to share torrent files only with your friends and nobody else. +Unlike public trackers, it shares peers only within a group using the same announce URL. It really works like a private tracker, but can be generated with one click of a button. --- diff --git a/annnounce.go b/annnounce.go index 59d4b7b..92b3a22 100644 --- a/annnounce.go +++ b/annnounce.go @@ -55,7 +55,7 @@ func announce(c *fiber.Ctx) error { if numSeeders == 0 { interval /= 2 } else if numLeechers == 0 { - interval *= 2 + interval *= 4 } resp := AnnounceResponse{ Interval: interval, @@ -64,6 +64,5 @@ func announce(c *fiber.Ctx) error { Peers: peersIPv4, PeersIPv6: peersIPv6, } - defer c.Response().SetConnectionClose() return bencode.Marshal(c, resp) } diff --git a/docs/index.html b/docs/index.html index 3e7f85a..4849308 100644 --- a/docs/index.html +++ b/docs/index.html @@ -40,8 +40,8 @@

PrivTracker

Private BitTorrent tracker for everyone

- PrivTracker allows to share torrent files just with your friends, nobody else. - Unlike public trackers, it shares peers only within a group which is using the same Announce URL. + PrivTracker allows you to share torrent files only with your friends and nobody else. + Unlike public trackers, it shares peers only within a group using the same announce URL. It really works like a private tracker, but can be generated with one click of a button.

diff --git a/main.go b/main.go index 9b595e7..44d28a5 100644 --- a/main.go +++ b/main.go @@ -26,8 +26,9 @@ func main() { config := fiber.Config{ ServerHeader: "privtracker.com", ReadTimeout: time.Second * 245, - WriteTimeout: time.Second * 15, + WriteTimeout: time.Second * 30, Network: fiber.NetworkTCP, + GETOnly: true, } // if you disable TLS, then I guess you want to use existing proxy if !tlsEnabled { diff --git a/storage.go b/storage.go index 3c1cf18..3e96ebe 100644 --- a/storage.go +++ b/storage.go @@ -143,7 +143,7 @@ func GetStats(room, infoHash string) (numSeeders, numLeechers int) { func Cleanup() { for { - time.Sleep(time.Minute * 3) + time.Sleep(time.Minute * 10) expiration := time.Now().Unix() - 600 for _, shard := range shards { shard.Lock()