Giter Club home page Giter Club logo

good-proxy's Introduction

GoodProxy

GoodProxy is a lightweight proxy server built with Hono that facilitates fetching and transforming resources from remote servers. It handles various types of content including VTT files, HLS streams, and more, while providing enhanced CORS support and URL transformation capabilities.

Features

  • CORS Support: Allows cross-origin requests with customizable headers.
  • Content Handling: Supports fetching and transforming VTT files, HLS streams, and more.
  • Dynamic URL Replacement: Automatically updates URLs in fetched content to proxy paths.

Installation

To get started with GoodProxy, follow these steps:

  1. Clone the Repository:

    git clone https://github.com/yourusername/goodproxy.git
    cd goodproxy
  2. Install Dependencies:

    bun install
  3. Start the Server:

    bun run dev

    The server will be available at http://localhost:8787.

Usage

Endpoints

  • GET /: Returns a simple "Hello Hono!" message.
  • GET /fetch: Proxy endpoint that fetches content from a remote server based on the url query parameter. Additonally, you can also pass referers using ref parameter.

Example Request

To fetch and transform content from a remote URL, you can make a request to /fetch with a url parameter:

curl "http://localhost:8787/fetch?url=https://example.com/resource?ref=https://some-referer.com"

Example:

const m3u8url = "https://vz-cea98c59-23c.b-cdn.net/c309129c-27b6-4e43-8254-62a15c77c5ee/842x480/video.m3u8";
const proxyUrl = "https://goodproxy.goodproxy.workers.dev";

const proxiedUrl = `${proxyUrl}/fetch?url=${m3u8url}`; // both encoded and non encoded urls will work
// https://goodproxy.goodproxy.workers.dev/fetch?url=https%3A%2F%2Fvz-cea98c59-23c.b-cdn.net%2Fc309129c-27b6-4e43-8254-62a15c77c5ee%2F842x480%2Fvideo.m3u8
// https://goodproxy.goodproxy.workers.dev/fetch?url=https://vz-cea98c59-23c.b-cdn.net/c309129c-27b6-4e43-8254-62a15c77c5ee/842x480/video.m3u8

CORS Headers

GoodProxy includes the following CORS headers by default:

  • Access-Control-Allow-Origin: *
  • Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
  • Access-Control-Allow-Headers: Content-Type, Authorization
  • Access-Control-Max-Age: 3600

These can be modified as needed in the request.ts file.

Development

For development, you can use the following commands:

  • Run in Development Mode:

    bun run dev

License

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

Contributing

Contributions are welcome! Please open an issue or submit a pull request to contribute to GoodProxy.

Contact

For any questions or feedback, please contact [email protected].

good-proxy's People

Contributors

real-zephex 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.