Skip to content

gberrante/gotunnel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License

Simple TCP Tunnel application

I was tired of complicated netsh,iptables,socat commands, so I wrote this simple TCP tunnel application in Go.

Description

This TCP tunnel application allows you to forward TCP connections from one port to another. It can be useful for debugging or accessing services that are not directly exposed or proxy between two networks.

The application has no external dependencies.

It supports both IPv4 and IPv6 connections.

Usage

To run the application as standalone:

./gotunnel -listen <source-address>:<source-port> -connect <target-address>:<target-port>

Command Line Options

  • -listen <source-address>:<source-port>: The address and port to listen for incoming connections.
  • -connect <target-address>:<target-port>: The address and port to connect to for forwarding the traffic.
  • -help: Show the help message with usage instructions.

if source-address or target-address is not specified, it defaults to all interfaces.

Example

To forward traffic from port 8080 on all interfaces to port 80 on example.com, you can run:

./gotunnel -listen :8080 -connect example.com:80

Systemd Service

Example of a systemd service file to run the application as a service (gotunnel.service):

[Unit]
Description=Simple TCP Tunnel Service
After=network.target

[Service]
ExecStart=/path/to/gotunnel -listen <source-address>:<source-port> -connect <target-address>:<target-port>
Restart=always

[Install]
WantedBy=multi-user.target

Place the gotunnel.service file in /etc/systemd/system/ and enable it with:

sudo systemctl enable gotunnel.service
sudo systemctl start gotunnel.service

About

Simple TCP tunnel

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages