deranjer / gotorrent Goto Github PK
View Code? Open in Web Editor NEWgoTorrent is a torrenting server built with Go (Golang) with websocket API that comes with a React web frontend.
License: MIT License
goTorrent is a torrenting server built with Go (Golang) with websocket API that comes with a React web frontend.
License: MIT License
Permissions on files in a folder (if the root of the torrent is a folder) do not appear to inherit permissions, may need to walk the entire folder and change permissions.
Add a storage routine for searching for a subset of torrents by hash string. This is for the ChangeStorageLocation function so we don't have to iterate over all added torrents and match.
./goTorrent
Failed creating 64-bit integer for goTorrent Port! strconv.ParseInt: parsing ":8000": invalid syntax
INFO[0000] Torrent Client Config has been generated... Config="{0 info stdout 0 {/home/lucas/Downloads/goTorrent_0.7.0_linux_64-bit/downloading 0x8943e0 0 false false false false 0x7b27a0 false false true 0xc00013cd20 0xc00013ccd0 false false {false false true} false false false false Go-Torrent/1.0 go.torrent dev 20150624 -GT0001- 20s 3s 50 25 500 50 4s false false} uploadedTorrents 1.5 /home/lucas/Downloads/goTorrent_0.7.0_linux_64-bit/downloads /home/lucas/Downloads/goTorrent_0.7.0_linux_64-bit/torrentUpload {192.168.1.8:8000 192.168.1.8 false false 8000 } 5}"
INFO[0000] Opening or creating storage.db... error=""
INFO[0000] No Queue database found, assuming first run, creating database error="not found"
INFO[0000] No Tokens database found, assuming first run, generating token... RSSFeedStore="{0 [] [] }" error="not found"
ERRO[0000] Unable to read Database into configFile! database="&{0xc00021a680 DB<"storage.db">}" error="not found"
INFO[0000] Assuming first run as no config found in database, client config being generated error="not found"
FATA[0000] Unable to listen on the http Server! (Maybe wrong IP in config, port already in use?) (Config: Not using proxy, see error for more details) error="listen tcp 192.168.1.8:8000: bind: cannot assign requested address"
A global rate limit, to apply across all torrents like uTorrent has, would be great.
It would be good to have the option to set independently for upload / download, with an option to change on the fly without restart, if possible.
Will be implemented as a cron job to check a specified folder every 5 minutes to see if any .torrent files are in the folder, if so attempt to add them, then copy to our .torrent backup folder and delete the .torrent file
File upload server error when attempting to upload torrent file via firefox:
[31mERRO?[0m[7480] Unable to add Torrent to torrent server ?[31mError?[0m="bencode: syntax error (offset: 0): unknown value type 'u'" ?[31mfilepath?[0m="uploadedTorrents\0ad-0.0.22-alpha-win32.exe.torrent"
Works fine on Chrome, this is the log from firefox:
Blob
Blob { size: 51139, type: "" }
bundle.js:95275:7
Base64 data:application/octet-stream;base64,ZDg6YW5ub3VuY2U0NzpodHRwOi8vcmVsZWFzZXMud2lsZGZpcmVnYW1lcy5jb206MjcxMC9hbm5vdW5jZTEwOmNyZWF0ZWQgYnkxMzpta3RvcnJlbnQgMS4wMTM6Y3JlYXRpb24gZGF0ZWkxNTAxNDExNDUxZTQ6aW5mb2Q2Omxlbmd0aGk2NjYzMzcyNzBlNDpuYW1lMjY6MGFkLTAuMC4yMi1hbHBoYS13aW4zMi5leGUxMjpwaWVjZSBsZW5ndGhpMjYyMTQ0ZTY6cGllY2VzNTA4NDA6J1GP0Tj/xHbHfoXnELlfremJ51NQhAvMGi2f7NSuch7ogLHmwwCsAIBmFFm44o6c8CIi9gzh7IghBxRoku42J38igp23/PWzJRYb5WVjr3tEVUUfsOKqrWVU+QKxX1CPwvqRabmifX56U4spa6RN5LgsoOdYi2NocBkVrILLz7ynh9xmvBJw5gj70FdyFFKGNa2b1kG49BJoY0AUiYNxncNxnBao/MlJI1ncxbj0JU8FAML/ds08lTOZ41F/tXp7uAsoRnGWoP9jfU05cE9GzII4YUbrdPucBt+LO/IJwcfjL3SJ1381Lr6iHYx1YWIt8JD/mcy6BI6VRNs4W+IY5jPrizU9CGYLLu5nqr1LAg8tBXbD/MLuiiQr2nA9zsr8SOXETxYyLx4SuE2QZjiDfXycJIVWjXEkxN6XywgQf+ixYRA2eaKy9Kjk+Rvqw1uJvid+D2n+p1WOeisLMGD+nlmyJQ6Ebt4Z5KSdrrqS4uS7ExvRHxi21n9vus2CIStyQ+iulrv29GPUfN6xUaIQkJk6AIV3SxiA2mdKyvGzTTu8j9cpU8XkuLAim9kAsWv8qoAmp0XmmTioZtih8eUhOvEYxr4WgWYsG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40FuIi10w0A+PIErsHZj2g1ds0tvKhotUylBKqeTp4GlhVxYEAx3iskZ3yPt01JX+DCIog6vvpF6t5v0773cWs1J3QXWJbwYZACf6Mz49sXo7uFdc2H0FCwHlzQ5dQYd+y6jB85j7Y//jxXzjJhGXHKc15+licM3NIif9WJErEyCj8Z8T4ZH7qpvF93UxcMPo/vF46hb6kd9PYL68lIcXqyv7qL0H7DYkw5jVKgrIEQ1clYUm4rogkq9v6Ge5SmFjugKfdcpPKJXTxlI/9j4YKj1u5bZM0Tl7sPiwytacfksGJc+5LkQEkCAbJIkzSYx4hGJWOUHQDLQYETNeXNNwN4N4DF8mbxTLBUbLX6T1eg8UwvfrtAlqwf7AS37ONGgPRcMzCq0wwE9kD1VSOdrtCkUd1/DdlPRhMmpMU7dqhKF2LB7SPikA1JMbp5HhRkoubp0Hlfhw8n5aiGK3W6ZUQxBoAPUY1g0OiHf0re+eZr
Ability to change the storage path after adding torrent.
Changing the settings in the toml file were not propagating to the config again... the only issue is the client connect JWT token.. will need to investigate.
Check this line, there is a limit download for upload size
goTorrent/settings/settings.go
Line 105 in 4909429
Added and tested using JWT, specifically using https://github.com/dgrijalva/jwt-go
Currently not using any claims, and don't have the logic to add third party clients, will add in the future.
Will be adding backend to frontend push notifications of backed status using react-toastify.
Client Config should only be regenerated on change, currently it is regenerated on every startup.
Torrent will sometimes fail to download metainfo on one try, but subsequent tries work fine, perhaps store torrent and retry periodically....
The frontend UI has the buttons for it currently, but needs to be implemented in the backend.
x-MacBook-Pro:goTorrent apple$ go run main.go
Failed creating 64-bit integer for goTorrent Port! strconv.ParseInt: parsing ":8000": invalid syntax
Logging to file logs/server.log
exit status 1
env:
go version go1.11.4 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/apple/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/apple/workspace/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/go-build741379552=/tmp/go-build -gno-record-gcc-switches-fno-common"
Failed to deploy on heroku
Currently the setting button does not work, will be implement that logic in the next release.
Is this torrent support webtorrent? Like a webtorrent.io but, it is node.js
One for the future perhaps, but something that came in really handy on uTorrent was the schedule feature.
You had a basic week view, separated into hourly blocks.
Each hour block could be green (main limit as set elsewhere), orange for a second limit set on the schedule page, then gray for off/paused.
Great for allowing full speed say during the night, turning things down partly during busy hours, or stopping completely for times you know you want full speed.
This is an extension of #20.
Mojave 10.14.6
go version go1.13 darwin/amd64
I was able to run goTorrent but had to make a minor change.
I changed the default ServerAddr = "192.168.1.8"
in config.toml
to 127.0.0.1
and the web UI started working at 127.0.0.1:8000
.
However, when I tried to download and seed Ubuntu 18.04 I got the following:
(sorry for the long paste)
time="2020-01-05T07:17:13-06:00" level=debug msg="Message From Client" message="{torrentFileSubmit map[FileData:data:application/octet-stream;base64,ZDg6YW... very long string ...n9Q2Vl FileName:ubuntu-18.04.3-live-server-amd64.iso.torrent Label:ubuntu StorageValue:]}"
time="2020-01-05T07:17:13-06:00" level=info msg="Added torrent" clienttorrent=ubuntu-18.04.3-live-server-amd64.iso filename=/Users/developer/code/bradj/goTorrent/uploadedTorrents/ubuntu-18.04.3-live-server-amd64.iso.torrent
time="2020-01-05T07:17:13-06:00" level=debug msg="Message From Client" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:13-06:00" level=debug msg="Client Requested TorrentList Update" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:13-06:00" level=debug msg="Current TorrentQueues" Max Active: =5 TorrentQueues="{5 [] [] []}"
time="2020-01-05T07:17:13-06:00" level=debug msg="Previous and Current Torrent Lists for sending to client" previousTorrentList="[]" torrentList="{torrentList 0 []}"
time="2020-01-05T07:17:15-06:00" level=debug msg="Message From Client" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:15-06:00" level=debug msg="Client Requested TorrentList Update" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:15-06:00" level=debug msg="Current TorrentQueues" Max Active: =5 TorrentQueues="{5 [] [] []}"
time="2020-01-05T07:17:15-06:00" level=debug msg="Previous and Current Torrent Lists for sending to client" previousTorrentList="[]" torrentList="{torrentList 0 []}"
time="2020-01-05T07:17:18-06:00" level=debug msg="Message From Client" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:18-06:00" level=debug msg="Client Requested TorrentList Update" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:18-06:00" level=debug msg="Current TorrentQueues" Max Active: =5 TorrentQueues="{5 [] [] []}"
time="2020-01-05T07:17:18-06:00" level=debug msg="Previous and Current Torrent Lists for sending to client" previousTorrentList="[]" torrentList="{torrentList 0 []}"
time="2020-01-05T07:17:19-06:00" level=debug msg="Message From Client" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:19-06:00" level=debug msg="Client Requested TorrentList Update" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:19-06:00" level=debug msg="Current TorrentQueues" Max Active: =5 TorrentQueues="{5 [] [] []}"
time="2020-01-05T07:17:19-06:00" level=debug msg="Previous and Current Torrent Lists for sending to client" previousTorrentList="[]" torrentList="{torrentList 0 []}"
time="2020-01-05T07:17:20-06:00" level=debug msg="Running a torrent Ratio and Queue Check"
time="2020-01-05T07:17:20-06:00" level=error msg="Error selecting torrent with hash!" error="not found" selectedHash=194257a7bf4eaea978f4b5b7fbd3b4efcdd99e43
time="2020-01-05T07:17:23-06:00" level=debug msg="Message From Client" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:23-06:00" level=debug msg="Client Requested TorrentList Update" message="{torrentListRequest <nil>}"
time="2020-01-05T07:17:23-06:00" level=debug msg="Current TorrentQueues" Max Active: =5 TorrentQueues="{5 [] [] []}"
time="2020-01-05T07:17:23-06:00" level=debug msg="Previous and Current Torrent Lists for sending to client" previousTorrentList="[]" torrentList="{torrentList 0 []}"
I noticed this chunk repeats quite often:
time="2020-01-05T07:31:48-06:00" level=debug msg="Message From Client" message="{torrentListRequest <nil>}"
time="2020-01-05T07:31:48-06:00" level=debug msg="Client Requested TorrentList Update" message="{torrentListRequest <nil>}"
time="2020-01-05T07:31:48-06:00" level=debug msg="Current TorrentQueues" Max Active: =5 TorrentQueues="{5 [] [] []}"
time="2020-01-05T07:31:48-06:00" level=debug msg="Previous and Current Torrent Lists for sending to client" previousTorrentList="[]" torrentList="{torrentList 0 []}"
I tried again, but this time I specified the Label
and StorageValue
. This failed as well.
... very long string ...
FileName:ubuntu-18.04.3-live-server-amd64.iso.torrent Label:ubuntu StorageValue:/Users/developer/Downloads]}"
time="2020-01-05T07:31:31-06:00" level=info msg="Added torrent" clienttorrent=ubuntu-18.04.3-live-server-amd64.iso filename=/Users/developer/code/bradj/goTorrent/uploadedTorrents/ubuntu-18.04.3-live-server-amd64.iso.torrent
time="2020-01-05T07:31:54-06:00" level=debug msg="Running a torrent Ratio and Queue Check"
time="2020-01-05T07:31:54-06:00" level=error msg="Error selecting torrent with hash!" error="not found" selectedHash=194257a7bf4eaea978f4b5b7fbd3b4efcdd99e43
I noticed logs were being printed to stdout that were not making it into logs/server.log
which were revealing:
go-libutp: 2020/01/05 07:31:54 callbacks.go:67: error sending packet: write udp6 [::]:55163->[2408:824e:3b0b:6990:80b5:b6c1:3e88:41ce]:2169: sendto: no route to host
go-libutp: 2020/01/05 07:31:54 callbacks.go:67: error sending packet: write udp6 [::]:55163->[2001:bc8:32d7:15b::]:64939: sendto: no route to host
go-libutp: 2020/01/05 07:31:55 callbacks.go:67: error sending packet: write udp6 [::]:55163->[2408:824e:3b0b:6990:c1c5:b3f:c6be:6fbd]:2169: sendto: no route to host
I disabled IPV6 in config.toml
: DisableIPv6 = true #boolean
It failed with the previous error in server.log
- "Error selecting torrent with hash!".
Here is stdout with IPV6 enabled:
[7:30:52] developer:goTorrent git:(master*) $ ./goTorrent
Failed creating 64-bit integer for goTorrent Port! strconv.ParseInt: parsing "": invalid syntax
Logging to file logs/server.log
2020-01-05 07:30:56 portfwd.go:31: discovered 0 upnp devices
2020-01-05 07:31:10 client.go:324: completed bootstrap, [{*dht.Server [dht server on [::]:55163]} {*torrent.Client [0xc00015e840]} {dht.TraversalStats [{9 0}]}]
Websocket connection established, awaiting authentication
ClientAuthToken: [MYTOKEN] TokenOkay true PayloadData map[ClientAuthString:[MYTOKEN]] PayloadData Okay? true
Authstring [MYTOKEN]
Claims <nil> <nil>
2020-01-05 07:31:22 client.go:324: completed bootstrap, [{*dht.Server [dht server on 0.0.0.0:55163]} {*torrent.Client [0xc00015e840]} {dht.TraversalStats [{9741 7718}]}]
go-libutp: 2020/01/05 07:31:54 callbacks.go:67: error sending packet: write udp6 [::]:55163->[2408:824e:3b0b:6990:80b5:b6c1:3e88:41ce]:2169: sendto: no route to host
go-libutp: 2020/01/05 07:31:54 callbacks.go:67: error sending packet: write udp6 [::]:55163->[2001:bc8:32d7:15b::]:64939: sendto: no route to host
go-libutp: 2020/01/05 07:31:55 callbacks.go:67: error sending packet: write udp6 [::]:55163->[2408:824e:3b0b:6990:c1c5:b3f:c6be:6fbd]:2169: sendto: no route to host
^C
Here is stdout with IPV6 disabled:
[7:40:56] developer:goTorrent git:(master*) $ ./goTorrent
Failed creating 64-bit integer for goTorrent Port! strconv.ParseInt: parsing "": invalid syntax
Logging to file logs/server.log
2020-01-05 07:41:04 portfwd.go:31: discovered 0 upnp devices
2020-01-05 07:41:33 client.go:324: completed bootstrap, [{*dht.Server [dht server on 0.0.0.0:57816]} {*torrent.Client [0xc0000ac840]} {dht.TraversalStats [{10147 8009}]}]
Websocket connection established, awaiting authentication
ClientAuthToken: [MYTOKEN] TokenOkay true PayloadData map[ClientAuthString:[MYTOKEN]] PayloadData Okay? true
Authstring [MYTOKEN]
Claims <nil> <nil>
^C
I was bored this morning and decided to poke around on this issue since I have a couple MBP's lying around. Hopefully you've found this helpful. Let me know if you need anything else.
From the files pane supply a download link to download that file directly from the browser.
Current the ETA function is very sporadic and fails to return an ETA on a regular basis, will need to rewrite it to be more robust.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ššš
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ā¤ļø Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.