mirror of
https://github.com/meehow/privtracker.git
synced 2026-09-02 22:56:07 +08:00
tweaks
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
2
Makefile
2
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/
|
||||
|
||||
@@ -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.
|
||||
|
||||
---
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
3
main.go
3
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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user