A peer-to-peer file discovery and sharing tool for LANs written in Go!
The diztl project is written in Go with the frontend implementation in Java using JavaFX. To get started, run the following commands:
go get -v github.com/gravetii/diztl/...
Diztl requires Java 8 to be installed on the host machine for the UI to work.
- Make a copy of the
config-template.yml
which is a bare-bones configuration file for diztl, and name itconfig.yml
-cp config-template.yml config.yml
. Theconfig.yml
file is the actual config file required for diztl to work. If you want to make any changes to the configuration, this is the file you want to edit. Note that this file is untracked in the repo (unlike theconfig-template.yml
) which ensures that changes specific to your environment aren't reflected publicly. If any changes are to be reflected publicly, they need to go into theconfig-template.yml
file. - Optionally, you can also add the
config.yml
entry in your.git/info/exclude
file so that git doesn't prompt you to add it to the stage all the time.
In the root folder of the project:
go run tracker/main.go
: This runs the tracker node on the localhost.- Specify the local IP address of the
Tracker
in theconfig.yml
file to allowNode
s to connect to it. go run node/main.go
: Run this anywhere on any machine in the network to fire up aNode
.- Fire up the UI (for this, currently, you'll have to build the code located in the
ui
folder and run it) and discover/share/download files in your network.
Diztl consists of two main components:
- Tracker: The
Tracker
's responsibility is to allow co-ordination and communication between the differentNode
s. - Node: A
Node
is basically any peer in the network. It can share resources as well as request for and download resources from otherNode
s in the network.
The current implementation isn't completely decentralized in that the search queries from a Node
are sent to the Tracker
which then broadcasts the request across all peers in the network, requesting them to reply back with the files they have that might be of interest to the caller Node
.
Once the requesting Node
decides on the file it wants to download from the target peer, communication happens solely between the two peers without any intervention from the Tracker
.
When the Node
first starts up, it indexes all the files to be shared in the default share folder located under <user_root>/Documents/diztl/share
. By default, downloaded files are located under /downloads
directory of the shared folder. The Node
then connects to the Tracker
and registers itself after which it can participate in the network and communicate with other nodes. The share and downloads folders can be configured by changing the corresponding configurations in the config.yml
file (requires restart of tracker and/or node).
For the formats of different request-response structures, take a look at the diztl/diztl.proto
file which contains the protobuf specifications as well as the gRPC service definitions.
The node UI is implemented in Java using JavaFX which communicates with the node's gRPC server to facilitate user actions.
- gRPC: The project uses gRPC as its communication protocol along with protocol buffers as the data-interchange format.
- JFoenix: JFoenix is the material design library for JavaFX.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to the project.
- Sandeep Dasika
MIT