Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
meehow committed Dec 30, 2024
1 parent eabcdea commit 59850f1
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 23 deletions.
38 changes: 25 additions & 13 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }}_
Expand All @@ -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).
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

---
Expand Down
3 changes: 1 addition & 2 deletions annnounce.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -64,6 +64,5 @@ func announce(c *fiber.Ctx) error {
Peers: peersIPv4,
PeersIPv6: peersIPv6,
}
defer c.Response().SetConnectionClose()
return bencode.Marshal(c, resp)
}
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<h1>PrivTracker</h1>
<h2>Private BitTorrent tracker for everyone</h2>
<p>
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.
</p>

Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 59850f1

Please sign in to comment.