Skip to content

Geo lookup + client info (extract-once) #488

@aram356

Description

@aram356

Description

Implement PlatformGeo backed by Fastly SDK. Populate ClientInfo struct from the Fastly request at the entry point and store in RuntimeServices.

Extract-once pattern

ClientInfo is a plain data struct populated once at the entry point — not extracted per-call-site. This eliminates redundant extraction (currently get_client_ip_addr() is called 4+ times in the auction flow alone). Each adapter constructs ClientInfo from its platform request at dispatch time:

  • Fastly: req.get_client_ip_addr(), req.get_tls_protocol(), req.get_tls_cipher_openssl_name()
  • Cloudflare: CF-Connecting-IP header, cf object TLS fields
  • Axum: connection info, X-Forwarded-For header

Call sites to migrate

  • geo.rsreq.get_client_ip_addr() for geo lookup → services.client_info.client_ip
  • synthetic.rs:71req.get_client_ip_addr() for ID generation → services.client_info.client_ip
  • didomi.rs:106original_req.get_client_ip_addr() for X-Forwarded-For → services.client_info.client_ip
  • auction/formats.rs:134req.get_client_ip_addr() for DeviceInfo → services.client_info.client_ip
  • http_util.rs:134,140req.get_tls_protocol() / req.get_tls_cipher_openssl_name() for scheme detection → services.client_info.tls_protocol / services.client_info.tls_cipher

Done when

  • ClientInfo populated at entry point
  • Geo and client-info reads go through RuntimeServices
  • Per-PR gates pass

Blocked by

PR 2

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions