etherai / selfhosted-gateway

Self-hosted Docker native tunneling to localhost. Expose local docker containers to the public Internet via a simple docker compose interface.
https://fractalnetworks.co
GNU Affero General Public License v3.0
1.32k stars 66 forks source link

Added arbitrary TCP/UDP port forwarding functionality to link containers #50

Closed zacharylott94 closed 5 months ago

zacharylott94 commented 6 months ago

This allows users to create link containers for containerized services that require ports other than the typical 80/443 ports for HTTP/HTTPS. I have tested this with a Minecraft container for port 25565, a Terraria container for port 7777, and a UDP listener container on port 5005. I tried to make sure to preserve previous functionality, and to test this, I exposed a Nextcloud container through a gateway on a VPS to ensure that functionality still works.

To use the new feature, use the make link command by specifying TCP or UDP: make link GATEWAY=root@123.456.789.10 FQDN=subdomain.domain.com EXPOSE=TCP://terraria:7777 make link GATEWAY=root@123.456.789.10 FQDN=subdomain.domain.com EXPOSE=UDP://udp-service:5005

zacharylott94 commented 6 months ago

For raw TCP/UDP, the shape of the expose parameter was changed again. make link GATEWAY=root@123.456.789.10 FQDN=subdomain.domain.com EXPOSE=tcp://7777:terraria:1234 You can now specify the front-facing port (the port you would have users connect to) and the back port that the exposed service container is listening on.

zacharylott94 commented 6 months ago

I've added CI tests for raw TCP/UDP forwarding link containers.