Skip to main content

base_scheduler/
address_hints.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use crate::{SocketDomain, SocketProtocol, SocketType};
5
6/// Typed hints passed to the resolver. Defaults request either IP family, any socket type/protocol, and no flags.
7#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
8pub struct AddressHints {
9    /// Restrict results to one IP family; `None` accepts either.
10    pub domain: Option<SocketDomain>,
11    /// Restrict results to one socket type; `None` accepts any.
12    pub socket_type: Option<SocketType>,
13    /// Restrict results to one protocol; `None` accepts any.
14    pub protocol: Option<SocketProtocol>,
15    /// With no hostname, request wildcard addresses suitable for binding; otherwise this flag has no effect. Without this flag, an absent hostname selects loopback addresses.
16    pub passive: bool,
17    /// Require a numeric hostname, preventing hostname lookup. Literal syntax, including IPv6 scope identifiers, follows the backend.
18    pub numeric_host: bool,
19    /// Ask the resolver to return families configured on the local system (`AI_ADDRCONFIG`). This is opt-in; loopback addresses do not establish a configured family on native backends.
20    pub address_configured: bool,
21}