Skip to content

Instantly share code, notes, and snippets.

@arabcoders
Last active April 26, 2021 22:15
Show Gist options
  • Save arabcoders/afcef8dee1da46b0aa5b45a89a3e6d66 to your computer and use it in GitHub Desktop.
Save arabcoders/afcef8dee1da46b0aa5b45a89a3e6d66 to your computer and use it in GitHub Desktop.
Patch sabnzbd to use same hostip for downloads/outgoing connections., do note that the WebUI will still report host default IP connection. this only affect the outgoing NNTP connections., also this may not work well on IPv6 NTP servers, i only tested it on ipv4 servers. taken from https://forums.sabnzbd.org/viewtopic.php?p=96582#p96582 please re…
--- newswrapper.py 2021-02-28 23:35:56.627867710 +0300
+++ newswrapper.py.ori 2021-02-28 23:50:04.462036861 +0300
@@ -305,6 +305,14 @@
# Use a regular wrapper, no certificate validation
self.sock = ssl.wrap_socket(socket.socket(af, socktype, proto))
+ #bind outgoing to same interface.
+ try:
+ self.sock.bind((sabnzbd.cfg.cherryhost(), 0))
+ logging.info('bind to %s worked OK', sabnzbd.cfg.cherryhost() )
+ except:
+ logging.info('bind to %s did not go well', sabnzbd.cfg.cherryhost() )
+ pass
+
# Store fileno of the socket
self.fileno: int = self.sock.fileno()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment