@@ -28,32 +28,32 @@ pub(crate) struct IpTransport {
2828pub enum Config {
2929 /// Default IPv4 binding
3030 V4Default {
31- /// TODO
31+ /// The IP address to bind on
3232 ip_addr : Ipv4Addr ,
3333 /// The port to bind on
3434 port : u16 ,
3535 } ,
3636 /// Default IPv6 binding
3737 V6Default {
38- /// TODO
38+ /// The IP address to bind on
3939 ip_addr : Ipv6Addr ,
4040 /// The scope_id
4141 scope_id : u32 ,
4242 /// The port to bind on
4343 port : u16 ,
4444 } ,
45- /// IPv4 binding
45+ /// General IPv4 binding
4646 V4 {
47- /// TODO
47+ /// The IP address to bind on
4848 ip_addr : Ipv4Net ,
4949 /// The port to bind on
5050 port : u16 ,
5151 } ,
52- /// IPv6 binding
52+ /// General IPv6 binding
5353 V6 {
54- /// TODO
54+ /// The IP address to bind on
5555 ip_addr : Ipv6Net ,
56- /// The scope id
56+ /// The scope id.
5757 scope_id : u32 ,
5858 /// The port to bind on
5959 port : u16 ,
@@ -76,8 +76,8 @@ impl Config {
7676 matches ! ( self , Self :: V4Default { .. } | Self :: V6Default { .. } )
7777 }
7878
79- /// TODO
80- pub fn is_valid_send_addr ( & self , dst : SocketAddr ) -> bool {
79+ /// Does this configuration match to send to the given `dst` address.
80+ pub ( crate ) fn is_valid_send_addr ( & self , dst : SocketAddr ) -> bool {
8181 match self {
8282 Self :: V4Default { .. } => matches ! ( dst, SocketAddr :: V4 ( _) ) ,
8383 Self :: V6Default { .. } => matches ! ( dst, SocketAddr :: V6 ( _) ) ,
@@ -274,13 +274,7 @@ pub(super) struct IpSender {
274274
275275impl IpSender {
276276 pub ( super ) fn is_valid_send_addr ( & self , dst : & SocketAddr ) -> bool {
277- // Our net-tools crate binds sockets to their specific family. This means an IPv6
278- // socket can not sent to IPv4, on any platform. So we need to convert an
279- // IPv4-mapped IPv6 address back to it's canonical IPv4 address.
280- let mut dst = * dst;
281- dst. set_ip ( dst. ip ( ) . to_canonical ( ) ) ;
282-
283- self . config . is_valid_send_addr ( dst)
277+ self . config . is_valid_send_addr ( * dst)
284278 }
285279
286280 /// Creates a canonical socket address.
0 commit comments