You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "kayx23 (via GitHub)" <gi...@apache.org> on 2023/04/27 07:22:01 UTC

[GitHub] [apisix] kayx23 opened a new issue, #9378: docs: Stream Route's `remote_addr` and `server_addr` should support IPv6 as well

kayx23 opened a new issue, #9378:
URL: https://github.com/apache/apisix/issues/9378

   ### Current State
   
   In [Admin API reference, Stream Route](https://apisix.apache.org/docs/apisix/admin-api/#stream-route), `remote_addr` and `server_addr` should support both IPv4 and IPv6. Currently only the IPv4 usage is documented and **tested**  
   
   Tests for stream route can be found at `t/admin/stream-routes.t` and `t/admin/stream-routes-disable.t`
   
   ### Desired State
   
   `remote_addr` and `server_addr` seem to support IPv6 as well. 
   
   In `apisix/stream/router/ip_port.lua`:
   ```
   if item.value.remote_addr then
       item.value.remote_addr_matcher = core_ip.create_ip_matcher({item.value.remote_addr})
   end
   if item.value.server_addr then
       item.value.server_addr_matcher = core_ip.create_ip_matcher({item.value.server_addr})
   end
   ```
   where `core_ip` is `local core_ip  = require("apisix.core.ip")`
   
   In `apisix/core/ip`:
   ```
   local ipmatcher = require("resty.ipmatcher")
   ...
   
   function _M.create_ip_matcher(ip_list)
       local ip, err = ipmatcher.new(ip_list)
       if not ip then
           log.error("failed to create ip matcher: ", err,
                     " ip list: ", json.delay_encode(ip_list))
           return nil
       end
   
       return ip
   end
   ```
   where `ipmatcher` can be sourced back to [lua-resty-ipmatcher](https://github.com/api7/lua-resty-ipmatcher)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 closed issue #9378: docs: Stream Route's `remote_addr` and `server_addr` should support IPv6 as well

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 closed issue #9378: docs: Stream Route's `remote_addr` and `server_addr` should support IPv6 as well
URL: https://github.com/apache/apisix/issues/9378


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] shreemaan-abhishek commented on issue #9378: docs: Stream Route's `remote_addr` and `server_addr` should support IPv6 as well

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #9378:
URL: https://github.com/apache/apisix/issues/9378#issuecomment-1525723474

   my ticket! ;)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org