3 \�me�= � @ s. d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlZd dlm Z d dl mZ d dlm Z d dlmZmZmZmZmZ d dlmZmZ d dlmZ d d lmZmZ d d lmZ d dlmZ ej e!�Z"dd gZ#dZ$dZ%dZ&G dd� dej'j(�Z)dd� Z*dd� Z+G dd� dej,�Z-e-ej.ffgZ/dd� Z0dS )� N)�urlparse)�ConnectionError)�HTTPConnection)�PoolManager)�dmi�net�sources� url_helper�util)� EventScope� EventType)�NoDHCPLeaseError)�EphemeralDHCPv4�EphemeralIPv6Network)�DataSourceHostname)�ProcessExecutionErrorzhttp://169.254.42.42zhttp://[fd00:42::42]� � � c s* e Zd ZdZ� fdd�Zddd�Z� ZS )�SourceAddressAdapterzF Adapter for requests to choose the local address to bind to. c s || _ tt| �jf |� d S )N)�source_address�superr �__init__)�selfr �kwargs)� __class__� �(/usr/lib/python3.6/DataSourceScaleway.pyr + s zSourceAddressAdapter.__init__Fc C s0 t jtjtjdfg }t|||| j|d�| _d S )N� )Z num_pools�maxsize�blockr �socket_options)r Zdefault_socket_options�socketZ SOL_SOCKETZSO_REUSEPORTr r Zpoolmanager)r Zconnectionsr r r! r r r �init_poolmanager/ s z%SourceAddressAdapter.init_poolmanager)F)�__name__� __module__�__qualname__�__doc__r r# � __classcell__r r )r r r &