Enum netidx::publisher::BindCfg[][src]

pub enum BindCfg {
    Match {
        addr: IpAddr,
        netmask: IpAddr,
    },
    Exact(SocketAddr),
}

Control how the publisher picks a bind address. The address we give to the resolver server must be uniquely routable back to us, otherwise clients will not be able to subscribe. In the furtherance of this goal there are a number of address rules to follow,

  • no unspecified (0.0.0.0)
  • no broadcast (255.255.255.255)
  • no multicast addresses (224.0.0.0/8)
  • no link local addresses (169.254.0.0/16)
  • loopback (127.0.0.1, or ::1) is only allowed if all the resolvers are also loopback
  • private addresses (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12) are only allowed if all the resolvers are also using private addresses.

As well as the above rules we will enumerate all the network interface addresses present at startup time and check that the specified bind address (or specification in case of Addr) matches exactly 1 of them.

Variants

Match

Bind to the interface who’s address matches addr when masked with netmask, e.g.

192.168.0.0/16

will match interfaces with addresses 192.168.1.1, 192.168.10.234, … etc,

192.168.0.0/24

will match interfaces with addresses 192.168.0.[1-254]

Examples

use netidx::publisher::BindCfg;
"ffff:1c00:2700:3c00::/64".parse::<BindCfg>().unwrap();
"127.0.0.1/32".parse::<BindCfg>().unwrap();
"192.168.2.0/24".parse::<BindCfg>().unwrap();

Fields of Match

addr: IpAddrnetmask: IpAddr
Exact(SocketAddr)

Bind to the specifed SocketAddr, error if it is in use. If you want to OS to pick a port for you, use Exact with port 0. The ip address you specify must obey all the rules, and must be the ip address of one of the network interfaces present on the machine at the time of publisher creation.

Examples

use netidx::publisher::BindCfg;
"[ffff:1c00:2700:3c00::]:1234".parse::<BindCfg>().unwrap();
"192.168.0.1:1234".parse::<BindCfg>().unwrap();

Trait Implementations

impl Clone for BindCfg[src]

impl Copy for BindCfg[src]

impl Debug for BindCfg[src]

impl Eq for BindCfg[src]

impl FromStr for BindCfg[src]

type Err = Error

The associated error which can be returned from parsing.

impl PartialEq<BindCfg> for BindCfg[src]

impl StructuralEq for BindCfg[src]

impl StructuralPartialEq for BindCfg[src]

Auto Trait Implementations

impl RefUnwindSafe for BindCfg

impl Send for BindCfg

impl Sync for BindCfg

impl Unpin for BindCfg

impl UnwindSafe for BindCfg

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,