A simple but fast webhook reverse proxy written in Go that allows you to host multiple Telegram bots in the same HTTP port.
- Download the latest binary version for your system and skip to the Running it section below.
- Make sure you have Go installed (at least v1.16)
- Clone the repo
- Run
go build -o gateway.exe ./src
- Generate a config file (
bots.yaml
) by running./gateway.exe -i
. The file will look like this:
config:
# Private key file
key: bot.key
# Certificate file
cert: bot.crt
# Listen address (ip:port)
listen: localhost:8443
# Strict mode, ignore requests not coming from Telegram
strict: false
bots:
# Bot name for reference (optional)
- name: Bot One
# Gateway endpoint for receiving updates on
endpoint: /bot1
# Path that requests will be forwarded to (the bot's webhook URL)
path: https://localhost:3000/bot
- name: Bot Two
endpoint: /bot2
path: https://localhost:3001/bot
- Modify the file to suit your needs
- Run the binary:
./gateway.exe
-f string
Use the specified .yaml file (default "bots.yaml")
-l string
Listen address (default "localhost:8443")
-c string
Certificate file for HTTPS
-k string
Private key file for HTTPS
-i
Initialize (create) bots.yaml file
-s
Strict mode - blocks requests not coming from Telegram
Note: Running this behind a proxy or a NAT with Strict mode is not recommended. Try disabling it if you're having issues receiving updates.
- Improve logging
- Add more comments to the code
- Allow specifying options in the
bots.yaml
file - Improve HTTP client (set proper timeouts, ignore certs, etc)
- Implement
-i
(init) flag for generating defaultbots.yaml
file - Use goreleaser to automate the building process
- Improve non-Telegram IP blocking middleware
- Make the Taskfile actually usable
- Support JSON config files
- Auto reload..?