Zheaoli commented on a change in pull request #4980:
URL: https://github.com/apache/apisix/pull/4980#discussion_r705895742
##########
File path: apisix/stream/router/ip_port.lua
##########
@@ -71,6 +76,18 @@ do
end
local route = item.value
+ if item.value.remote_addr then
+ local remote_matcher =
core_ip.create_ip_matcher({item.value.remote_addr})
+ if remote_matcher then
Review comment:
The check process in the check function just checks the address
validated if server_addr or remote_addr is existed.
But in some circumstances, both the remote_address and server_address are
not existed, but the configuration is validated. Here's the example in
https://github.com/apache/apisix/blob/master/docs/zh/latest/stream-proxy.md#%E6%8E%A5%E6%94%B6-tls-over-tcp
```bash
curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"sni": "a.test.com",
"upstream": {
"nodes": {
"127.0.0.1:5991": 1
},
"type": "roundrobin"
}
}'
```
So we can use the nil-check code here to avoid the useless matcher-created
processes.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]