mizalewski / elixir-unixbridge

Bridge between unix socket and tcp port

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UNIX Socket to TCP Bridge

UNIX Bridge to TCP Bridge uses socat to create the tunnel between UNIX socket and TCP port. The 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"}]
end

Usage

Just start a 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.

About

Bridge between unix socket and tcp port

License:MIT License


Languages

Language:Elixir 100.0%