这是我的http类,我想问是不是需要自己去实现 通过域名获取ip的操作呢,还是因为我的操作不正确?
local HttpClient = {}
local http = require "resty.http"
function HttpClient:new()
return setmetatable({}, {
__index = self
})
end
function HttpClient:connect(timeout, host, port)
self.client = http.new()
self.client:set_timeout(timeout);
local ok, err = self.client:connect(host, port)
if not ok then
return false, err
end
return true
end
return HttpClient