
    9Yf                     4    d Z ddlZddlZ G d de      Zd Zy)z4
Helper(s), resolve the system's default interface.
    Nc                       e Zd ZdZy)UnresolvableDefaultRoutez3
    Unable to resolve system's default route.
    N)__name__
__module____qualname____doc__     W/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/datadog/dogstatsd/route.pyr   r      s    r
   r   c                     	 t        d      5 } | j                         D ]i  }|j                         j                         }|d   dk(  s*t	        j
                  t        j                  dt        |d   d                  c cddd       S  	 ddd       t        d	      # 1 sw Y   xY w# t        $ r t        d      w xY w)
a   
    Return the system default interface using the proc filesystem.

    Returns:
        string: default route

    Raises:
        `NotImplementedError`: No proc filesystem is found (non-Linux systems)
        `StopIteration`: No default route found
    z/proc/net/route   00000000z<L      NzXUnable to open `/proc/net/route`. `use_default_route` option is available on Linux only.z-Unable to resolve the system default's route.)open	readlinesstripsplitsocket	inet_ntoastructpackintIOErrorNotImplementedErrorr   )flinefieldss      r   get_default_router      s    	
#$ 	S S++-!9
*!++FKKc&)R>P,QRR		S 	SS	S ##S
TT	S 	S
  
!k
 	

s4   B* :B7B?	B* 	BB* B'#B* *B?)r   r   r   	Exceptionr   r   r	   r
   r   <module>r!      s$     y Ur
   