Skip to content
Open

mo #10

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
369 commits
Select commit Hold shift + click to select a range
d752bfc
log msg
boypt Jun 2, 2021
4ba1db4
add comment
boypt Jun 3, 2021
4f9e2e3
eta change
boypt Jun 3, 2021
ec3306e
valid digits
boypt Jun 3, 2021
d7e2275
fix bug: next wait
boypt Jun 3, 2021
4e4f3ea
fix recyclar bug
boypt Jun 3, 2021
894db59
add drop log
boypt Jun 3, 2021
085d426
var up
boypt Jun 3, 2021
9f70224
fixbug
boypt Jun 3, 2021
ed5e35a
reuse isReadyAddTask
boypt Jun 4, 2021
2a345f1
notify changes on upsertTorrent
boypt Jun 7, 2021
5a0638a
fix
boypt Jun 7, 2021
83c1546
fix bug
boypt Jun 7, 2021
295d621
icon change
boypt Jun 7, 2021
4391aad
fix: wait exit
boypt Jun 8, 2021
3e6f487
add task order
boypt Jun 8, 2021
b2dc289
queue
boypt Jun 8, 2021
cf48069
update on gotinfo
boypt Jun 8, 2021
2d5c41c
go mod update
boypt Jun 8, 2021
c991c5c
ui update
boypt Jun 11, 2021
b144bc6
remove func by arg
boypt Jun 11, 2021
f2f63e7
optm to downloading detect
boypt Jun 11, 2021
f857f89
update download mechanism
boypt Jun 11, 2021
3318af6
up downling
boypt Jun 11, 2021
127bd60
lower icon
boypt Jun 11, 2021
50ec674
text of queue button
boypt Jun 16, 2021
f23a2f0
use filtered log
boypt Jun 16, 2021
ff7afeb
log task type
boypt Jun 16, 2021
3fb0904
log queue len
boypt Jun 16, 2021
fd1fcbb
log time switch
boypt Jun 16, 2021
0bed45d
fix angular http promise
boypt Jun 16, 2021
6af1237
may panic
boypt Jun 16, 2021
6bdc726
note
boypt Jun 16, 2021
045cd0d
rewrite reqerr
boypt Jun 17, 2021
8b88148
up mod
boypt Jun 17, 2021
6ee626c
donecmd output realtime
boypt Jun 18, 2021
e1cb585
doneCMD add practical example
boypt Jun 18, 2021
96cd992
move torrent process to func
boypt Jun 21, 2021
1a3f7d9
print doneCMD realtime
boypt Jun 22, 2021
67f42cc
donecmd log tags
boypt Jun 22, 2021
dcd7125
taskRoutine add RemoveTaskAfterStopped
boypt Jun 23, 2021
46fa035
fix: queue
boypt Jun 23, 2021
b9e39d4
fix task wait
boypt Jun 23, 2021
474c524
file log
boypt Jun 23, 2021
c9bb03f
fix: ratio delete
boypt Jun 23, 2021
b7dd23c
fix: seed ratio drop task and remove cache
boypt Jun 23, 2021
653ad5b
add removeClicked
boypt Jun 23, 2021
420529b
remove btn show sub btn
boypt Jun 24, 2021
642fdcd
dynamic tpl with version string
boypt Jun 24, 2021
0b9bfec
limi remoe size
boypt Jun 24, 2021
e57ddfa
css rearrnge
boypt Jun 24, 2021
7cf9e86
cmd pass []string
boypt Jun 24, 2021
32ed043
ver variabel
boypt Jun 24, 2021
3041f0d
cmd log
boypt Jun 24, 2021
a8a2f81
log stop/delete ratio
boypt Jun 24, 2021
27deb0a
add config to use mmap
boypt Jun 24, 2021
66d03bf
added reqinfo shown
boypt Jun 24, 2021
b714cfc
fix: drop remove wait
boypt Jun 25, 2021
134e77f
simplify cmd log tag
boypt Jun 25, 2021
ad70835
fix magadd tpl
boypt Jun 25, 2021
f22ebb6
fix magadd ver
boypt Jun 25, 2021
f60185c
fix: magnet adding at max task
boypt Jun 25, 2021
ae4ca31
typo fix
boypt Jun 25, 2021
a7df174
fix ratio delete logic
boypt Jun 25, 2021
671f6f5
use SeedSeconds
boypt Jun 28, 2021
97bcf26
seedtime instead of seconds
boypt Jun 29, 2021
0ac8b52
push lock removed
boypt Jun 29, 2021
efd436d
fix conn task infos
boypt Jun 29, 2021
3075cb6
disk space arg
boypt Jun 29, 2021
6e38e49
remove unused code
boypt Jun 29, 2021
bbb2cea
remove unused
boypt Jun 29, 2021
24814a7
rewrite doneCMD tpl
boypt Jun 29, 2021
1f231a8
log stop
boypt Jun 30, 2021
c094e0e
donecmd code cleanup
boypt Jun 30, 2021
b40d3c5
filtered arg
boypt Jun 30, 2021
efab054
isolate logger
boypt Jun 30, 2021
f3a723d
test
boypt Jun 30, 2021
3dd71d0
remove unnessary lock
boypt Jul 2, 2021
db40b38
update mod to use jsonpatch v2
boypt Jul 2, 2021
113af7b
async load downloaded files
boypt Jul 2, 2021
76b9908
fix: update after delete
boypt Jul 2, 2021
be189c8
fix: delete updates
boypt Jul 2, 2021
f1f8ee4
file limit to 65535
boypt Jul 2, 2021
7ccd8cd
js regular update doenloadedfiles
boypt Jul 2, 2021
eced780
dont watch download dir
boypt Jul 5, 2021
98a6600
ticker updater
boypt Jul 5, 2021
ad3635f
log tickerRoutine
boypt Jul 5, 2021
049a311
fix: calc ratio by torrent size if task is done
boypt Jul 5, 2021
a10bbaa
show loading files
boypt Jul 5, 2021
03ba25e
use loading logo
boypt Jul 5, 2021
357ae8b
ticker configrable
boypt Jul 5, 2021
1fb2274
velox frontend choose
boypt Jul 5, 2021
32fc571
websocket bell
boypt Jul 5, 2021
1ed4396
fix icon
boypt Jul 5, 2021
d5407a2
remove conn config
boypt Jul 6, 2021
ee1e71f
torrent move to trash
boypt Jul 6, 2021
849569e
log trash path
boypt Jul 6, 2021
3cd2e2c
fix: call file close on non error
boypt Jul 6, 2021
bb33182
remove datatick
boypt Jul 6, 2021
ed36f98
remove js auto refresh
boypt Jul 6, 2021
9b7a203
rename package path to use our own
boypt Jul 6, 2021
7d76573
fix import path
boypt Jul 6, 2021
3df5f38
tick 2s
boypt Jul 6, 2021
bd37e6a
only drop task if waitList > 0
boypt Jul 6, 2021
8bb9cff
baseinfo template
boypt Jul 6, 2021
b983cab
load sys stat every 4 iter
boypt Jul 7, 2021
2c4c07e
log finished
boypt Jul 7, 2021
8ec119d
add comments
boypt Jul 7, 2021
d9bd882
dont show rss logo if not configured
boypt Jul 7, 2021
564ad6e
uptime use ts
boypt Jul 7, 2021
8825997
fix magadd page
boypt Jul 7, 2021
ec00fc8
fix
boypt Jul 7, 2021
da29f4e
move config from delta obj
boypt Jul 8, 2021
04bdbe7
fix input type
boypt Jul 8, 2021
c2b2eab
remove unused js
boypt Jul 8, 2021
32fee7e
js watch torrent downloading
boypt Jul 8, 2021
474484b
use queue var
boypt Jul 8, 2021
4f04da9
fix
boypt Jul 8, 2021
7443cb6
handl url
boypt Jul 8, 2021
f911791
use absPath
boypt Jul 8, 2021
d9d1fac
state.UseQueue sync
boypt Jul 8, 2021
ec6cadc
fix: log too much
boypt Jul 8, 2021
3bd6f2b
fix: empty file list
boypt Jul 8, 2021
5ccf9b9
fix watch
boypt Jul 8, 2021
7754e3f
keycode depreciated
boypt Jul 8, 2021
7e17b66
apiing refresh
boypt Jul 8, 2021
c24bc25
fix dockerfile
boypt Jul 8, 2021
26a1adc
fix build go native
boypt Jul 8, 2021
11a0d81
up gopsutil
boypt Jul 8, 2021
c4481b6
fix: up/dl rate is text value
boypt Jul 8, 2021
7095d0e
show transfered data at banner
boypt Jul 9, 2021
baea838
versioned path compat
boypt Jul 9, 2021
178e51f
api handler func optm
boypt Jul 9, 2021
c591d19
fix: PERM default 666
boypt Jul 9, 2021
c8c85ed
log minor fix
boypt Jul 9, 2021
28b26b4
rearrange http route
boypt Jul 9, 2021
5caf7cb
dl handler cleanup
boypt Jul 9, 2021
699b39c
round ratio
boypt Jul 9, 2021
5fc2a0b
fix: docker image libstdc++
boypt Jul 9, 2021
8640a55
event mode btn
boypt Jul 12, 2021
9020fad
desc change
boypt Jul 12, 2021
030571b
some source no need to load by ver
boypt Jul 12, 2021
0a4cd41
static load of ng-template
boypt Jul 12, 2021
4fad708
download section use ng-show
boypt Jul 12, 2021
397f993
moved template
boypt Jul 12, 2021
421e45d
fix: switch break
boypt Jul 12, 2021
008909f
rewrite donecmd gethering
boypt Jul 12, 2021
91949da
fix err msg
boypt Jul 12, 2021
6fff6b4
fix ts
boypt Jul 12, 2021
7f625db
fix: startat
boypt Jul 12, 2021
210c75f
page
boypt Jul 12, 2021
7b8ec51
remove unused file
boypt Jul 12, 2021
7b3f9a8
systemd unit examples add options
boypt Jul 12, 2021
006b676
fix: magnet editor name
boypt Jul 13, 2021
50896c5
custom TrackerList
boypt Jul 13, 2021
d037e0a
fix: suffix case
boypt Jul 13, 2021
2b23f85
log trackers count
boypt Jul 13, 2021
bf6c547
parse tracker ignore remote err
boypt Jul 13, 2021
753a34d
auto mmap for downloads
boypt Jul 13, 2021
3ef184a
github actions
boypt Jul 13, 2021
fb89d04
fix: docker tag
boypt Jul 13, 2021
8463cee
fix to action build
boypt Jul 13, 2021
48a0b52
fix git tag
boypt Jul 13, 2021
0a7a73e
show empty notice on expended
boypt Jul 14, 2021
f7fef50
fix: rss update on startup
boypt Jul 14, 2021
2cad626
rearrange the searchprovider config
boypt Jul 14, 2021
e0ea134
note on unconf
boypt Jul 14, 2021
a2e63d8
set content-enc on eventstream mode
boypt Jul 14, 2021
2c46b84
no gzip after on unix listen
boypt Jul 14, 2021
f255ddd
debug show users
boypt Jul 14, 2021
ccc632e
update scraper
boypt Jul 14, 2021
8b11850
show err msg
boypt Jul 14, 2021
9808bd0
fix reqerr log msg
boypt Jul 14, 2021
bcaf8b1
fix: clear file list on deleted
boypt Jul 14, 2021
cbe12e0
use --listen, depreciated --host/--port
boypt Jul 15, 2021
6893aff
dosen't seem to be a h2 bug, remove proto map
boypt Jul 15, 2021
a371871
add some icon
boypt Jul 15, 2021
c02f2c3
fix: rss parse magnet
boypt Jul 15, 2021
7fd672a
tracker list removes dup entries
boypt Jul 15, 2021
6e2f386
rss module log with RSS tag
boypt Jul 15, 2021
e32b0dc
api/url accepts 512k torrents size
boypt Jul 16, 2021
eb8d1c5
fix go linter complains
boypt Jul 16, 2021
bc50088
update rss content on runtime changed
boypt Jul 16, 2021
af247f1
move disconnected layer to let buttons clickable
boypt Jul 19, 2021
d46af80
add docker-compose
boypt Jul 19, 2021
c55f491
update docker desc
boypt Jul 19, 2021
5a13a8e
quickinstall script now supports version
boypt Jul 19, 2021
623bee9
update README and quickins
boypt Jul 19, 2021
58f4516
qscript prefer static ver
boypt Jul 19, 2021
1cc6068
fix: reqerr shows nothing on network layer error
boypt Jul 21, 2021
732e936
Relaxed CORS restriction from /api/ endpoint, see #46 (#47)
Jul 21, 2021
f6aab17
hide runtime config button if not allowed
boypt Jul 21, 2021
13fe523
simplify embed/external resource condition
boypt Jul 21, 2021
d3e9ebe
avoid docker action run on forked repos
boypt Jul 21, 2021
1cea5a1
dep updated
boypt Jul 21, 2021
5731bd4
fix action
boypt Jul 21, 2021
2c72f66
stop data dl before setting each file priority
boypt Jul 22, 2021
949718d
maintain our own version of dht for now
boypt Jul 22, 2021
f047db2
update docker image
boypt Jul 22, 2021
9bd1a5e
torrent ver 1.29 respons slow, reverted
boypt Jul 23, 2021
0628b76
docker rebuild
boypt Jul 23, 2021
de4340c
rewrite rss item parsing, suport nyaa site
boypt Jul 26, 2021
c295c53
update readme
boypt Jul 26, 2021
6465440
update install script use new yaml
boypt Jul 26, 2021
a2d98f3
example service file use the LISTEN env
boypt Jul 26, 2021
702bfe8
show size in rss if exists; offer magnet/torrent option
boypt Jul 27, 2021
024e066
rss parse size from length
boypt Jul 27, 2021
1bc69e1
add titles
boypt Jul 27, 2021
5302556
saved config will now keep keys cases
boypt Aug 4, 2021
94e222a
update mod
boypt Aug 4, 2021
7d8ff47
fix --conv-yaml func
boypt Aug 4, 2021
9b6d031
optimize config path detect
boypt Aug 4, 2021
28fec4d
fix: exit on config under not exists dir
boypt Aug 4, 2021
5aa6e03
fix: set prio. per file too slow; use last stat; engdebug
boypt Aug 12, 2021
f025890
adjust some cmdline arg, accepts more env variables
boypt Aug 12, 2021
246f012
torrentStat hold the pointer instead the object, avoid mem align.
boypt Aug 13, 2021
06cf167
fix: only write yml when origin format is yaml
boypt Aug 16, 2021
25ccab7
use filepath.Ext to detemine config type
boypt Aug 17, 2021
bcd94fe
use go 1.17
boypt Aug 20, 2021
0854c5e
fix: action filter
boypt Aug 31, 2021
015bccf
fix build filter
boypt Sep 2, 2021
12d3eeb
fix: write a default config file if not exists #140
boypt Sep 17, 2021
e940416
const default config names
boypt Sep 17, 2021
17d2c99
fix ci dup tasks
boypt Sep 17, 2021
d1dd295
fix: escap filename with special chracters fix #139
boypt Sep 18, 2021
94fd91f
upgrade fomatic ui assets
boypt Sep 23, 2021
0db0ddd
add cache control to static files
boypt Sep 23, 2021
b982278
upgrade deps
boypt Oct 8, 2021
83360cb
http cached headers
boypt Oct 8, 2021
331a14e
fix: http expire time should be dynamic
boypt Oct 9, 2021
518897d
ci log git range
boypt Oct 12, 2021
a991e5b
rename info struct
boypt Oct 12, 2021
75ed2ff
cleanup logic about sys stat
boypt Oct 19, 2021
9320dbf
add flag to set inteval secs
boypt Oct 20, 2021
31bba14
startup info changes
boypt Oct 20, 2021
ceadeec
show sys info as list
boypt Oct 25, 2021
6c1ef59
add glibc static mode
boypt Nov 2, 2021
a9b061d
lint: pkg server
boypt Nov 3, 2021
02fec98
lint: pkg engine
boypt Nov 3, 2021
0b57f56
add action lint
boypt Nov 3, 2021
c5a085b
lint timeout
boypt Nov 3, 2021
9976e26
fix: purego as static
boypt Nov 3, 2021
a9acf3e
add arg DisableMmap
boypt Nov 4, 2021
d4e37bb
fix: velox push may crash during reading
boypt Nov 12, 2021
584c108
download link: folder as zip icon
boypt Nov 29, 2021
2126bb7
dont re clac speed if no change
boypt Dec 6, 2021
3644742
torrent stable upgrade; ascii art logo
boypt Dec 7, 2021
911bbc6
upgrade dep
boypt Dec 23, 2021
6f7452f
fix: download rate unchanged if no activity on done
boypt Dec 23, 2021
6f49429
update ignroe
boypt Dec 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 28 additions & 23 deletions .github/workflows/go.yml → .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,62 @@
name: Go
name: release build
on:
push:
create:
tags:
- '*'
- '1.*'

