Skip to main content

tuwunel_core/config/
ip_source.rs

1use serde::Deserialize;
2
3/// Selects the source used to determine the connecting client's IP
4/// address. Variants correspond 1:1 to `axum_client_ip::SecureClientIpSource`.
5#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq)]
6#[serde(rename_all = "snake_case")]
7pub enum IpSource {
8	/// TCP peer address. Safe default; no proxy required.
9	#[default]
10	ConnectInfo,
11
12	/// Rightmost value of `X-Forwarded-For`.
13	RightmostXForwardedFor,
14
15	/// Rightmost value of RFC 7239 `Forwarded`.
16	RightmostForwarded,
17
18	/// `X-Real-IP` header (nginx).
19	XRealIp,
20
21	/// `CF-Connecting-IP` (Cloudflare / cloudflared).
22	CfConnectingIp,
23
24	/// `True-Client-IP` (Akamai, Cloudflare Enterprise).
25	TrueClientIp,
26
27	/// `Fly-Client-IP` (Fly.io).
28	FlyClientIp,
29
30	/// `CloudFront-Viewer-Address` (AWS CloudFront).
31	#[serde(rename = "cloudfront_viewer_address")]
32	CloudFrontViewerAddress,
33}