socketify.py/examples/proxy.py

13 wiersze
435 B
Python
Czysty Zwykły widok Historia

2022-11-08 10:44:16 +00:00
from socketify import App
def home(res, req):
res.write('<html><h1>')
res.write('Your proxied IP is: %s' % res.get_proxied_remote_address())
res.write('</h1><h1>')
res.write('Your IP as seen by the origin server is: %s' % res.get_remote_address())
res.end('</h1></html>')
app = App()
app.get("/*", home)
app.listen(3000, lambda config: print("Listening on port http://localhost:%d now\n" % config.port))
app.run()