Torrxfer Client/Server
A simple directory scanner client and hosting server to copy/move torrent downloads
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
-
About The Project
-
Getting Started
- Usage
- Roadmap
- Contributing
- License
- Contact
- Acknowledgements
About The Project
Built With
Getting Started
To get a local copy up and running follow these simple steps.
Prerequisites
This is an example of how to list things you need to use the software and how to install them.
Installation
- Clone the repo
git clone https://github.com/sushshring/torrxfer.git
- Download dependencies
make vendor
- Compile Torrxfer
make torrxfer-server
make torrxfer-client
Alternately
# This will run the linter, download protoc, download vendor deps, run protoc generation, and compile sources
make protoc
make
Run tests
make test
Usage
Torrxfer Server
#usage: torrxfer-server [<flags>]
#Torrent downloaded file transfer server
# Flags:
# --help Show context-sensitive help (also try --help-long and --help-man).
# --debug Enable debug mode
# --tls Should server use TLS vs plain TCP
# --cafile=CAFILE The file containing the CA root cert file
# --keyfile=KEYFILE The file containing the CA root key file
# --version Show application version.
Debug (development) mode
torrxfer-server --debug
Production mode
torrxfer-server --tls --cafile=</path/to/cafile> --keyfile </path/to/keyfile>
Environment variables
TORRXFER_SERVER_MEDIADIR
: Set the root directory to transfer files to
TORRXFER_SERVER_LOGFILE
: Set the logging file to write logs to in addition to stdout
TORRXFER_SERVER_PORT
: Set the port the server should listen on
Torrxfer Client
# usage: torrxfer-client --config=CONFIG [<flags>]
# Torrent downloaded file transfer server
# Flags:
# --help Show context-sensitive help (also try --help-long and --help-man).
# --debug Enable debug mode
# --config=CONFIG Path to configuration file
# --version Show application version.
torrxfer-client --config=</path/to/config.json> [--debug]
JSON Config example
{
"Servers": [{
"Address": "localhost",
"Port": 9650,
"Secure": false
},{
"Address": "server.com",
"Port": 9650,
"Secure": true,
"CertFile" "/path/to/certificate-file.pem"
}]
"WatchedDirectories": [{
"Directory": "/path/to/watched-directory/",
"MediaRoot": "/path/to" // Directory must be sub-dir of MediaRoot
}],
"DeleteFileOnComplete": true
}
Advanced design
Client
The client is a simple command-line application that runs on the source system. It watches over a number of directories and transfers its contents to the connected server(s).
Operations
-
Directory watch
Provided a list of directories, the client watches them for any changes and triggers a copy to the server. If DeleteFileOnComplete
is set, once the file is transferred it will be deleted
// WatchDirectory watches a provided directory for changes and returns a channel which yields filepaths
// Currently the client does not support retroactively sending watched files to a new server connection
// If a new server connection is made, it will only get updates for files that are created or written to
// after the connection starts
func (client *TorrxferClient) WatchDirectory(dirname, mediaDirectoryRoot string) error
-
Server connections
Connect to an active server
- Library methods:
// Connect to a server that is listening for new file transfers
func (client *TorrxferClient) ConnectServer(server common.ServerConnectionConfig) (*ServerConnection, error)
- Types:
type ServerConnectionConfig struct {
Address string `json:"Address"`
Port uint32 `json:"Port"`
UseTLS bool `json:"Secure"`
CertFile *x509.Certificate `json:"CertFile"`
}
type ClientConfig struct {
Servers []ServerConnectionConfig `json:"Servers"`
WatchedDirectories []WatchedDirectory `json:"WatchedDirectories"`
DeleteOnComplete bool `json:"DeleteFileOnComplete"`
}
type WatchedDirectory struct {
Directory string `json:"Directory"`
MediaRoot string `json:"MediaRoot"`
}
Server
The server works as a gRPC service and accepts connections from authenticated clients. Clients may make gRPC calls to the server to request functionality listed below. The job of the server is to accept incoming files and stage them for the media manager application.
Operations
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
)
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the Branch (
git push origin feature/AmazingFeature
)
- Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Your Name - @sushshring - contact@sushshring.com
Project Link: https://github.com/sushshring/torrxfer