libp2p / libp2p/go-libp2p

Support Proxy Protocol

Open
#1,065 15 comments 0 reactions 1 assignee View on GitHub

@dhuseby is already working on this.

Since Aug 24, 2023.

Dominant language
Go
Stars
6.9k
Forks
1.3k
Avg merge
13d 21h
Merged PRs (30d)
1

Description

# Feature
Include [Proxy Protocol](https://www.haproxy.com/blog/haproxy/proxy-protocol/) to support the use of Load Balancers and Reverse Proxies.

## Background
The current behaviour of a libp2p node (e.g. lotus) behind a load balancer is to reflect a server's private IP or loopback interface as the source IP address of upstream peer connections established through a Load Balancer or Reverse Proxy.

This is a well known TCP load balancing issue, with a conventional but complex workaround to use Transparent Proxies. This requires kernel and iptables configuration, which creates a high barrier to success running libp2p nodes in this use case.

For Proxy Protocol to be fully supported, the downstream endpoint (libp2p node) should support Proxy Protocol 1 and 2 to establish the client's IP address (upstream libp2p peer).

## Current Behaviour
Behind an AWS Elastic Load Balancer:
```
$ lotus net peers
12D3KooWxxxxxxxxxxxxxxxxxxxxxxxxx, [/ip4/10.0.10.233/tcp/50202]
```

Behind a Reverse Proxy e.g. NGINX, HAPROXY:
```
$ lotus net peers
12D3KooWxxxxxxxxxxxxxxxxxxxxxxxxx, [/ip4/127.0.0.1/tcp/50202]
```

## Desired Behaviour
```
$ lotus net peers
12D3KooWxxxxxxxxxxxxxxxxxxxxxxxxx, [/ip4//tcp/]
```

## Current Pitfalls without Proxy Protocol support

- negative peer scores resulting from duplicate peer IPs (private IP reflection or loopback)
- restricted auditing capabilities

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.