I need to run lynx on a ubuntu headless server with a specific IP address in
order to try and cancel an email blacklist.
Lynx doesn't provide a way to do that so I thought to use a local proxy. I tried
pymiproxy and hacked the connection code so it looked like this
proxy.py
........
from socket import socket, SOL_SOCKET
.......
import os
BIND_ADDRESS = os.environ.get('PYMIPROXY_BIND_ADDRESS',None)
BIND_DEVICE = os.environ.get('PYMIPROXY_BIND_DEVICE',None)
.............
# Connect to destination
sock = self._proxy_sock = socket()
sock.settimeout(10)
if BIND_ADDRESS:
sock.bind((BIND_ADDRESS, 0))
if BIND_DEVICE:
sock.setsockopt(SOL_SOCKET, 25, BIND_DEVICE)
sock.connect((self.hostname, int(self.port)))
25 is derived from /usr/include/asm-generic/socket.h
#define SO_BINDTODEVICE 25
This works if I export BIND_DEVICE='eth0' and run as root, but my desired
interface is actually called 'eth0:0' and when I run with that exported I get a
device error. Does anyone know what I should call the device?
--
Robin Becker
--
https://mail.python.org/mailman/listinfo/python-list