Pass ##EXTERNAL_IP## to the client to replace
This commit is contained in:
parent
1be6b4318e
commit
455e87c168
12
src/lib.rs
12
src/lib.rs
@ -65,13 +65,13 @@ pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> Result<Respo
|
||||
return match kv.get("base_pjsip").cache_ttl(300).text().await? {
|
||||
Some(base) => {
|
||||
let mut conf = base + "";
|
||||
let remote_ip =
|
||||
match _req.headers().get("CF-Connecting-IP").unwrap_or_default() {
|
||||
Some(ip) => ip,
|
||||
None => return Response::error("Could not find remote IP", 500),
|
||||
};
|
||||
// let remote_ip =
|
||||
// match _req.headers().get("CF-Connecting-IP").unwrap_or_default() {
|
||||
// Some(ip) => ip,
|
||||
// None => return Response::error("Could not find remote IP", 500),
|
||||
// };
|
||||
|
||||
conf = conf.replace("##EXTERNAL_IP##", &remote_ip) + "\n";
|
||||
// conf = conf.replace("##EXTERNAL_IP##", &remote_ip) + "\n";
|
||||
|
||||
match kv.get("users").cache_ttl(300).text().await? {
|
||||
Some(users) => {
|
||||
|
Loading…
Reference in New Issue
Block a user