Skip to content

Cloudflare access but for TCP and selfhosted because the only alternative i found is in chinese

License

Notifications You must be signed in to change notification settings

Paylicier/Bifrost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Bifrost Logo

Bifrost 🌈

A simple and easy to use TCP Tunnel with a webUI to expose your local services.

Features ✨

  • 🌐 WebUI

    • Authentification
    • Add backends and tunnels easily
    • Regenerate API Keys
  • ⌛ Easy to setup

    • No need to open port on client
    • One-click setup
    • Compatible with docker

Architecture Overview 🏗️

The system consists of two main components:

  1. Server: Handles WebUI and tunnel output
  2. Client: Connects to server and forwards local traffic

Setup 🚀

Prerequisites

  • Bun 1.1.34+
  • 1 server with a public ipv4
  • 1 client

Server Setup

Standalone

  1. Clone the repo:
git clone https://github.com/Paylicier/Bifrost
  1. Install dependencies:
bun install
  1. Configure environment variables in .env:
PORT=9040
BACKEND_PORT=9041
PASSWORD=your_secure_password
SECRET_KEY=your_jwt_secret_key
  1. Start the server:
cd server
bun main.ts

Docker

  1. Create a backend.json file
echo "[]" > backends.json
  1. Start the container
docker run -d --name bifrost-server \
  --network host \
  -e PORT=9040 \
  -e BACKEND_PORT=9041 \
  -e PASSWORD=your_secure_password \
  -e SECRET_KEY=your_jwt_secret_key \
  -v $(pwd)/backends.json:/app/backends.json \
  paylicier/bifrost-server

Backend Client Setup

Standalone

  1. Clone the repo:
git clone https://github.com/Paylicier/Bifrost
  1. Configure environment variables in .env:
API_KEY=your_api_key
SERVER_HOST=your_server_host
SERVER_PORT=9041
  1. Start the backend client:
cd client
bun main.ts

Docker

  1. Start the container
docker run -d --name bifrost-client \
  -e API_KEY=your_api_key \
  -e SERVER_HOST=your_server_host \
  -e SERVER_PORT=9041 \
  paylicier/bifrost-client

API Documentation 📚

Authentication Endpoints

  • POST /login
    • Login with admin password
    • Returns JWT token

Backend Management

  • GET /backends
    • List all registered backends
  • POST /backends
    • Register new backend
  • DELETE /backends/:id
    • Remove backend
  • POST /backends/:id/regenerate-key
    • Regenerate backend API key

Tunnel Management

  • GET /backends/:id/tunnels
    • List tunnels for backend
  • POST /backends/:id/tunnels
    • Create new tunnel
  • DELETE /backends/:id/tunnels/:tunnelId
    • Remove tunnel
  • PUT /backends/:id/tunnels/:tunnelId/toggle
    • Toggle tunnel status

Port Management

  • GET /check-port/:port
    • Check port availability
  • GET /random-port
    • Get available random port

Contributing 🤝

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

Built with 🥟 and ❤️ for 🌊

About

Cloudflare access but for TCP and selfhosted because the only alternative i found is in chinese

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published