trakx

所属分类:网络编程
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2023-06-20 08:20:31
上 传 者sh-1993
说明:  以性能为中心的HTTP和UDP BitTorrent跟踪器,
(Performance focused HTTP & UDP BitTorrent tracker,)

文件列表:
Dockerfile (231, 2023-06-20)
LICENSE (1064, 2023-06-20)
PKGBUILD (739, 2023-06-20)
bencoding/ (0, 2023-06-20)
bencoding/dictionary.go (4186, 2023-06-20)
bencoding/dictionary_test.go (4536, 2023-06-20)
bencoding/encoding.go (1879, 2023-06-20)
bencoding/encoding_test.go (2462, 2023-06-20)
cli_entry.go (2147, 2023-06-20)
config/ (0, 2023-06-20)
config/config.go (3368, 2023-06-20)
config/embed.go (1868, 2023-06-20)
config/embed_bench_test.go (1095, 2023-06-20)
config/embed_test.go (2279, 2023-06-20)
config/embedded/ (0, 2023-06-20)
config/embedded/dmca.html (201, 2023-06-20)
config/embedded/index.html (698, 2023-06-20)
config/embedded/trakx.yaml (2436, 2023-06-20)
config/init.go (969, 2023-06-20)
config/load.go (902, 2023-06-20)
config/loglevel.go (289, 2023-06-20)
config/paths.go (979, 2023-06-20)
controller/ (0, 2023-06-20)
controller/controller.go (3820, 2023-06-20)
controller/pidfile.go (1572, 2023-06-20)
controller/pidfile_test.go (1743, 2023-06-20)
docker-compose.yml (189, 2023-06-20)
engine_entry.go (556, 2023-06-20)
go.mod (650, 2023-06-20)
go.sum (33594, 2023-06-20)
img/ (0, 2023-06-20)
img/flame.png (51473, 2023-06-20)
img/performance.png (73712, 2023-06-20)
img/stats.png (155733, 2023-06-20)
netdata/ (0, 2023-06-20)
... ...

# Trakx Performance focused BitTorrent tracker supporting HTTP, UDP, IPv4 and IPv6. - [Trakx](https://github.com/crimist/trakx/blob/master/#trakx) - [ Instances](https://github.com/crimist/trakx/blob/master/#-instances) - [ Install](https://github.com/crimist/trakx/blob/master/#-install) - [ Configuration](https://github.com/crimist/trakx/blob/master/#-configuration) - [Configuration file](https://github.com/crimist/trakx/blob/master/#configuration-file) - [Default configuration \& webserver files](https://github.com/crimist/trakx/blob/master/#default-configuration--webserver-files) - [Binding to privileged ports](https://github.com/crimist/trakx/blob/master/#binding-to-privileged-ports) - [Netdata setup](https://github.com/crimist/trakx/blob/master/#netdata-setup) - [Build Customization](https://github.com/crimist/trakx/blob/master/#build-customization) - [**Performance**](https://github.com/crimist/trakx/blob/master/#performance) - [**App engines**](https://github.com/crimist/trakx/blob/master/#app-engines) - [ Performance](https://github.com/crimist/trakx/blob/master/#-performance) ## Instances Try Trakx for yourself! These instances are hosted on Oracles always free tier. | Status | Protocol | Address | |--------------|-----------|-------------------------------------| | Ok | IPv4 UDP | `udp://u4.trakx.crim.ist:1337` | | Ok | IPv6 UDP | `udp://u6.trakx.crim.ist:1337` | | Ok | IPv4 HTTP | `http://h4.trakx.crim.ist/announce` | | Ok | IPv6 HTTP | `http://h6.trakx.crim.ist/announce` | ## Install Go 1.19+ required. ```sh git clone https://github.com/crimist/trakx && cd trakx # install to go bin go install . trakx status # generates configuration # or build go build . ./trakx status # generates configuration ``` See [configuration](https://github.com/crimist/trakx/blob/master/#configuration) and [netdata setup](https://github.com/crimist/trakx/blob/master/#netdata-setup). ## Configuration ### Configuration file The configuration file can be found at `~/.config/trakx/trakx.yaml`. You'll have to run the trakx controller at least once to generate this file. Config settings can be overwritten with environment variables: ```sh $ cat trakx.yaml ... loglevel = error ... $ TRAKX_LOGLEVEL=DEBUG trakx run 2022-01-16T19:52:25.627-0800 DEBUG Debug level enabled, debug panics are on ... ``` Trakx attempts to load the config file from the following directories in order: * `.` * `~/.config/trakx/` ### Default configuration & webserver files You can modify the default configuration and files served by the webserver in the `tracker/config/embeded/` folder. **NOTE:** Trakx webserver will only serve files at their full path. `dmca` will 404, `dmca.html` will 200. ### Binding to privileged ports To bind to privileged ports I recommend using `CAP_NET_BIND_SERVICE`. More information can be found [here](https://github.com/crimist/trakx/blob/master/https://stackoverflow.com/a/414258/6389542). ```sh $ sudo setcap 'cap_net_bind_service=+ep' ./trakx $ TRAKX_TRACKER_HTTP_PORT=80 ./trakx run 2022-04-05T16:18:05.847-0700 INFO HTTP tracker enabled {"port": 80} ``` ### Netdata setup **Warning:** `install.sh` will overwrite `go_expvar.conf`. If you are using other expvar programs with netdata manually merge the two files. * Run `/etc/netdata/edit-config python.d.conf`, change `go_expvar` to `yes`. * Customize the url in `netdata/expvar.conf` if needed. * Install netdata plugins with `cd netdata; ./install.sh`. ### Build Customization Trakx takes advantage of Go's build tags to target different use cases. #### **Performance** The `fast` tag will build Trakx without IP, seed, and leech metrics which will reduce cpu and memory usage. #### **App engines** The `heroku` tag will build trakx for app engines. This means the executable will immediately run the tracker rather than provide the daemon controller behavior included in the regular CLI build. Feel free to customize the tags to suit whichever app engine you prefer in [engine_entry.go](https://github.com/crimist/trakx/blob/master/./engine_entry.go). ## Performance The following metrics were collected on Heroku free tier running an HTTP tracker with the `fast` tag disabled. Heroku dashboard: ![performance](https://github.com/crimist/trakx/blob/master/img/performance.png) Database stats: ![performance](https://github.com/crimist/trakx/blob/master/img/stats.png) Flamegraph: ![flame](https://github.com/crimist/trakx/blob/master/img/flame.png) Trakx has been optimized to use a little CPU time as possible. In most cases, almost all CPU time will be spent handing (negotiating/send/recv) connections, especially for TCP (HTTP). Trakx has also been optimized to use minimal memory and is mostly limited by the go GC. In this example the GC runs every 2 minutes ([the forced GC period](https://github.com/crimist/trakx/blob/master/https://github.com/golang/go/blob/895b7c85addfffe19b66d8ca71c31799d6e55990/src/runtime/proc.go#L4481-L4486)) at this level of traffic. The `inuse_space` delta from GC is 7.5% meaning this collection frequency would be sustained at `GOGC=8`.

近期下载者

相关文件


收藏者