@@ -642,32 +642,73 @@ Interface objects
642642
643643.. class :: IPv4Interface(address)
644644
645- Construct an IPv4 interface. *address * is a string or integer representing
646- the IP interface. An :exc: ` AddressValueError ` is raised if * address * is not
647- a valid IPv4 address .
645+ Construct an IPv4 interface. The meaning of *address * is as in the
646+ constructor of :class: ` IPv4Network `, except that arbitrary host addresses
647+ are always accepted .
648648
649- The network address for the interface is determined by calling
650- ``IPv4Network(address, strict=False) ``.
649+ :class: `IPv4Interface ` is a subclass of :class: `IPv4Address `, so it inherits
650+ all the attributes from that class. In addition, the following attributes
651+ are available:
651652
652- >>> ipaddress.IPv4Interface(' 192.168.0.0/24' )
653- IPv4Interface('192.168.0.0/24')
654- >>> ipaddress.IPv4Interface(' 192.168.0.0/24' ).network
655- IPv4Network('192.168.0.0/24')
653+ .. attribute :: ip
654+
655+ The address (:class: `IPv4Address `) without network information.
656+
657+ >>> interface = IPv4Interface(' 192.0.2.5/24' )
658+ >>> interface.ip
659+ IPv4Address('192.0.2.5')
660+
661+ .. attribute :: network
662+
663+ The network (:class: `IPv4Network `) this interface belongs to.
664+
665+ >>> interface = IPv4Interface(' 192.0.2.5/24' )
666+ >>> interface.network
667+ IPv4Network('192.0.2.0/24')
668+
669+ .. attribute :: with_prefixlen
670+
671+ A string representation of the interface with the mask in prefix notation.
672+
673+ >>> interface = IPv4Interface(' 192.0.2.5/24' )
674+ >>> interface.with_prefixlen
675+ '192.0.2.5/24'
676+
677+ .. attribute :: with_netmask
678+
679+ A string representation of the interface with the network as a net mask.
680+
681+ >>> interface = IPv4Interface(' 192.0.2.5/24' )
682+ >>> interface.with_netmask
683+ '192.0.2.5/255.255.255.0'
684+
685+ .. attribute :: with_hostmask
686+
687+ A string representation of the interface with the network as a host mask.
688+
689+ >>> interface = IPv4Interface(' 192.0.2.5/24' )
690+ >>> interface.with_hostmask
691+ '192.0.2.5/0.0.0.255'
656692
657693
658694.. class :: IPv6Interface(address)
659695
660- Construct an IPv6 interface. *address * is a string or integer representing
661- the IP interface. An :exc: ` AddressValueError ` is raised if * address * is not
662- a valid IPv6 address .
696+ Construct an IPv6 interface. The meaning of *address * is as in the
697+ constructor of :class: ` IPv6Network `, except that arbitrary host addresses
698+ are always accepted .
663699
664- The network address for the interface is determined by calling
665- ``IPv6Network(address, strict=False) ``.
700+ :class: `IPv6Interface ` is a subclass of :class: `IPv6Address `, so it inherits
701+ all the attributes from that class. In addition, the following attributes
702+ are available:
666703
667- >>> ipaddress.IPv6Interface(' 2001:db8::1000/96' )
668- IPv6Interface('2001:db8::1000/96')
669- >>> ipaddress.IPv6Interface(' 2001:db8::1000/96' ).network
670- IPv6Network('2001:db8::/96')
704+ .. attribute :: ip
705+ .. attribute :: network
706+ .. attribute :: with_prefixlen
707+ .. attribute :: with_netmask
708+ .. attribute :: with_hostmask
709+
710+ Refer to the corresponding attribute documentation in
711+ :class: `IPv4Interface `.
671712
672713
673714Other Module Level Functions
0 commit comments