Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add IPv6 support to PyGopherD 3.0.0 because I'm a little insane.
--- /tmp/server.py 2021-11-29 00:36:15.635976398 +0000
+++ server.py 2021-11-29 01:34:51.548265273 +0000
@@ -38,7 +38,7 @@
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO, timeout)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_SNDTIMEO, timeout)
- host, port = self.socket.getsockname()
+ host, port, flowinfo, scopeid = self.socket.getsockname()
if self.config.has_option("pygopherd", "servername"):
self.server_name = self.config.get("pygopherd", "servername")
else:
@@ -65,6 +65,8 @@
class ForkingTCPServer(BaseServer, socketserver.ForkingTCPServer):
+ address_family = socket.AF_INET6
+
def process_request(
self, request: socket.SocketType, client_address: typing.Tuple[str, int]
) -> None:
@@ -96,6 +98,8 @@
class ThreadingTCPServer(BaseServer, socketserver.ThreadingTCPServer):
+ address_family = socket.AF_INET6
+
def process_request_thread(
self, request: socket.SocketType, client_address: typing.Tuple[str, int]
) -> None:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment