setup_port_mappings

Function setup_port_mappings 

Source
pub fn setup_port_mappings(
    actual_endpoint: &Url,
    settings: Arc<RwLock<Settings>>,
    ex: ExecutorPtr,
) -> Vec<Arc<dyn PortMapping>>
Expand description

Initialize port mappings from URL query parameters.

This function parses the endpoint URL for port mapping configuration, creates the appropriate port mapping instances, and starts them. Each port mapping runs its own persistent task for lease renewal and external address updates.

§Examples

// Enable UPnP with defaults
?upnp_igd=true

// UPnP with custom settings
?upnp_igd=true&upnp_igd_lease_duration=600

// Multiple protocols
?upnp_igd=true&pcp=true

§Arguments

  • endpoint - The actual endpoint URL with query parameters and assigned port
  • settings - P2P settings for updating external addresses
  • ex - Executor for running async tasks

§Returns

A vector of started port mappings (they auto-clean on drop)