@@ -541,6 +541,86 @@ impl TcpStream {
541
541
self . 0 . ttl ( )
542
542
}
543
543
544
+ /// Sets the value for the `IPV6_UNICAST_HOPS` option on this socket.
545
+ ///
546
+ /// This value sets the unicast hop limit field that is used in every packet
547
+ /// sent from this socket.
548
+ ///
549
+ /// # Examples
550
+ ///
551
+ /// ```no_run
552
+ /// #![feature(ipv6_hop_limit)]
553
+ /// use std::net::TcpStream;
554
+ ///
555
+ /// let stream = TcpStream::connect("127.0.0.1:54321")
556
+ /// .expect("Couldn't connect to the server...");
557
+ /// stream.set_hop_limit_v6(88).expect("set_hop_limit_v6 call failed");
558
+ /// ```
559
+ #[ unstable( feature = "ipv6_hop_limit" , issue = "47727" ) ]
560
+ pub fn set_hop_limit_v6 ( & self , limit : u32 ) -> io:: Result < ( ) > {
561
+ self . 0 . set_hop_limit_v6 ( limit)
562
+ }
563
+
564
+ /// Gets the value of the `IPV6_UNICAST_HOPS` option on this socket.
565
+ ///
566
+ /// For more information about this option, see [`TcpStream::set_hop_limit_v6`].
567
+ ///
568
+ /// # Examples
569
+ ///
570
+ /// ```no_run
571
+ /// #![feature(ipv6_hop_limit)]
572
+ /// use std::net::TcpStream;
573
+ ///
574
+ /// let stream = TcpStream::connect("127.0.0.1:54321")
575
+ /// .expect("Couldn't connect to the server...");
576
+ /// stream.set_hop_limit_v6(88).expect("set_hop_limit_v6 call failed");
577
+ /// assert_eq!(stream.hop_limit_v6().unwrap(), 88);
578
+ /// ```
579
+ #[ unstable( feature = "ipv6_hop_limit" , issue = "47727" ) ]
580
+ pub fn hop_limit_v6 ( & self ) -> io:: Result < u32 > {
581
+ self . 0 . hop_limit_v6 ( )
582
+ }
583
+
584
+ /// Sets the value for the `IPV6_MULTICAST_HOPS` option on this socket.
585
+ ///
586
+ /// This value sets the hop limit field for outgoing multicast packets
587
+ /// sent from this socket.
588
+ ///
589
+ /// # Examples
590
+ ///
591
+ /// ```no_run
592
+ /// #![feature(ipv6_hop_limit)]
593
+ /// use std::net::TcpStream;
594
+ ///
595
+ /// let stream = TcpStream::connect("127.0.0.1:54321")
596
+ /// .expect("Couldn't connect to the server...");
597
+ /// stream.set_multicast_hop_limit_v6(88).expect("set_multicast_hop_limit_v6 call failed");
598
+ /// ```
599
+ #[ unstable( feature = "ipv6_hop_limit" , issue = "47727" ) ]
600
+ pub fn set_multicast_hop_limit_v6 ( & self , limit : u32 ) -> io:: Result < ( ) > {
601
+ self . 0 . set_multicast_hop_limit_v6 ( limit)
602
+ }
603
+
604
+ /// Gets the value of the `IPV6_MULTICAST_HOPS` option on this socket.
605
+ ///
606
+ /// For more information about this option, see [`TcpStream::set_multicast_hop_limit_v6`].
607
+ ///
608
+ /// # Examples
609
+ ///
610
+ /// ```no_run
611
+ /// #![feature(ipv6_hop_limit)]
612
+ /// use std::net::TcpStream;
613
+ ///
614
+ /// let stream = TcpStream::connect("127.0.0.1:54321")
615
+ /// .expect("Couldn't connect to the server...");
616
+ /// stream.set_multicast_hop_limit_v6(88).expect("set_multicast_hop_limit_v6 call failed");
617
+ /// assert_eq!(stream.multicast_hop_limit_v6().unwrap(), 88);
618
+ /// ```
619
+ #[ unstable( feature = "ipv6_hop_limit" , issue = "47727" ) ]
620
+ pub fn multicast_hop_limit_v6 ( & self ) -> io:: Result < u32 > {
621
+ self . 0 . multicast_hop_limit_v6 ( )
622
+ }
623
+
544
624
/// Gets the value of the `SO_ERROR` option on this socket.
545
625
///
546
626
/// This will retrieve the stored error in the underlying socket, clearing
@@ -915,6 +995,82 @@ impl TcpListener {
915
995
self . 0 . ttl ( )
916
996
}
917
997
998
+ /// Sets the value for the `IPV6_UNICAST_HOPS` option on this socket.
999
+ ///
1000
+ /// This value sets the unicast hop limit field that is used in every packet
1001
+ /// sent from this socket.
1002
+ ///
1003
+ /// # Examples
1004
+ ///
1005
+ /// ```no_run
1006
+ /// #![feature(ipv6_hop_limit)]
1007
+ /// use std::net::TcpListener;
1008
+ ///
1009
+ /// let listener = TcpListener::bind("127.0.0.1:54321").unwrap();
1010
+ /// listener.set_hop_limit_v6(88).expect("set_hop_limit_v6 call failed");
1011
+ /// ```
1012
+ #[ unstable( feature = "ipv6_hop_limit" , issue = "47727" ) ]
1013
+ pub fn set_hop_limit_v6 ( & self , limit : u32 ) -> io:: Result < ( ) > {
1014
+ self . 0 . set_hop_limit_v6 ( limit)
1015
+ }
1016
+
1017
+ /// Gets the value of the `IPV6_UNICAST_HOPS` option on this socket.
1018
+ ///
1019
+ /// For more information about this option, see [`TcpListener::set_hop_limit_v6`].
1020
+ ///
1021
+ /// # Examples
1022
+ ///
1023
+ /// ```no_run
1024
+ /// #![feature(ipv6_hop_limit)]
1025
+ /// use std::net::TcpListener;
1026
+ ///
1027
+ /// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
1028
+ /// listener.set_hop_limit_v6(88).expect("set_hop_limit_v6 call failed");
1029
+ /// assert_eq!(listener.hop_limit_v6().unwrap(), 88);
1030
+ /// ```
1031
+ #[ unstable( feature = "ipv6_hop_limit" , issue = "47727" ) ]
1032
+ pub fn hop_limit_v6 ( & self ) -> io:: Result < u32 > {
1033
+ self . 0 . hop_limit_v6 ( )
1034
+ }
1035
+
1036
+ /// Sets the value for the `IPV6_MULTICAST_HOPS` option on this socket.
1037
+ ///
1038
+ /// This value sets the hop limit field for outgoing multicast packets
1039
+ /// sent from this socket.
1040
+ ///
1041
+ /// # Examples
1042
+ ///
1043
+ /// ```no_run
1044
+ /// #![feature(ipv6_hop_limit)]
1045
+ /// use std::net::TcpListener;
1046
+ ///
1047
+ /// let listener = TcpListener::bind("127.0.0.1:54321").unwrap();
1048
+ /// listener.set_multicast_hop_limit_v6(88).expect("set_multicast_hop_limit_v6 call failed");
1049
+ /// ```
1050
+ #[ unstable( feature = "ipv6_hop_limit" , issue = "47727" ) ]
1051
+ pub fn set_multicast_hop_limit_v6 ( & self , limit : u32 ) -> io:: Result < ( ) > {
1052
+ self . 0 . set_multicast_hop_limit_v6 ( limit)
1053
+ }
1054
+
1055
+ /// Gets the value of the `IPV6_MULTICAST_HOPS` option on this socket.
1056
+ ///
1057
+ /// For more information about this option, see [`TcpListener::set_multicast_hop_limit_v6`].
1058
+ ///
1059
+ /// # Examples
1060
+ ///
1061
+ /// ```no_run
1062
+ /// #![feature(ipv6_hop_limit)]
1063
+ /// use std::net::TcpListener;
1064
+ ///
1065
+ /// let listener = TcpListener::bind("127.0.0.1:54321").unwrap();
1066
+ /// listener.set_multicast_hop_limit_v6(88).expect("set_multicast_hop_limit_v6 call failed");
1067
+ /// assert_eq!(listener.multicast_hop_limit_v6().unwrap(), 88);
1068
+ /// ```
1069
+ #[ unstable( feature = "ipv6_hop_limit" , issue = "47727" ) ]
1070
+ pub fn multicast_hop_limit_v6 ( & self ) -> io:: Result < u32 > {
1071
+ self . 0 . multicast_hop_limit_v6 ( )
1072
+ }
1073
+
918
1074
#[ stable( feature = "net2_mutators" , since = "1.9.0" ) ]
919
1075
#[ deprecated( since = "1.16.0" , note = "this option can only be set before the socket is bound" ) ]
920
1076
#[ allow( missing_docs) ]
0 commit comments