jobs:

build:
if: ${{ github.owner }} == "boypt"
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.16.x

- name: Check out code
uses: actions/checkout@v2
with:
ref: 'master'
fetch-depth: '0'

- name: Generate Git log
run: |
git fetch origin +refs/tags/*:refs/tags/*
echo "Current Tag: ${GITHUB_REF}"
git checkout ${GITHUB_REF} -b compile
GITVER=$(git describe --tags)
PREVVER=$(git describe --tags --abbrev=0 ${GITVER}~1)
git log --oneline ${PREVVER}..${GITVER} > gittaglogs.txt
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "^1.17"

- name: Get dependencies
run: |
go get -v -t -d ./...
go mod download -x

- name: Build
run: |
bash scripts/make_release.sh gzip amd64
bash scripts/make_release.sh gzip amd64 purego
bash scripts/make_release.sh gzip amd64 static
bash scripts/make_release.sh gzip 386 purego
bash scripts/make_release.sh gzip arm64 purego

bash scripts/make_release.sh gzip darwin purego

- name: Generate Git Log
run: |
go version
git fetch origin +refs/tags/*:refs/tags/*
echo "Current Tag: ${GITHUB_REF}"
git checkout ${GITHUB_REF} -b compile
GITVER=$(git describe --tags)
PREVVER=$(git describe --tags --abbrev=0 ${GITVER}~1)
echo git log --oneline ${PREVVER}..${GITVER} | tee -a gittaglogs.txt
git log --oneline ${PREVVER}..${GITVER} | tee -a gittaglogs.txt

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
cloud-torrent_linux_amd64.gz
cloud-torrent_linux_amd64_static.gz
cloud-torrent_linux_386_static.gz
cloud-torrent_linux_arm64_static.gz
prerelease: true
draft: false
cloud-torrent_darwin_amd64_static.gz
prerelease: false
draft: true
body_path: gittaglogs.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

51 changes: 51 additions & 0 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: docker build
on:
create:
tags:
- '1.*'

jobs:
build:
if: ${{ github.owner }} == "boypt"
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup QEMU
uses: docker/setup-qemu-action@v1

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Get tag to build
id: tag
run: |
latest_tag=$(git describe --tags | cut -d- -f1)
echo "Use the latest release tag: ${latest_tag}"
echo ::set-output name=tag::${latest_tag}

- name: Prepare environment variables
id: prepare
run: |
echo ::set-output name=docker_platforms::linux/386,linux/amd64,linux/arm64
echo ::set-output name=docker_image::boypt/cloud-torrent
echo ::set-output name=docker_tag::${{ steps.tag.outputs.tag }}
echo ::set-output name=docker_is_push::${PUSH:-false}

- name: Build tag & latest release
run: |
docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=true" \
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.docker_tag }}" \
--tag "${{ steps.prepare.outputs.docker_image }}:latest" \
--build-arg TAG=${{ steps.prepare.outputs.docker_tag }} \
--file Dockerfile .
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: lint
on: [push, pull_request]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Run linter
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ vendor
downloads
torrents
cloud-torrent*
simple-torrent*
tmp/
play*.yml
.vscode
.torrent.bolt.db
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
# STEP 1 build executable binary
############################
FROM golang:alpine AS builder
RUN apk update && apk add --no-cache git
RUN apk update && apk add --no-cache git make build-base
WORKDIR /root/cloud-torrent
ENV PATH=$HOME/go/bin:$PATH
RUN git clone https://github.com/boypt/cloud-torrent.git . && \
go get -v -u github.com/shuLhan/go-bindata/... && \
go get -v -t -d ./... && \
cd static && \
sh generate.sh
ENV CGO_ENABLED=1
RUN git clone https://github.com/boypt/simple-torrent.git . && \
go get -v -t -d .

ENV GO111MODULE=on CGO_ENABLED=0
RUN go build -ldflags "-s -w -X main.VERSION=$(git describe --tags)" -o /usr/local/bin/cloud-torrent
RUN go build -trimpath -ldflags "-s -w -X main.VERSION=$(git describe --tags)" -o /usr/local/bin/cloud-torrent
############################
# STEP 2 build a small image
############################
FROM alpine
COPY --from=builder /usr/local/bin/cloud-torrent /usr/local/bin/cloud-torrent
RUN apk update && apk add ca-certificates
RUN apk update && apk add ca-certificates libstdc++
ENTRYPOINT ["cloud-torrent"]
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
bin=cloud-torrent
.PHONY: clean
all: clean $(bin)
app_name = simple-torrent

cloud-torrent:
CGO_ENABLED=0 go build -o $(bin) -ldflags "-s -w -X main.VERSION=$$(git describe --tags)"
build: get
CGO_ENABLED=0 go build -ldflags "-X main.VERSION=`git rev-parse --short HEAD`" -o $(app_name)

static: get
go build -tags "netgo,osusergo,sqlite_omit_load_extension" -ldflags "-X main.VERSION=`git rev-parse --short HEAD` -linkmode external -extldflags "-static" " -o $(app_name)

get:
go mod download

run:
go run .

test:
go test ./... -v

clean:
rm -fv $(bin)
rm -f $(app_name)
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,36 @@ Also:

## Binary

See [the latest release](https://github.com/boypt/cloud-torrent/releases/latest) or use the oneline script to do a quick install on modern Linux.
See [the latest release](https://github.com/boypt/cloud-torrent/releases/latest) or use the oneline script to do a quick install on a modern Linux machines.

``` bash
bash <(wget -qO- https://git.io/simpletorrentqs)
```
bash <(wget -qO- https://raw.githubusercontent.com/boypt/simple-torrent/master/scripts/quickinstall.sh)
```

The script install a systemd unit (under `scripts/cloud-torrent.service`) as service. Read further intructions: [Auth And Security](https://github.com/boypt/simple-torrent/wiki/AuthSecurity)
The script installs a systemd unit (under `scripts/cloud-torrent.service`) as service. Read further intructions: [Auth And Security](https://github.com/boypt/simple-torrent/wiki/AuthSecurity)

If hope to specify a version, just append the version number to the command.

## Docker [![Docker Pulls](https://img.shields.io/docker/pulls/boypt/cloud-torrent.svg)][dockerhub] [![Image Size](https://images.microbadger.com/badges/image/boypt/cloud-torrent.svg)][dockerhub]
``` bash
bash <(wget -qO- https://git.io/simpletorrentqs) 1.3.3
```

## Docker [![Docker Pulls](https://img.shields.io/docker/pulls/boypt/cloud-torrent.svg)][dockerhub]

[dockerhub]: https://hub.docker.com/r/boypt/cloud-torrent/

``` sh
``` bash
$ docker run -d -p 3000:3000 -v /path/to/my/downloads:/downloads -v /path/to/my/torrents:/torrents boypt/cloud-torrent
```
When running as a container, keep in mind:
* You need also to expose your torrent incoming port (50007 by default) if you want to seed (`-p 50007:50007`). Also, you'll have to forward the port on your router.
* Automatic port forwarding on your router via UPnP IGD will not work unless run in `host` mode (`--net=host`).

It's more practical to run docker-compose, see Wiki Page: [DockerCompose](https://github.com/boypt/simple-torrent/wiki/DockerCompose)
## Source

**Requirement**
- Latest [Golang](https://golang.org/dl/) (Go 1.13+)
- Latest [Golang](https://golang.org/dl/) (Go 1.16+)

``` sh
$ git clone https://github.com/boypt/simple-torrent.git
Expand Down
36 changes: 36 additions & 0 deletions common/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package common

import (
"log"
"runtime"
)

func HandleError(err error) (b bool) {
if err != nil {
// notice that we're using 1, so it will actually log where
// the error happened, 0 = this function, we don't want that.
_, fn, line, _ := runtime.Caller(1)
log.Printf("[error] %s:%d %v", fn, line, err)
b = true
}
return
}

//this logs the function name as well.
func FancyHandleError(err error) (b bool) {
if err != nil {
// notice that we're using 1, so it will actually log the where
// the error happened, 0 = this function, we don't want that.
pc, fn, line, _ := runtime.Caller(1)

log.Printf("[error] in %s[%s:%d] %v", runtime.FuncForPC(pc).Name(), fn, line, err)
b = true
}
return
}

func Must(err error) {
if err != nil {
panic(err)
}
}
27 changes: 15 additions & 12 deletions docker-compose.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
version: '3.3'
version: '3'
services:
cloud-torrent:
# network_mode: host
ports:
- '3000:3000'
# - '50007:50007'
volumes:
- '/path/to/my/downloads:/downloads'
- '/path/to/my/torrents:/torrents'
- '/path/to/my/config:/etc/cloud-torrent'
image: boypt/cloud-torrent
command: --auth username:password
service.simpletorrent:
image: boypt/cloud-torrent
restart: unless-stopped
ports:
- "3000:3000"
- "50012:50012"
- "50012:50012/udp"
environment:
AUTH: "username:password"
TITLE: "MySimpleTorrent"
volumes:
- ./downloads:/srv/downloads
- ./cloud-torrent.yaml:/etc/cloud-torrent.yaml
command: ["-c", "/etc/cloud-torrent.yaml"]
Loading