jamwt/diesel — pull request #26 by dowski (2012-01-09 16:01:56+00:00)
Title: UDP enhancements, DNS protocol and native resolver

I started poking around timdoug's UDP support in the evenings last week and refactored and expanded it over the weekend.

Big changes:

* Added `UDPSocket` which is a UDP equivalent of `Connection`.
* Removed the `UDPLoop` and `sendto` callable. Calling `send` in a `Loop` with a `UDPSocket` calls `sendto` for you.
* Added a `datagram` sentinel that is used in `Loop`s with a `UDPSocket` (`data = receive(datagram)`).
* `UDPService` now has a `UDPSocket`.
* The callable passed to `UDPService` takes no arguments (previously it took one - the UDP datagram).
* The `UDPService` callable should loop continually, `receive(datagram)`s and process them as it sees fit.
* Added a UDPClient that has an API that matches the standard Client.
* Added `dnspython` as a dependency.
* Added a `diesel.protocols.DNS` library (uses `dnspython` for protocol heavy-lifting).
* Switched to a native resolver in `diesel.resolver` (it runs `examples/resolve_names.py` twice as fast).

See `examples/udp_echo.py` to see the `UDPService` and `UDPClient` APIs in action.