'Implements proxy connection for UDP sockets,
which happens during the bind() phase.'

def bind(self, *pos, **kw):

    (proxy_type, proxy_addr, proxy_port, rdns, username, password) = self.proxy
    if ((not proxy_type) or (self.type != socket.SOCK_DGRAM)):
        return _orig_socket.bind(self, *pos, **kw)
    if self._proxyconn:
        raise socket.error(EINVAL, 'Socket    already    bound    to    an    address')
    if (proxy_type != SOCKS5):
        msg = 'UDP    only    supported    by    SOCKS5    proxy    type'
        raise socket.error(EOPNOTSUPP, msg)
    _BaseSocket.bind(self, *pos, **kw)
    (_, port) = self.getsockname()
    dst = ('0', port)
    self._proxyconn = _orig_socket()
    proxy = self._proxy_addr()
    self._proxyconn.connect(proxy)
    UDP_ASSOCIATE = '\x03'
    (_, relay) = self._SOCKS5_request(self._proxyconn, UDP_ASSOCIATE, dst)
    (host, _) = proxy
    (_, port) = relay
    _BaseSocket.connect(self, (host, port))
    self.proxy_sockname = ('0.0.0.0', 0)
