現在の IP ベースの認証の代わりに「プロキシ認証」(ユーザー名/パスワード) を使用するように、単純な Twisted Web プロキシを変更しようとしています。問題は、私は Twisted が初めてで、どこから始めればよいかさえわからないことです。
これが私のファクトリークラスです。
class ProxyFactory(http.HTTPFactory):
def __init__(self, ip, internal_ips):
http.HTTPFactory.__init__(self)
self.ip = ip
self.protocol = proxy.Proxy
self.INTERNAL_IPS = internal_ips
def buildProtocol(self, addr):
print addr
# IP based authentication -- need to switch this to use standard Proxy password authentication
if addr.host not in self.INTERNAL_IPS:
return None
#p = protocol.ServerFactory.buildProtocol(self, addr)
p = self.protocol()
p.factory = self
# timeOut needs to be on the Protocol instance cause
# TimeoutMixin expects it there
p.timeOut = self.timeOut
return p
これを機能させるために何をする必要があるか考えていますか? ご協力いただきありがとうございます!