static JSString *retrieve_address(JSContext *cx, HandleObject self) {
  RootedString address(cx);
  char octets[16];

  size_t nwritten = 0;
  if (!HANDLE_RESULT(cx, xqd_req_downstream_client_ip_addr_get(octets, &nwritten)))
    return nullptr;

  switch (nwritten) {
  case 0: {
    // No address to be had, leave `address` as a nullptr.
    break;
  }
  case 4: {
    char address_chars[INET_ADDRSTRLEN];
    // TODO: do we need to do error handling here, or can we depend on the
    // host giving us a valid address?
    inet_ntop(AF_INET, octets, address_chars, INET_ADDRSTRLEN);
    address = JS_NewStringCopyZ(cx, address_chars);
    if (!address)
      return nullptr;

    break;
  }
  case 16: {
    char address_chars[INET6_ADDRSTRLEN];
    // TODO: do we need to do error handling here, or can we depend on the
    // host giving us a valid address?
    inet_ntop(AF_INET6, octets, address_chars, INET6_ADDRSTRLEN);
    address = JS_NewStringCopyZ(cx, address_chars);
    if (!address)
      return nullptr;

    break;
  }
  }

  JS::SetReservedSlot(self, Slots::Address, JS::StringValue(address));
  return address;
}
static JSString *retrieve_address(JSContext *cx, HandleObject self) {
  RootedString address(cx);
  char octets[16];

  size_t nwritten = 0;
  if (!HANDLE_RESULT(cx, xqd_req_downstream_client_ip_addr_get(octets, &nwritten)))
    return nullptr;

  switch (nwritten) {
  case 0: {
     
    break;
  }
  case 4: {
    char address_chars[INET_ADDRSTRLEN];
     
     
    inet_ntop(AF_INET, octets, address_chars, INET_ADDRSTRLEN);
    address = JS_NewStringCopyZ(cx, address_chars);
    if (!address)
      return nullptr;

    break;
  }
  case 16: {
    char address_chars[INET6_ADDRSTRLEN];
     
     
    inet_ntop(AF_INET6, octets, address_chars, INET6_ADDRSTRLEN);
    address = JS_NewStringCopyZ(cx, address_chars);
    if (!address)
      return nullptr;

    break;
  }
  }

  JS::SetReservedSlot(self, Slots::Address, JS::StringValue(address));
  return address;
}