/// Creates a `PeerConfigBuilder` from a [`PeerConfig`](PeerConfig).
///
/// This is mostly a convenience method for cases when you want to copy
/// some or most of the existing peer configuration to a new configuration.
///
/// This returns a `PeerConfigBuilder`, so you can still call any methods
/// you need to override the imported settings.


This returns a `PeerConfigBuilder`, so you can still call any methods
you need to override the imported settings.
This returns a ` PeerConfigBuilder ` so you can still call any methods you need to override the imported settings .
pub fn from_peer_config(config: PeerConfig) -> Self {
        let mut builder = Self::new(&config.public_key);
        if let Some(k) = config.preshared_key {
            builder = builder.set_preshared_key(k);
        }
        if let Some(e) = config.endpoint {
            builder = builder.set_endpoint(e);
        }
        if let Some(k) = config.persistent_keepalive_interval {
            builder = builder.set_persistent_keepalive_interval(k);
        }
        builder
            .replace_allowed_ips()
            .add_allowed_ips(&config.allowed_ips)
    }
pub fn from_peer_config ( config : PeerConfig ) -> Self { let mut builder = Self :: new ( & config . public_key ) ; if let Some ( k ) = config . preshared_key { builder = builder . set_preshared_key ( k ) ; } if let Some ( e ) = config . endpoint { builder = builder . set_endpoint ( e ) ; } if let Some ( k ) = config . persistent_keepalive_interval { builder = builder . set_persistent_keepalive_interval ( k ) ; } builder . replace_allowed_ips ( ) . add_allowed_ips ( & config . allowed_ips ) }
Creates a `PeerConfigBuilder` from a [`PeerConfig`](PeerConfig).
Creates a ` PeerConfigBuilder ` from a [ ` PeerConfig ` ] ( PeerConfig ) .
config
PeerConfig