Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cohttp-eio: Expose local address to bind server to #925

Open
patricoferris opened this issue Aug 19, 2022 · 2 comments
Open

cohttp-eio: Expose local address to bind server to #925

patricoferris opened this issue Aug 19, 2022 · 2 comments

Comments

@patricoferris
Copy link

Currently running a cohttp-eio server only allows a user to set the port number of the local address to listen on, I think it would be good to let the user pass a full Eio.Net.Sockaddr.stream into the function so users can:

  • Change the IP address for a TCP socket (e.g. Eio.Net.Ipaddr.V4.any)
  • Use a Unix domain socket if possible

cc: @bikallem @talex5

@talex5
Copy link
Contributor

talex5 commented Aug 19, 2022

Note that you can use connection_handler to make your own run function fairly easily. We might want to provide an Eio.Net.run_server function in Eio (like Lwt has Lwt_io.establish_server).

Some other problems we might want to fix with that:

  • The cohttp version forces ~reuse_port:true, which should really be optional.
  • It requires a domain manager even if you don't need multiple domains.

@patricoferris
Copy link
Author

Note that you can use connection_handler to make your own run function fairly easily. We might want to provide an Eio.Net.run_server function in Eio (like Lwt has Lwt_io.establish_server).

Ah, thanks! Yes I think making that a bit more obvious would be helpful (although it might just be me...). Plus one for Eio.Net.run_server and then I think a doc comment with an example would be great too :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants