How can service worker get the remote ip address of a request?

How can service worker get the remote ip address of a request?

Check this answer.
You have many services you can call and get your IP as response.
One example:
$.get("http://ipinfo.io", function(response) {
console.log(response.ip);
}, "jsonp");