Skip to content
This repository was archived by the owner on Oct 23, 2022. It is now read-only.

Configurable listening addresses #173

Closed
koivunej opened this issue May 25, 2020 · 0 comments · Fixed by #383
Closed

Configurable listening addresses #173

koivunej opened this issue May 25, 2020 · 0 comments · Fixed by #383
Assignees

Comments

@koivunej
Copy link
Collaborator

Currently rust-ipfs defaults to listening on a random localhost port like many rust-libp2p examples. In #169 the initial support for adding and removing listening addresses was implemented to realize a test case of a peer having multiple connections but the old behaviour of listening on a random localhost address remained.

rust-ipfs could however take the listening address(es) as a Multiaddr in IpfsOptions. This would allow removal of the random listening address.

This option could be populated per config section "Addresses" by the http.

@ljedrz ljedrz self-assigned this Sep 7, 2020
bors bot added a commit that referenced this issue Sep 9, 2020
364: Configurable listening addrs r=aphelionz a=ljedrz

This PR allows us to specify the desired listening address(es) of the node. For now, these addresses are just additions to the current randomly assigned listening address, as I'm not sure what to pick as the default; once we know this, the only change needed (besides the default listening addresses being put in the config) is to remove the following line from `p2p::create_swarm`:
```
// Listen on all interfaces and whatever port the OS assigns
Swarm::listen_on(&mut swarm, "/ip4/127.0.0.1/tcp/0".parse().unwrap()).unwrap();
```
Another question is how to handle a situation where one/all of the supplied addresses can't be listened on:
- refuse to start?
- assign a random different address?
- only log errors if at least one works?

This is currently unresolved, but since the PR preserves the current behavior, this is a concern that needs to be handled in the aforementioned later follow-up.

Cc #173.

Co-authored-by: ljedrz <ljedrz@gmail.com>
bors bot added a commit that referenced this issue Sep 9, 2020
364: Configurable listening addrs r=aphelionz a=ljedrz

This PR allows us to specify the desired listening address(es) of the node. For now, these addresses are just additions to the current randomly assigned listening address, as I'm not sure what to pick as the default; once we know this, the only change needed (besides the default listening addresses being put in the config) is to remove the following line from `p2p::create_swarm`:
```
// Listen on all interfaces and whatever port the OS assigns
Swarm::listen_on(&mut swarm, "/ip4/127.0.0.1/tcp/0".parse().unwrap()).unwrap();
```
Another question is how to handle a situation where one/all of the supplied addresses can't be listened on:
- refuse to start?
- assign a random different address?
- only log errors if at least one works?

This is currently unresolved, but since the PR preserves the current behavior, this is a concern that needs to be handled in the aforementioned later follow-up.

Cc #173.

Co-authored-by: ljedrz <ljedrz@gmail.com>
@koivunej koivunej mentioned this issue Sep 22, 2020
24 tasks
@koivunej koivunej linked a pull request Sep 22, 2020 that will close this issue
@bors bors bot closed this as completed in #383 Sep 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants