File tree Expand file tree Collapse file tree 1 file changed +24
-14
lines changed
Expand file tree Collapse file tree 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()
144144 return self .n
145145end
146146
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+ }
147154function records_methods :add_v4 (addr , port )
148155 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 )
154157 self .n = n
155158end
156159
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+ }
157167function records_methods :add_v6 (addr , port )
158168 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 )
164170 self .n = n
165171end
166172
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+ }
167180function records_methods :add_unix (path )
168181 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 )
173183 self .n = n
174184end
175185
You can’t perform that action at this time.
0 commit comments