UNIX Socket to TCP Bridge
UNIX Bridge to TCP Bridge use socat to create tunnel between UNIX socket and TCP port. Library can be used with libraries, which need TCP port but you want to use UNIX socket (e.g. for Docker).
Inspiration to create this library was erldocker_unixbridge in Erlang library for Docker: erldocker.
Installation
The package can be installed by adding socket_tcp_bridge to your list of dependencies in mix.exs:
def deps do
[{:socket_tcp_bridge, "~> 0.1.0"}]
endUsage
Just start process (in production use supervisor to monitor SocketTcpBridge process) with UNIX socket path and port:
{:ok, pid} = SocketTcpBridge.start_link("/var/run/docker.sock", 8000)and you can connect to docker using port 8000 and Docker library which support Docker HTTP API.
Important: Library use socat which need to be installed in your system.