feat: pass x-forwarded-for
This commit is contained in:
parent
aaad974d8f
commit
c47432e58f
@ -14,6 +14,8 @@ struct Event {
|
||||
pub referrer: Option<String>,
|
||||
#[serde(skip_serializing)]
|
||||
pub user_agent: Option<String>,
|
||||
#[serde(skip_serializing)]
|
||||
pub xff: Option<String>,
|
||||
}
|
||||
|
||||
pub struct PlausibleAnalytics {
|
||||
@ -39,6 +41,13 @@ impl PlausibleAnalytics {
|
||||
None => "",
|
||||
},
|
||||
)
|
||||
.set(
|
||||
"x-forwarded-for",
|
||||
match &msg.xff {
|
||||
Some(s) => s,
|
||||
None => "",
|
||||
},
|
||||
)
|
||||
.send_json(&msg)
|
||||
{
|
||||
Ok(v) => info!("Sent {:?}", msg),
|
||||
@ -68,6 +77,10 @@ impl Analytics for PlausibleAnalytics {
|
||||
Some(s) => Some(s.to_string()),
|
||||
None => None,
|
||||
},
|
||||
xff: match req.headers().get_one("X-Forwarded-For") {
|
||||
Some(s) => Some(s.to_string()),
|
||||
None => None,
|
||||
}
|
||||
})?)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user