proxyproto

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package proxyproto wraps listeners so accepted connections have their PROXY header consumed and RemoteAddr() reports the client the header names.

It lives in its own package because two callers need it and they cannot import each other: core/singbox (the front listener for inject/relay mode) and protocol/mieru (whose Mux accepts on a listener Sing2 supplies).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(raw net.Listener) net.Listener

Wrap returns a listener that strips PROXY headers.

The policy is USE, not REQUIRE: a connection without a header is still served with its own socket address. Turning a missing header into an outage is a worse failure than losing the client IP on that one connection — a load balancer missing `send-proxy` would otherwise take the whole node down.

Any sender is believed. A PROXY header is an unauthenticated claim, so whoever can reach this listener can claim any source address; keep the port reachable only from the load balancer.

Types

type Factory

type Factory struct{}

Factory is Wrap as a listener factory, for callers that do not create the socket themselves — mieru's Mux takes one of these (apis/common.StreamListenerFactory).

func (Factory) Listen

func (Factory) Listen(ctx context.Context, network, address string) (net.Listener, error)

Listen satisfies mieru's StreamListenerFactory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL