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

(draft) Eio.Net.connect: optionally bind before connect #713

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

art-w
Copy link

@art-w art-w commented Mar 20, 2024

I'm looking to port some existing code which does a bind before connect and couldn't find a way to do it with Eio. I wasn't familiar with this trick, but it's apparently useful when you have multiple public IPs and need to control which one will be seen by the server.

Let me know if there's a better way to do this!.. I'm marking this PR as a draft because I'm starting to think this might actually require a new bind_connect function, to also expose the REUSEADDR/PORT options as they only make sense when ?bind is set.

@art-w art-w marked this pull request as draft March 20, 2024 18:24
@SGrondin
Copy link
Collaborator

I'd interested to hear what made you select this approach over exposing a bind function to the user?

@talex5
Copy link
Collaborator

talex5 commented Mar 23, 2024

This seems reasonable to me.

Possibly we should have a dedicated options argument (extensible variant) as there will likely be loads more special features that could be added (see e.g. #575).

e.g. something like

Net.connect net dst
   ~options:[Source_addr src]

Need to decide what to do if a backend doesn't support an option. e.g. mirage-tcpip doesn't look like it supports this (https://github.com/mirage/mirage-tcpip/blob/75382e296ff6779338c3b7b069c885d5d8e10eeb/src/core/tcp.mli#L76).

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

Successfully merging this pull request may close these issues.

3 participants