lighthouse-pulse/beacon_node
Mac L 41b5af9b16 Support IPv6 in BN and VC HTTP APIs (#3104)
## Issue Addressed

#3103

## Proposed Changes

Parse `http-address` and `metrics-address` as `IpAddr` for both the beacon node and validator client to support IPv6 addresses.
Also adjusts parsing of CORS origins to allow for IPv6 addresses.

## Usage
You can now set  `http-address` and/or `metrics-address`  flags to IPv6 addresses.
For example, the following:
`lighthouse bn --http --http-address :: --metrics --metrics-address ::1`
will expose the beacon node HTTP server on `[::]` (equivalent of `0.0.0.0` in IPv4) and the metrics HTTP server on `localhost` (the equivalent of `127.0.0.1` in IPv4) 

The beacon node API can then be accessed by:
`curl "http://[server-ipv6-address]:5052/eth/v1/some_endpoint"`

And the metrics server api can be accessed by:
`curl "http://localhost:5054/metrics"` or by `curl "http://[::1]:5054/metrics"`

## Additional Info
On most Linux distributions the `v6only` flag is set to `false` by default (see the section for the `IPV6_V6ONLY` flag in https://www.man7.org/linux/man-pages/man7/ipv6.7.html) which means IPv4 connections will continue to function on a IPv6 address (providing it is appropriately mapped). This means that even if the Lighthouse API is running on `::` it is also possible to accept IPv4 connections.

However on Windows, this is not the case. The `v6only` flag is set to `true` so binding to `::` will only allow IPv6 connections.
2022-03-24 00:04:49 +00:00
..
beacon_chain Add Proposer Cache Pruning & POS Activated Banner (#3109) 2022-03-22 21:33:38 +00:00
client Add Proposer Cache Pruning & POS Activated Banner (#3109) 2022-03-22 21:33:38 +00:00
eth1 Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
execution_layer Add Proposer Cache Pruning & POS Activated Banner (#3109) 2022-03-22 21:33:38 +00:00
genesis Updates to tests and local testnet for Ganache 7 (#3056) 2022-03-20 22:48:14 +00:00
http_api Support IPv6 in BN and VC HTTP APIs (#3104) 2022-03-24 00:04:49 +00:00
http_metrics Support IPv6 in BN and VC HTTP APIs (#3104) 2022-03-24 00:04:49 +00:00
lighthouse_network cargo audit updates (#3063) 2022-03-08 19:48:12 +00:00
network Remove sync await points (#3036) 2022-03-23 01:09:39 +00:00
operation_pool Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
src Support IPv6 in BN and VC HTTP APIs (#3104) 2022-03-24 00:04:49 +00:00
store Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
tests Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
timer Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
Cargo.toml v2.1.5 (#3096) 2022-03-17 23:13:46 +00:00