Giter Club home page Giter Club logo

thefcraft / portforwardpy Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 396 KB

Linkifyr is a Python script that enables port forwarding functionality. It allows users to forward network traffic from one port to another, facilitating various network-related tasks such as proxying, tunneling, and redirecting traffic between different hosts or processes.

Home Page: https://linkifyr.thefcraft.site/

Python 76.53% HTML 23.47%
fastapi ngrok-alternative port-forwarding winsock

portforwardpy's Introduction

Linkifyr Tunnel

This project implements a tunnel service similar to Ngrok, allowing users to expose their local servers to the internet securely. The implementation consists of a client-side application (client.py) and a server-side application (app.py) using FastAPI for handling WebSocket connections and HTTP requests.

Download

linkifyr.exe

to run open cmd and ./linkifyr.exe --url http://127.0.0.1:5000/ --server_url linkifyr.thefcraft.site --server_protocol https

Features

  • Dynamic urls like https://{client_id}.linkifyr.thefcraft.site
  • Securely exposes local servers to the internet.
  • Handles HTTP/HTTPS requests and forwards them to the local server.
  • Displays connection status and information using Rich for a better CLI experience.

DEMO

python client.py --url http://127.0.0.1:5000/
╭─────────────────────────────────────────────────────── Linkifyr Tunnel ──────────────────────────────────────────────────────────╮
│ Session Status: online                                                                                                           │
│ Account: User                                                                                                                    │
│ Version: 1.0.0                                                                                                                   │
│ Region: Unknown                                                                                                                  │
│ Latency: Unknown                                                                                                                 │
│ Web Interface: Under development                                                                                                 │
│ Forwarding: https://62dc-f9-d0-9f65.dev.thefcraft.site -> http://127.0.0.1:5000/                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Client ID: 62dc-f9-d0-9f65
Connection established
Your site http://127.0.0.1:5000/ is live at https://62dc-f9-d0-9f65.linkifyr.thefcraft.site

Getting Started

Prerequisites

  • Python 3.7+
  • aiohttp
  • requests
  • fastapi
  • uvicorn
  • rich
  • cryptography

Install the required packages using pip:

pip install aiohttp requests fastapi uvicorn rich cryptography

Client-Side Application

The client-side application (client.py) connects to the server, retrieves a unique client ID, and establishes a WebSocket connection for forwarding requests.

Usage

Run the client-side application with the following command:

python client.py --url http://127.0.0.1:5000/ --server_url Ilinkifyr.thefcraft.site --server_protocol https

Arguments

  • --url: The local URL to be exposed (default: http://127.0.0.1:5000/).
  • --server_url: The server URL to connect to (default: dev.thefcraft.site).
  • --server_protocol: The protocol to use for server connection (http or https, default: https).

Server-Side Application

The server-side application (app.py) uses FastAPI to handle incoming WebSocket connections and HTTP requests, forwarding them to the appropriate client.

Running the Server

Run the server-side application with the following command:

uvicorn app:app --host 0.0.0.0 --port 8080

dns config

use wildcard domain

adding a wildcard custom domain on onrender

Workflow

  1. Client Connection: The client connects to the server and retrieves a unique client ID.
  2. WebSocket Connection: The client establishes a WebSocket connection using the retrieved client ID.
  3. Request Forwarding: The server forwards incoming HTTP requests to the connected client, which processes them and returns the response.

Project Structure

.
├── client.py
├── app.py
└── README.md
  • client.py: Contains the client-side logic for connecting to the server and forwarding requests.
  • app.py: Contains the server-side logic for handling WebSocket connections and HTTP requests.
  • README.md: Project documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • Ngrok for the inspiration.
  • FastAPI for the excellent web framework.
  • Rich for the beautiful CLI components.

For more details, visit the GitHub repository.

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.