torrxfer

module
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2021 License: MIT

README

Contributors Forks Stargazers Issues MIT License LinkedIn Build status


Logo

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

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. 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

  1. Clone the repo
    git clone https://github.com/sushshring/torrxfer.git
    
  2. Download dependencies
    make vendor
    
  3. 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

  • Client connections
    • Service methods:
      service TorrxferServer {
          rpc TransferFile(File, stream byte) returns (FileSummary) {}
          rpc QueryFile(File) returns (FileSummary) {}
      }
      

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Your Name - @sushshring - contact@sushshring.com

Project Link: https://github.com/sushshring/torrxfer

Directories

Path Synopsis
cmd
internal
db
pkg
net

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL