Skip to content

Instantly share code, notes, and snippets.

@cdhowie
Last active July 17, 2019 02:27
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cdhowie/c38d5651f2cb150bf37cb449d147eb3f to your computer and use it in GitHub Desktop.
Save cdhowie/c38d5651f2cb150bf37cb449d147eb3f to your computer and use it in GitHub Desktop.
DNS proxy to fix Netflix stupidity
@Kline-
Copy link

Kline- commented Jun 6, 2016

Thanks for this, I'm not a Python guy at all -- any help with this? I had your script setup to run in place of my local BIND instance and to then forward requests to BIND afterwards.

Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/names/dns.py", line 2859, in datagramReceived
    self.controller.messageReceived(m, self, addr)
  File "/usr/lib/python2.7/dist-packages/twisted/names/server.py", line 554, in messageReceived
    self.handleQuery(message, proto, address)
  File "/usr/lib/python2.7/dist-packages/twisted/names/server.py", line 381, in handleQuery
    return self.resolver.query(query).addCallback(
  File "/usr/lib/python2.7/dist-packages/twisted/names/common.py", line 73, in query
    return defer.maybeDeferred(method, query.name.name, timeout)
---  ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/names/common.py", line 81, in lookupAddress
    return self._lookup(name, dns.IN, dns.A, timeout)
  File "/usr/lib/python2.7/dist-packages/twisted/names/resolve.py", line 79, in _lookup
    d = self.resolvers[0].query(q, timeout)
  File "./netflix-aaaa-filter", line 35, in query
    if self.__shouldBlock(query):
  File "./netflix-aaaa-filter", line 30, in __shouldBlock
    penultimateDomainPart = query.name.name.split('.')[-2]
exceptions.IndexError: list index out of range

@stevesteffler
Copy link

stevesteffler commented Jun 7, 2016

Any idea how to do the opposite, i.e. force netflix to in no way use IPv4? It appears that if I run only IPv6 and no IPv4 I do not get the geo-blocking errors, it only detects dual-stack configurations. Running a client IPv6-only also is perfectly acceptable. (preferable in my case)

@cdhowie
Copy link
Author

cdhowie commented Jun 7, 2016

@Kline- Please try the latest version, I believe I have fixed this.

@stevesteffler In server.py, just replace dns.AAAA with dns.A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment