Giter VIP home page Giter VIP logo

mahsa_server's Introduction

Mahsa Server

What is Mahsa Server?

Mahsa Service is a web based application that enables VPN configs providers to submit their configs to be used in the MahsaNG app.

How to run

  1. install docker and docker-compose
  2. run docker-compose up -d

How to check

Login - Superuser

Monitoring (must be superuser)

How to develop

Frontend

cd frontend
npm install
npm run serve

Backend

cd backend
virtualenv .env --python=python3.9
source .env/bin/activate
pip3 install -r requirements.txt

Django

./manage.py migrate
./manage.py runserver 0.0.0.0:8000
./manage.py createsuperuser  # create a django superuser (for admin login)

Endpoints

  • Config

    [POST] /backend/app/config/        # add new config
    [GET] /backend/app/config/<uuid>/  # retrieve created config
    [GET] /backend/app/config/stats/   # configs stats
    [GET] /backend/app/config/hit_me/  # draw 2 new configs
    [GET] /backend/app/config/ip/      # find ip of client (we use this for finding config server ip!)
    
  • Report

    [POST] /backend/app/report/        # add a single report
    

Celery

  • Worker
    celery -A worker.app worker --loglevel=info
    
  • Beat Scheduler
    celery -A worker.app beat --loglevel=info
    
  • Flower
    celery -A worker.app flower --loglevel=info
    

Docker Services

  • backend: django, celery
  • nginx: serves frontend and static files + proxy to backend service via /backend
  • xray: container that has link2json and xray installed + a flask webserver
  • redis

Tech Stack

  • backend
    • django (main backend)
    • flask (xray webserver)
    • celery (running async tasks)
    • supervisor (managing backend processes)
  • frontend
    • Vue.js (can be replaced by any frontend framework)
  • redis (used for celery)
  • sqlite (django database)

mahsa_server's People

Contributors

gfw-knocker avatar mahsanet avatar

Stargazers

 avatar Pedro-Salvatore avatar  avatar  avatar noone avatar ITLover avatar  avatar  avatar  avatar  avatar  avatar Hosein avatar Ahamd avatar  avatar Amir Gh avatar  avatar  avatar  avatar  avatar  avatar aliazad avatar  avatar  avatar IRCF avatar

Watchers

 avatar  avatar  avatar

mahsa_server's Issues

[Frontend] Config Intake Form

An intake config submission form implemented with vanilla HTML/CSS/JS or using any framework such as Vue/React.

Note: Config fields must be finalized

New Model for saving XRay results

Currently, we are saving the last xray result in the Config table. We loose the history of the xray runs.

So, we can add a new model called XRayResult to save the results of the xray run and have FK to the Config model.

[backend] Create an endpoint for ingesting new Config

User fills out a form which will implemented in the frontend with her/his new config and the data of the form will be submited to this form via POST.

This enpoint will get the form data (and possibly test it with xray or a simple tcp ping) and saves it to the database.

Note: Config model fields needs to be finalized.

[Backend] Design an algorithm for providing the best 2 configs

There are two cases.

  1. Static scoring (can be run in a Celery task and gets updated every hour) - could be slow
  2. Dynamic scoring (based on the user's IP, subnet, etc. we decide to choose which config suits the best) - must be fast

Static scoring

For static scoring we need to consider the following:

  1. User reports (ping, rating, etc)
  2. xray results
  3. ??

Dynamic scoring

When users sends a request to get a free Config, we run this algorithm to find the best match based on the static scoring and following conditions:

  1. User IP, Location, etc
  2. User Subnet
  3. Fragment ON/OFF
  4. ??

Related: #4

Adding User Login and User config management

We need to implement a user authentication which allows the config providers to login with their username and password and see their submitted configs.

  • Login Page
  • Registration Page
  • Exnted Django Auth user model

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.