https://github.com/yc/unix2tcp
https://github.com/yc/unix2tcp
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yc/unix2tcp
- Owner: YC
- License: mit
- Created: 2021-12-02T11:05:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-06T10:19:59.000Z (about 1 year ago)
- Last Synced: 2025-01-20T18:11:33.573Z (5 months ago)
- Language: Shell
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unix2tcp
This Docker image relays data between a Unix Domain Socket source and an address (hostname:port) destination.## Example
Create and accept connections on /tmp/http.sock and relay them to 127.0.0.1 port 80:
```
./unix2tcp.sh /run/sock/http.sock 127.0.0.1:80 []
```This is a wrapper around the following socat command:
```
socat UNIX-LISTEN:/tmp/http.sock,fork, TCP-CONNECT:127.0.0.1:80
```Where `` may include specification of `user`, `group`, `mode` etc.
## Why?
Some applications only support listening over IP ports, and it may be non-trivial to add support for Unix Domain Sockets.My use case:
- Application and unix2tcp/socat are in Docker containers, on same network
- Application listens over port, unix2tcp/socat listens over unix domain socket and relays data
- Result: port is not exposed to host### Downsides/Issues of this approach
- Source IPs are not retained
- Not as clean as ip2unix## Notable projects in this area
- ip2unix
- https://hub.docker.com/r/alpine/socat