g0ldyy / comet

Stremio's fastest torrent/debrid search add-on.
MIT License
234 stars 42 forks source link

feat: support external proxy service #162

Closed MunifTanjim closed 3 weeks ago

MunifTanjim commented 3 weeks ago

resolves https://github.com/g0ldyy/comet/issues/161

funkypenguin commented 3 weeks ago

This looks interesting, @MunifTanjim - what format is the proxy URL, and is it just a regular HTTP proxy, or would SOCKS work?

g0ldyy commented 3 weeks ago

what are the advantages to this compared to the default proxy?

MunifTanjim commented 3 weeks ago

This looks interesting, @MunifTanjim - what format is the proxy URL, and is it just a regular HTTP proxy, or would SOCKS work?

It's just a tiny http server with /proxy?url= endpoint accepting GET or HEAD method.

For authorization, it accepts either token query param or Proxy-Authorization header.

Usage:

For proxying https://jsoncompare.org/LearningContainer/SampleFiles/Video/MP4/sample-mp4-file.mp4, do:

GET http://stremthru.example.com/proxy?url=https%3A%2F%2Fjsoncompare.org%2FLearningContainer%2FSampleFiles%2FVideo%2FMP4%2Fsample-mp4-file.mp4

For calling API Endpoints from backend, Proxy-Authorization header can be used. But for streaming files from frontend, need to add the token query param with the url.

The proxy service itself can route the traffic through whatever it wants. For now https://github.com/MunifTanjim/stremthru supports HTTP_PROXY. I'm using it with https://github.com/cmj2002/warp-docker for tunneling traffic through Cloudflare Warp. I think it should be easy to use it with various VPN providers.

@funkypenguin

what are the advantages to this compared to the default proxy?

The default proxy works absolutely fine. I just want it to be decoupled from comet (and other addons).

(In the long term, I also want to integrate different debrid service inside stremthru itself... the goal would be to let any addon integrate stremthru instead of implementing multiple debrid service integration themselves. But that's irrelevant right now, since I haven't done the work yet.)

@g0ldyy


With all that being said, it's absolutely fine if you don't want to merge it in comet. I'm self-hosting my fork right now and it's working alright for me.

Also any suggestions are welcome.

MunifTanjim commented 3 weeks ago

After thinking about it more, this is currently not as useful as I'd like it to be.

I'll hopefully come up with something that'll be more useful for the community soon.