You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I took a stab at implementing this. The change in mug is no problem. My proposed solution is to handle the host name as a gleam String and then to check if it starts with "/" or "@" and if so handle it as a unix socket or a unix abstract socket respectively. The idea came from how elixir postgres handles connecting to unix sockets.
The only design decision is if this should be handled in the gleam code or in the ffi. To me it seems easier to do by just modifying the ffi.
The alternative is to handle this in gleam, which I also tried. It requires a tagged type which will require an wrapped connect methods (which could accept {local, string()|binary()} or {hostname, string()}) or to have multiple external connectors and handle in gleam.
Another thing to consider is that the unix socket argument to connect accepts both an erlang string and an erlang binary. The thing is that they are handled differently. The binary is passed as is while the string is encoded using the file-system encoding (more here: https://www.erlang.org/doc/apps/kernel/inet.html#t:local_address/0). I don't know which one is more appropriate.
Lastly: mug uses glisten for testing purposes. glisten does currently not support unix sockets. I have a prototype done in glisten which adds support for that. The alternative (which I tried) is to write an FFI erlang echo server and use that instead.
I can PR the above code (but without unit tests) or I can wait until glisten code is done and merged and PR it with unit tests.
Anyway, as soon as these questions are sorted I can have a PR in.
As per the conversation in discord;
The text was updated successfully, but these errors were encountered: