ethereum / ethereum/ddht

Sane method to manage IP address included in local ENR

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
19
Forks
15
PR merge metrics
No merged PRs in 30d

Description

## What was wrong?

1. Local ENR does not get generated with an IP address
2. Need way to determine IP address to be included in ENR
3. Need way to update ENR with IP address while the service is running based on learning new information such as:
- UPnP #7
- Address reported to us by peers in ping messages

## How can it be fixed?

I *think* we should do roughly this:

- on app initialization:
1. If an explicit `--listen-address` was provided: prefer that one
2. If the ENR we have on-record in our database contains an IP address, use this value (assume whatever value we previously were using is correct)
3. If UPnP is enabled use the *external* ip address reported by that service.
- Care should be taken here to not flip/flop between a local ip address and the external one each time we start the application.
4. Maybe use the `inetfaces` library to dig up a local IP address if all else fails
- while running
1. `Pong` messages: https://github.com/ethereum/ddht/issues/9
2. UPnP service can discover external address

Care should be taken to ensure that we don't flip-flop back and forth between two different IP address in the event that UPnP and `PONG` approach continually return different values.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.