sock2tcp
sock2tcp is a simple tool to forward a local socket to serve as a TCP server.
It is useful when you have a local socket and you want to expose it to specific IP and port.
Installation
go install github.com/evsio0n/sock2tcp
Usage
- use
.env
file to configure the server
Parameter | Description |
---|---|
UNIX_SOCKET_PATH | The path of the local socket |
TCP_BIND_ADDRESS | The port to expose the socket |
UNIX_SOCKET_PATH=/path/to/socket
TCP_BIND_ADDRESS=0.0.0.0:8080
- use environment variables to configure the server
export UNIX_SOCKET_PATH=/path/to/socket
export TCP_BIND_ADDRESS=0.0.0.0:8080
./sock2tcp
- use docker container.
docker run -v /tmp/mysql.sock:/tmp/mysql.sock -e "UNIX_SOCKET_PATH=/tmp/mysql.sock" -e "TCP_BIND_ADDRESS=0.0.0.0:3306" -p 3306 ghcr.io/evsio0n/sock2tcp:latest