Mercurial > crates > systemd-socket
comparison README.md @ 4:66c0e10c89fc
Support resolving hostnames
Until now the crate supported only IP addresses and systemd sockets.
This was troublesome because it prevented the popular `localhost:1234`
format. This commit changes the behavior so that if parsing of
`std::net::SocketAddr` fails it attempts to parse it as `hostname:port`.
`bind_*()` methods were also modified to be async because of this.
author | Martin Habovstiak <martin.habovstiak@gmail.com> |
---|---|
date | Fri, 27 Nov 2020 15:05:19 +0100 |
parents | 0edcde404b02 |
children | a7893294e9b2 |
comparison
equal
deleted
inserted
replaced
3:0edcde404b02 | 4:66c0e10c89fc |
---|---|
11 | 11 |
12 The provided type supports conversions from various types of strings and also `serde` and `parse_arg` via feature flag. | 12 The provided type supports conversions from various types of strings and also `serde` and `parse_arg` via feature flag. |
13 Thanks to this the change to your code should be minimal - parsing will continue to work, it'll just allow a new format. | 13 Thanks to this the change to your code should be minimal - parsing will continue to work, it'll just allow a new format. |
14 You only need to change the code to use `SocketAddr::bind()` instead of `TcpListener::bind()` for binding. | 14 You only need to change the code to use `SocketAddr::bind()` instead of `TcpListener::bind()` for binding. |
15 | 15 |
16 Further, the crate also provides convenience methods for binding `tokio` 0.2, 0.3, and `async_std` sockets. | 16 Further, the crate also provides methods for binding `tokio` 0.2, 0.3, and `async_std` sockets if the appropriate features are |
17 activated. | |
17 | 18 |
18 ## Example | 19 ## Example |
19 | 20 |
20 ```rust | 21 ```rust |
21 use systemd_socket::SocketAddr; | 22 use systemd_socket::SocketAddr; |
40 | 41 |
41 ## Features | 42 ## Features |
42 | 43 |
43 * `serde` - implements `serde::Deserialize` for `SocketAddr` | 44 * `serde` - implements `serde::Deserialize` for `SocketAddr` |
44 * `parse_arg` - implements `parse_arg::ParseArg` for `SocketAddr` | 45 * `parse_arg` - implements `parse_arg::ParseArg` for `SocketAddr` |
45 * `tokio_0_2` - adds `bind_tokio_0_2` convenience method to `SocketAddr` | 46 * `tokio_0_2` - adds `bind_tokio_0_2` method to `SocketAddr` |
46 * `tokio_0_3` - adds `bind_tokio_0_3` convenience method to `SocketAddr` | 47 * `tokio_0_3` - adds `bind_tokio_0_3` method to `SocketAddr` |
47 * `async_std` - adds `bind_async_std` convenience method to `SocketAddr` | 48 * `async_std` - adds `bind_async_std` method to `SocketAddr` |
48 | 49 |
49 ## MSRV | 50 ## MSRV |
50 | 51 |
51 This crate must always compile with the latest Rust available in the latest Debian stable. | 52 This crate must always compile with the latest Rust available in the latest Debian stable. |
52 That is currently Rust 1.41.1. (Debian 10 - Buster) | 53 That is currently Rust 1.41.1. (Debian 10 - Buster) |