File tree 1 file changed +24
-14
lines changed
1 file changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -144,32 +144,42 @@ function records_mt:__len()
144
144
return self .n
145
145
end
146
146
147
+ local record_ipv4_methods = {
148
+ family = cs .AF_INET ;
149
+ }
150
+ local record_ipv4_mt = {
151
+ __name = " http.client.record.ipv4" ;
152
+ __index = record_ipv4_methods ;
153
+ }
147
154
function records_methods :add_v4 (addr , port )
148
155
local n = self .n + 1
149
- self [n ] = {
150
- family = cs .AF_INET ;
151
- addr = addr ;
152
- port = port ;
153
- }
156
+ self [n ] = setmetatable ({ addr = addr , port = port }, record_ipv4_mt )
154
157
self .n = n
155
158
end
156
159
160
+ local record_ipv6_methods = {
161
+ family = cs .AF_INET6 ;
162
+ }
163
+ local record_ipv6_mt = {
164
+ __name = " http.client.record.ipv6" ;
165
+ __index = record_ipv6_methods ;
166
+ }
157
167
function records_methods :add_v6 (addr , port )
158
168
local n = self .n + 1
159
- self [n ] = {
160
- family = cs .AF_INET6 ;
161
- addr = addr ;
162
- port = port ;
163
- }
169
+ self [n ] = setmetatable ({ addr = addr , port = port }, record_ipv6_mt )
164
170
self .n = n
165
171
end
166
172
173
+ local record_unix_methods = {
174
+ family = cs .AF_UNIX ;
175
+ }
176
+ local record_unix_mt = {
177
+ __name = " http.client.record.unix" ;
178
+ __index = record_unix_methods ;
179
+ }
167
180
function records_methods :add_unix (path )
168
181
local n = self .n + 1
169
- self [n ] = {
170
- family = cs .AF_UNIX ;
171
- path = path ;
172
- }
182
+ self [n ] = setmetatable ({ path = path }, record_unix_mt )
173
183
self .n = n
174
184
end
175
185
You can’t perform that action at this time.
0 commit comments