[erlang-questions] how to bind to divert socket in erlang

Gleb Peregud gleber.p@REDACTED
Thu Aug 30 16:25:37 CEST 2012


I'm not sure if it helps, but read inet:setops/2 (especially last few
paragraphs) and it it doesn't help, take a look at procket:

https://github.com/msantos/procket

On Thu, Aug 30, 2012 at 4:08 PM, Michael van Slingerland
<kanslozegast@REDACTED> wrote:
> Hi,
>
> I am working on a transparent proxy on openbsd that adds headers to
> http get requests.
> everything passing through the machine destined for port 80 will be
> redirect through a divert-socket to a userland daemon listening on
> port  8080.
>
> In python it is quite simple:
>
> socket.IPPROTO_DIVERT = 258
> self.sock = socket.socket(socket.AF_INET, socket.SOCK_RAW,
> socket.IPPROTO_DIVERT)
> self.sock.bind(("0.0.0.0", port))
>
> This makes the program listen on a divert socket on port 8080.
>
> My question is how I can set this in erlang?
> I am no erlang expert, I have been browsing through the gen_tcp an
> inet docs, but no success.
>
> Any help appreciated!
>
> thanks,
> Mike
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list