@@ -201,51 +201,41 @@ impl AddressPair {
201201
202202 #[ cfg( feature = "feat-uni-addr" ) ]
203203 /// Returns the source address.
204- pub fn src_uni_addr ( & self ) -> io:: Result < Option < uni_addr:: SocketAddr > > {
204+ pub fn src_uni_addr ( & self ) -> io:: Result < Option < uni_addr:: UniAddr > > {
205205 use core:: net:: { SocketAddr , SocketAddrV4 , SocketAddrV6 } ;
206206
207207 match self {
208208 Self :: Unspecified => Ok ( None ) ,
209- Self :: Inet { src_ip, src_port, .. } => Ok ( Some ( uni_addr:: SocketAddr :: Inet ( SocketAddr :: V4 (
209+ Self :: Inet { src_ip, src_port, .. } => Ok ( Some ( uni_addr:: UniAddr :: from ( SocketAddr :: V4 (
210210 SocketAddrV4 :: new ( * src_ip, * src_port) ,
211211 ) ) ) ) ,
212- Self :: Inet6 { src_ip, src_port, .. } => Ok ( Some ( uni_addr:: SocketAddr :: Inet ( SocketAddr :: V6 (
212+ Self :: Inet6 { src_ip, src_port, .. } => Ok ( Some ( uni_addr:: UniAddr :: from ( SocketAddr :: V6 (
213213 SocketAddrV6 :: new ( * src_ip, * src_port, 0 , 0 ) ,
214214 ) ) ) ) ,
215215 #[ cfg( unix) ]
216216 Self :: Unix { src_addr, .. } => uni_addr:: unix:: SocketAddr :: from_bytes_until_nul ( src_addr)
217- . map ( uni_addr :: SocketAddr :: Unix )
217+ . map ( Into :: into )
218218 . map ( Some ) ,
219- #[ cfg( not( unix) ) ]
220- Self :: Unix { .. } => Err ( io:: Error :: new (
221- io:: ErrorKind :: Unsupported ,
222- "Unix socket addresses are not supported on this platform" ,
223- ) ) ,
224219 }
225220 }
226221
227222 #[ cfg( feature = "feat-uni-addr" ) ]
228223 /// Returns the destination address.
229- pub fn dst_uni_addr ( & self ) -> io:: Result < Option < uni_addr:: SocketAddr > > {
224+ pub fn dst_uni_addr ( & self ) -> io:: Result < Option < uni_addr:: UniAddr > > {
230225 use core:: net:: { SocketAddr , SocketAddrV4 , SocketAddrV6 } ;
231226
232227 match self {
233228 Self :: Unspecified => Ok ( None ) ,
234- Self :: Inet { dst_ip, dst_port, .. } => Ok ( Some ( uni_addr:: SocketAddr :: Inet ( SocketAddr :: V4 (
229+ Self :: Inet { dst_ip, dst_port, .. } => Ok ( Some ( uni_addr:: UniAddr :: from ( SocketAddr :: V4 (
235230 SocketAddrV4 :: new ( * dst_ip, * dst_port) ,
236231 ) ) ) ) ,
237- Self :: Inet6 { dst_ip, dst_port, .. } => Ok ( Some ( uni_addr:: SocketAddr :: Inet ( SocketAddr :: V6 (
232+ Self :: Inet6 { dst_ip, dst_port, .. } => Ok ( Some ( uni_addr:: UniAddr :: from ( SocketAddr :: V6 (
238233 SocketAddrV6 :: new ( * dst_ip, * dst_port, 0 , 0 ) ,
239234 ) ) ) ) ,
240235 #[ cfg( unix) ]
241236 Self :: Unix { dst_addr, .. } => uni_addr:: unix:: SocketAddr :: from_bytes_until_nul ( dst_addr)
242- . map ( uni_addr :: SocketAddr :: Unix )
237+ . map ( Into :: into )
243238 . map ( Some ) ,
244- #[ cfg( not( unix) ) ]
245- Self :: Unix { .. } => Err ( io:: Error :: new (
246- io:: ErrorKind :: Unsupported ,
247- "Unix socket addresses are not supported on this platform" ,
248- ) ) ,
249239 }
250240 }
251241}
@@ -411,7 +401,7 @@ impl<'a> ExtensionRef<'a> {
411401 let Ok ( len) = reader. read_u16 ( ) else {
412402 return Err ( DecodeError :: MalformedData ) ;
413403 } ;
414- let Ok ( payload) = reader. take ( len as usize ) else {
404+ let Ok ( payload) = reader. read ( len as usize ) else {
415405 return Err ( DecodeError :: MalformedData ) ;
416406 } ;
417407
0 commit comments