Giter VIP home page Giter VIP logo

ma-node's Introduction

Node App

Requirements

Network

The application needs to be visible from outside your local network. Therefore expose a port of your choice in your router. Otherwise nodes in the network are not able to download files from your computer!

Rust

If you wish to build the binary yourself you need rust installed with the version above. If not, skip this section and continue with the section Installation.


The node was tested and build with version 1.47.0 (18bf6b4f0 2020-10-07) of the rust programming language.

If you don't have rust installed follow the instruction on https://www.rust-lang.org/tools/install to install rust on your system.

After you installed Rust run

rustc --version

It should print out

rustc 1.47.0 (18bf6b4f0 2020-10-07)

If not run the following command to update your rust compiler version

rustup update

Installation

Clone the repository to a preferred location.

git clone https://github.com/timokae/ma-node.git

Step into the downloaded repo

cd ma-node

Create a new directory

mkdir run

Binary

Download the binary for your operating system (mac/linux) from Github https://github.com/timokae/ma-node/releases/latest and place the binary file inside the created folder run and rename the binary to node-app

Build yourself

If you want to build the binary yourself. Inside the ma-node folder

  1. Run cargo build --release
  2. Copy the binary into the run folder cp target/release/node-app run

Configuration

Copy the state example folder into the run directory with

cp -R state_example/ run/state

Go into the run directory

cd run

The directory run should look like this now

$ tree
.
├── node-app
└── state
    ├── config.json
    ├── files
    ├── file_state.json
    └── stat_state.json

In state/config.json

  • change the fingerprint to a unique name, for example a the first to letters of your name with some random numbers. It has to be string!
  • (optional) change the port property to the port the node should be running on. It must be visible from outside your network, for example by port forwarding!

In state/stat_state.json change the values of

  • uptime: Time of the day your computer is usually online. As an example, if your online from 8:00 to 12:00, insert [8, 12],
  • capacity: Amount of space you want to offer to the network (in bytes).
  • connection: Bandwidth of your internet connection (download in bits/s)

Do no change first_online, region and uptime_counter!

The files should look like this, with your input instead

state/config.json

{
  "fingerprint": "tk7331",
  "port": 8082,
  "manager_addr": "http://manager.peerdata.9e-staging.cloud/"
}

state/stat_store.json

{
  "first_online": 0,
  "region": "europe",
  "uptime": { "value": [10, 16], "weight": 0.2 },
  "capacity": { "value": 100000000, "weight": 0.3 },
  "connection": { "value": 120000, "weight": 0.2 },
  "uptime_counter": { "value": 0, "weight": 0.5 }
}

IPv6 Support

If your provider is using IPv6 lite or something similar, you can add the following line to state/config

{
  ...
  "ipv6": "YOUR IPv6 ADDRESS"
}

This tells the monitor to save and use your IPv6 address

Starting the node

Make the binary executable with

chmod +x node-app

To start the node run

./node-app ./state

If everything was done correctly, you should see something close to his

[INFO][2020-10-28 15:15:17] Assigned to monitor on address http://167.99.248.254
[INFO][2020-10-28 15:15:17] Node registered with address 45.138.43.136:8082
[INFO][2020-10-28 15:15:17] FileStore initialized: []
[INFO][2020-10-28 15:15:17] Region: europe
[INFO][2020-10-28 15:15:17] Services started
[INFO][2020-10-28 15:15:17] Startet server on 0.0.0.0:8082
[INFO][2020-10-28 15:15:17] Starting ping service.
[INFO][2020-10-28 15:15:17] Starting recover service
[INFO][2020-10-28 15:15:17] Starting distribution service

To test if other node can talk to your node, copy the the address from line two from the output above. In this case 45.138.43.136:8082 and append the path ping like this

http://45.138.43.136:8080/ping

Open this URL in your browser. If everything works fine, your node should respond with pong.

Otherwise check your settings for exposing your local machine. If your computer is not reachable, other devices are not able to download files from your node.

Using the network

To Upload a file, open http://manager.peerdata.9e-staging.cloud/ in your browser. Use the form to select a file from your computer. By submitting the form, the file gets uploaded to a node. The node then replicates the data. After your upload the manager shows you the hash of your file. Keep this hash if you want to download your file later.

To download the file visit http://manager.peerdata.9e-staging.cloud/download. Enter the hash of the file you want to download. The manager then searches for your file in the network. If a node with the given hash is reachable, the download starts automatically.

Troubleshooting

Wrong Manager Address

thread 'main' panicked at 'builder error: relative URL without a base',

Make sure the manager_addr property in the state/config.json is a valid url like http://manager.peerdata.9e-staging.cloud

Port already in use

thread 'main' panicked at 'error binding to 0.0.0.0:8080: error creating server listener: Address already in use (os error 98)

Make sure, that the choosen port is not blocked or already in use. Otherwise choose another port.

ma-node's People

Contributors

timokae avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.