Skip to main content

Crate use_udp

Crate use_udp 

Source
Expand description

§use-udp

use-udp provides small helpers for parsing UDP-style endpoints and looking up a few common UDP service ports.

Experimental: this crate is below 0.3.0 and the API may change.

§Example Usage

use use_udp::{default_udp_port, format_udp_endpoint, parse_udp_endpoint};

let endpoint = parse_udp_endpoint("localhost:53").unwrap();

assert_eq!(endpoint.port, 53);
assert_eq!(default_udp_port("dns"), Some(53));
assert_eq!(format_udp_endpoint(&endpoint), "localhost:53");

§Scope

  • Parsing and formatting UDP-style host-and-port endpoints.
  • Small common UDP service mappings.

§Non-goals

  • UDP sockets.
  • Datagram sending.
  • Datagram receiving.
  • Broadcast or multicast I/O.

§License

Licensed under MIT OR Apache-2.0.

Structs§

UdpEndpoint
Stores a normalized UDP endpoint.

Functions§

default_udp_port
Looks up a default UDP port for a common service name.
format_udp_endpoint
Formats a UDP endpoint with IPv6 bracket handling.
is_common_udp_port
Returns true when the port matches one of the known UDP services.
parse_udp_endpoint
Parses a UDP endpoint from a host-and-port string.
udp_service_name
Looks up a common UDP service name for a port.