#๐Ÿ”’ Proxying client address to socket

4 messages ยท Page 1 of 1 (latest)

exotic knot
#

Hi all, I've deployed an Internet Relay Chat web client using flet. Due to issues with flet's ability to publish an app for client-side rendering I'm forced to use server-side rendering.

The issue I'm running into is that since the app is running on the server rather than in the user's browser, all users are connecting to the server from the same IP address, which would not allow me to IP-ban bad actors.

The way I've implemented the client is as a socket that binds to the IRC server on port 6667:

def connect(self, hostname: str, port: int = 6667) -> None:
    self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    self.socket.connect((hostname, port))
    self.socket.settimeout(10)

I'm wondering if there's any way to proxy the client's IP address (Flet makes this available in Page.client_ip) to the socket. So far I've tried socket.create_connection with the source_address set to the client IP, but this does not work:

OSError: [Errno 99] Cannot assign requested address
limpid turretBOT
#

@exotic knot

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

limpid turretBOT
#

@exotic knot

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.