Repository navigation
v0.4.1
Added
-
UDPEndpoint(sock, *, pktinfo=True, interfaces=())knows the interfaces it
serves:.interfacesis a tuple ofInterface, andadmits(datagram) -> boolis true when it is empty or the datagram arrived on one of them (a
datagram with no arrival interface is not admitted by a limited endpoint).
Receiving never filters, so a caller can count what it drops. An item that is
not anInterface, or has no index, is refused at construction. -
bind_listen(listen=None, default_ports=0, *, family=None, per_address=None, device_binding=True, allow_address_takeover=False, broadcast=False) -> Tuple[UDPEndpoint, ...]binds whatparse_listennames and returns an
endpoint for each socket, in order. An address is one exclusive socket; a
wildcard is one socket with packet info, or, withper_address=Trueor on a
host whose sockets report no packet info, one socket for each address of the
host (loopback and link-local included; an IPv6 link-local address is bound with
its zone); an interface binding is one wildcard socket whose endpoint serves
those adapters (.interfaces), bound to the device where the platform can
(device_binding=Falseto decline) and otherwise left toadmits. A device
bind the kernel refuses is repeated without it and logged once atWARNINGon
netimps._listen. An IPv6 socket is IPv6 only on every platform, so*and
::on one port are two sockets and no arrival is v4-mapped. A selector that
matches no adapter isNetimpsValueErrorbefore any socket is opened, and a
failure closes every socket the call opened. -
parse_listen(listen=None, default_ports=0, *, family=None) -> Tuple[ListenAddress, ...]
reads where a service listens: text ("*",":67","127.0.0.1:67",
"[::1]:69","eth1:67","aa-bb-cc-dd-ee-ff", several joined by commas), an
IPv4AddressorIPv6Address, anInterfaceorMACAddress, a
(host, ports)pair (a list from a configuration file too), or a sequence of
those. It does no I/O: no name is resolved and no interface is looked up.
Each address and port appears once, in the order first written. Text that is
no address names an interface, as a MAC or an adapter name, and limits a
wildcard socket to it.family=socket.AF_INET6makes the wildcard forms and an
interface binding IPv6's; the default takes the wildcard forms as IPv4's, as
bind("")does.ListenAddress(.address,.port,.interfaces) is the
result's item, and is itself an accepted binding, so parsing a result gives it
back.ListenLikeis the alias of what is accepted.
Changed
- The
cliextra needsduho0.7.3:duho>=0.7.3,<0.8, where it was
>=0.7.0,<0.8. Thenetimpscommand, its options and its output are the
same. Served as tools (NETIMPS_MCP=stdio), that duho also reads
NETIMPS_MCP_OUTPUT, where a tool's output that is not text would go; no
netimpscommand writes any, and a value that does not qualify ends the
server with status 2.
Fixed
- Windows:
recvmsgsetsMSG_TRUNConly when the payload was cut. A control
buffer too small for the packet information, on a socket whose option is on,
came back asMSG_TRUNC | MSG_CTRUNCwith the data whole, so
UDPEndpoint(sock, pktinfo=False).recv(...).truncatedwas true for a datagram
that fit. Each buffer now reports as its own flag, as on POSIX.
Full Changelog: v0.4.0...v0.4.1