Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

a lightweight library that helps aged programs deal with proxy-protocol

License

NotificationsYou must be signed in to change notification settings

ba0f3/proxyproto.nim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

proxyproto is a lightweight library that helps aged programs deal with proxy-protocol. It supports both IPv4 and IPv6.

Works on Linux and macOS

Why?

There are many aged programs that dont support proxy-protocol (esp. closed source programs).When they are running behind a load-balancer or reserve proxy, it's hard to preserve source IP address.

How PROXYPROTO works?

proxyproto intercep theaccept() proc, and waits for new imcoming connection and listens for proxy-protocol header from upstream proxy (ie HAProxy, NGINX..)

Once header read, proxyproto replace source ip w/ ip provided by upstream proxy.

Installation

git clone --depth=1 https://github.com/ba0f3/proxyproto.nim.git proxyprotocd proxyprotonim c -d:release src/proxyproto

Usage

Use directly inside a nim program that accept incoming connections

import proxyproto

For existing programs, use LD_PRELOAD

$LD_PRELOAD=./src/libproxyproto.so nc -vkl -p 4444[PROXY] initializing[PROXY] hook accept OKlistening on [any] 4444 ...

Donate

Buy me some beerhttps://paypal.me/ba0f3


[8]ページ先頭

©2009-2025 Movatter.jp