pub struct FileBackendConfig {
pub address: String,
pub weight: Option<u8>,
pub sticky_id: Option<String>,
pub backup: Option<bool>,
pub backend_id: Option<String>,
pub unix_path: Option<String>,
}Expand description
A backend as written in the configuration file. address is either a
socket address ("127.0.0.1:8080", "[::1]:8080") or a host:port
("ingress:8080") that FileBackendConfig::resolve turns into one
BackendConfig per resolved address when the file is loaded
(sozu-proxy/sozu#347). Workers only ever receive socket addresses.
Fields§
§address: String§weight: Option<u8>§sticky_id: Option<String>§backup: Option<bool>§backend_id: Option<String>§unix_path: Option<String>Carried unchanged onto every backend this entry resolves to; see
BackendConfig::unix_path.
Implementations§
Source§impl FileBackendConfig
impl FileBackendConfig
Sourcepub fn resolve(
&self,
cluster_id: &str,
index: usize,
resolver: &BackendResolver<'_>,
) -> Result<Vec<BackendConfig>, ConfigError>
pub fn resolve( &self, cluster_id: &str, index: usize, resolver: &BackendResolver<'_>, ) -> Result<Vec<BackendConfig>, ConfigError>
Resolves this entry into backends, once, through resolver
(system_resolver outside tests).
A socket-address literal never reaches the resolver and keeps its
configured backend_id, or the positional default id
<cluster_id>-<index>-<address>, where index is the entry’s position
in the file’s backends list, so it does not move when a name before
it resolves to more or fewer addresses. A host:port
yields one backend per distinct resolved address, sorted so the
result does not depend on the resolver’s answer order, each with a
deterministic id: <backend_id>-<address> when backend_id is set,
<cluster_id>-<host:port>-<address> otherwise. When the name
resolves, a configured sticky_id is suffixed with -<address> too,
so it stays unique in the cluster and does not change when the answer
grows or shrinks.
A host made only of dot-separated decimal, octal or 0x hexadecimal
components that is not a valid IP literal (010.0.0.1, 1.2.3,
0x7f.1) is refused before the resolver: getaddrinfo reads such
strings as legacy inet_aton shorthand (8.0.0.1, 1.2.0.3,
127.0.0.1), which the socket-address parser always rejected. An
unbracketed IPv6 literal (::1:8080) is refused the same way:
getaddrinfo would split it on the last colon.
Trait Implementations§
Source§impl Clone for FileBackendConfig
impl Clone for FileBackendConfig
Source§impl Debug for FileBackendConfig
impl Debug for FileBackendConfig
Source§impl<'de> Deserialize<'de> for FileBackendConfig
impl<'de> Deserialize<'de> for FileBackendConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for FileBackendConfig
Source§impl Hash for FileBackendConfig
impl Hash for FileBackendConfig
Source§impl PartialEq for FileBackendConfig
impl PartialEq for FileBackendConfig
Source§impl Serialize for FileBackendConfig
impl Serialize for FileBackendConfig
impl StructuralPartialEq for FileBackendConfig
Auto Trait Implementations§
impl Freeze for FileBackendConfig
impl RefUnwindSafe for FileBackendConfig
impl Send for FileBackendConfig
impl Sync for FileBackendConfig
impl Unpin for FileBackendConfig
impl UnsafeUnpin for FileBackendConfig
impl UnwindSafe for FileBackendConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.