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

More sophisticated network binding #29

Open
atomashpolskiy opened this issue Aug 8, 2017 · 0 comments
Open

More sophisticated network binding #29

atomashpolskiy opened this issue Aug 8, 2017 · 0 comments

Comments

@atomashpolskiy
Copy link
Owner

atomashpolskiy commented Aug 8, 2017

From #20:

Not sure if this is expected to work, but I tried with "-i eth1" and I get "Failed to parse the acceptor's internet address". It would be convenient if it could resolve iface name -> ip address.

Currently local address is set in bt.runtime.Config#acceptorAddress. It's used for:

  • binding an incoming connections acceptor
  • establishing outgoing peer connections
  • http tracker requests
  • udp tracker requests
  • binding DHT agent

Maybe we could provide a more sophisticated configuration, that would allow to specify a list of rules: internet addresses, address + network mask pairs, interface names, plus optionally the preferred address family.

Regarding the address selection algorithm, there are two possible implementations:

  1. Compile the list of rules to a java.function.Predicate<InetAddress> and use it to filter and select one appropriate address from those, that are available on the host. See DHTConfiguration in mldht and the corresponding issue for inspiration.
  2. Use the list of rules to traverse available addresses and select the first match. I personally prefer this one, despite it being O(mn) instead of O(n).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant