Assume I'm a web server and one of the requests I want to respond to
is "What is my public IP address?"  More specifically, if the server
receives an HTTP request to, let's say, the ".../get-ip" endpoint then
it should send back an HTTP response containing the sender's public
IP.  cf https://www.ipchicken.com/ for a real example.

This information is available in the IP connection data
(https://en.wikipedia.org/wiki/IPv4#Source_address) but I'm not sure
how to get access to that from within the web-server/* packages.  I've
been wikiwalking through the docs and am coming up empty.

I'm starting a pretty vanilla server like so:

(define-values (dispatch-request url-for)
  (dispatch-rules
...stuff...
))

  (serve/servlet dispatch-request
                 #:launch-browser? #f
                 #:servlet-regexp #px""
                 #:listen-ip #f
                 #:port (port-num)
                 #:log-file log-path
                 )

I recognize that the Source Address in the packet can and probably
will be changed when it runs through a NAT layer, but that's
acceptable in my use case.

Any pointers?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to