I am very new to python. I am starting with twisted. As I saw in Twisted documentation, just this can make a proxy server.
class MyProxy(proxy.Proxy):
pass
class ProxyFactory(http.HTTPFactory):
protocol = MyProxy
reactor.listenTCP(8080, ProxyFactory())
reactor.run()
ProxyFactory::protocol looks like a member variable ? but MyProxy is a typename and I don't know is it a kind of template ? otherwise how can I assign a type into a variable ?
What I actually want to achive is simply reject requests to certain endpoints. I was thinking of overriding buildProtocol But the supplied argument addr is always 127.0.0.1