GOST supports port forwarding for both TCP and UDP protocols.
Local Port Forwarding (TCP/UDP)
Maps a local port to a remote destination through a proxy chain.
- TCP:
gost -L=tcp://:local_port/remote_host:remote_port. - UDP:
gost -L=udp://:local_port/remote_host:remote_port?ttl=seconds.- The
ttl parameter sets the timeout for the forwarding channel (default is 60s). - Note: When forwarding UDP through a proxy chain, the last node in the chain must be a SOCKS5 proxy to support UDP-over-TCP.
Remote Port Forwarding (TCP/UDP)
Exposes a remote port to a local destination through a proxy chain.
- TCP:
gost -L=rtcp://:remote_port/remote_host:remote_port. - UDP:
gost -L=rudp://:remote_port/remote_host:remote_port?ttl=seconds.- Note: Similar to local UDP forwarding, the last node in the chain must be a SOCKS5 proxy.
SSH Integration
If the last node in the chain is an SSH forwarding type, GOST can leverage native SSH local/remote port forwarding features.
### Local TCP forwarding
```bash
gost -L=tcp://:2222/192.168.1.1:22
Local UDP forwarding
gost -L=udp://:5353/192.168.1.1:53?ttl=60
Remote TCP forwarding
gost -L=rtcp://:2222/192.168.1.1:22 -F=socks5://172.24.10.1:1080
Remote UDP forwarding
gost -L=rudp://:5353/192.168.1.1:53?ttl=60 -F=socks5://172.24.10.1:1080