hmarcelino / m3uproxy

M3U Proxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

M3U Proxy

Proxy written in Go. It will process an M3U response and transform the all channel addresses with new addresses. It was built taking with the purpose that all traffic goes through it.

Endpoints

  • GET /
$> curl http://${host}:${port}

Welcome to m3u proxy
  • GET /ping
$> curl http://${host}:${port}/ping

pong
  • GET /channels
$> curl http://localhost:9090/channels

#EXTM3U
#EXTINF:-1 tvg-id="ABC FHD" tvg-name="ABC FHD" tvg-logo="http://....png" group-title="group A"
http://localhost:9090/channels/5287
#EXTINF:-1 tvg-id="ABC HD" tvg-name="ABC HD" tvg-logo="http://....png" group-title="group A"
http://localhost:9090/channels/984
...
  • GET /channels/{id}
$> curl http://localhost:9090/channel/984

... stream ...
  • GET /channels/info/{id}
$> curl http://localhost:9090/channel/info/984

{
    Id: "984",
    Source: {
        Scheme: "http",
        Opaque: "",
        User: null,
        Host: "<originalHost>:<originalPort>,
        Path: "<original request uri to channel>",
        RawPath: "",
        ForceQuery: false,
        RawQuery: "",
        Fragment: ""
    }
}

FAQ

Requirements:

  • Golang >= 1.11
  • docker (if you whish to build the container)

How to build the proxy

go build m3uproxy/main.go

How to run locally with config file Requires config file. Look for example in config/config-dev.yml

go run m3uproxy/main.go -file <path to config file>

How to run locally with environment variables This is useful when running in a docker container

export M3U_PROXY_PORT="9090"
export M3U_PROXY_HOSTNAME="localhost"
export M3U_PROXY_CHANNELS_URL="<valid url to m3u list>"
go run m3uproxy/main.go

#or 

docker run -e M3U_PROXY_CHANNELS_URL="<valid url to m3u list>" -p 9090:9090  m3uproxy:latest
 

About

M3U Proxy


Languages

Language:Go 93.4%Language:Shell 6.2%Language:Dockerfile 0.4%