@@ -173,18 +173,18 @@ func DialUDP(net string, laddr, raddr *UDPAddr) (*UDPConn, error) {
173
173
switch net {
174
174
case "udp" , "udp4" , "udp6" :
175
175
default :
176
- return nil , UnknownNetworkError (net )
176
+ return nil , & OpError { Op : "dial" , Net : net , Addr : raddr , Err : UnknownNetworkError (net )}
177
177
}
178
178
if raddr == nil {
179
- return nil , & OpError {"dial" , net , nil , errMissingAddress }
179
+ return nil , & OpError {Op : "dial" , Net : net , Addr : nil , Err : errMissingAddress }
180
180
}
181
181
return dialUDP (net , laddr , raddr , noDeadline )
182
182
}
183
183
184
184
func dialUDP (net string , laddr , raddr * UDPAddr , deadline time.Time ) (* UDPConn , error ) {
185
185
fd , err := internetSocket (net , laddr , raddr , deadline , syscall .SOCK_DGRAM , 0 , "dial" , sockaddrToUDP )
186
186
if err != nil {
187
- return nil , err
187
+ return nil , & OpError { Op : "dial" , Net : net , Addr : raddr , Err : err }
188
188
}
189
189
return newUDPConn (fd ), nil
190
190
}
@@ -200,14 +200,14 @@ func ListenUDP(net string, laddr *UDPAddr) (*UDPConn, error) {
200
200
switch net {
201
201
case "udp" , "udp4" , "udp6" :
202
202
default :
203
- return nil , UnknownNetworkError (net )
203
+ return nil , & OpError { Op : "listen" , Net : net , Addr : laddr , Err : UnknownNetworkError (net )}
204
204
}
205
205
if laddr == nil {
206
206
laddr = & UDPAddr {}
207
207
}
208
208
fd , err := internetSocket (net , laddr , nil , noDeadline , syscall .SOCK_DGRAM , 0 , "listen" , sockaddrToUDP )
209
209
if err != nil {
210
- return nil , err
210
+ return nil , & OpError { Op : "listen" , Net : net , Addr : laddr , Err : err }
211
211
}
212
212
return newUDPConn (fd ), nil
213
213
}
@@ -220,25 +220,25 @@ func ListenMulticastUDP(net string, ifi *Interface, gaddr *UDPAddr) (*UDPConn, e
220
220
switch net {
221
221
case "udp" , "udp4" , "udp6" :
222
222
default :
223
- return nil , UnknownNetworkError (net )
223
+ return nil , & OpError { Op : "listen" , Net : net , Addr : gaddr , Err : UnknownNetworkError (net )}
224
224
}
225
225
if gaddr == nil || gaddr .IP == nil {
226
- return nil , & OpError {"listen" , net , nil , errMissingAddress }
226
+ return nil , & OpError {Op : "listen" , Net : net , Addr : nil , Err : errMissingAddress }
227
227
}
228
228
fd , err := internetSocket (net , gaddr , nil , noDeadline , syscall .SOCK_DGRAM , 0 , "listen" , sockaddrToUDP )
229
229
if err != nil {
230
- return nil , err
230
+ return nil , & OpError { Op : "listen" , Net : net , Addr : gaddr , Err : err }
231
231
}
232
232
c := newUDPConn (fd )
233
233
if ip4 := gaddr .IP .To4 (); ip4 != nil {
234
234
if err := listenIPv4MulticastUDP (c , ifi , ip4 ); err != nil {
235
235
c .Close ()
236
- return nil , & OpError {"listen" , net , & IPAddr {IP : ip4 }, err }
236
+ return nil , & OpError {Op : "listen" , Net : net , Addr : & IPAddr {IP : ip4 }, Err : err }
237
237
}
238
238
} else {
239
239
if err := listenIPv6MulticastUDP (c , ifi , gaddr .IP ); err != nil {
240
240
c .Close ()
241
- return nil , & OpError {"listen" , net , & IPAddr {IP : gaddr .IP }, err }
241
+ return nil , & OpError {Op : "listen" , Net : net , Addr : & IPAddr {IP : gaddr .IP }, Err : err }
242
242
}
243
243
}
244
244
return c , nil
0 commit comments