Fixing Commenter's IP records – Varnish

Does anyone have any suggestions on writing a WordPress / jQuery plugin to submit the current user’s IP address as a variable in the comment form [post] submission? I understand the security risks of using js to get a user’s IP. The ip is not being used for security purposes, but as a bayesian token in the spam calc.

Because WordPress in currently running behind Varnish, commenters’ IP addresses are always recorded as localhost, or rather as the loopback [if] of

This means that we’re losing a significant variable in the spam / ham calc. It is not necessary, but it would help accuracy.

I seem to recall a few folks on here run their installs behind Varnish / Squid for obvious reasons. Any thoughts?