Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ipv6 in is_local_domain #32

Merged
merged 1 commit into from Mar 25, 2020
Merged

Fix ipv6 in is_local_domain #32

merged 1 commit into from Mar 25, 2020

Conversation

catsout
Copy link
Contributor

@catsout catsout commented Mar 25, 2020

As socket.gethostbyname is not support ipv6, use socket.getaddrinfo instead.
Also skip local check for ipv6 and return false for few people use private ipv6.May be a prefix compare is better.
The port param in socket.getaddrinfo is not matter.

@catsout catsout changed the title use getaddrinfo and return false in is_local_domain for ipv6 Use getaddrinfo and return false in is_local_domain for ipv6 Mar 25, 2020
@catsout catsout changed the title Use getaddrinfo and return false in is_local_domain for ipv6 Fix ipv6 in is_local_domain Mar 25, 2020
@iwalton3
Copy link
Member

This doesn't seem to be valid. I don't get an IP address when I run the changed code in the repl:

>>> addr_info = socket.getaddrinfo("google.com",8096)
>>> addr_info[0] == socket.AddressFamily.AF_INET6
False
>>> addr_info[4][0] # ip is set to this
<AddressFamily.AF_INET6: 10>

The ipaddress module supports checking if an ipv6 address is local, so the ip address could be requested from getaddrinfo and checked normally. Simply returning false would cause the player to limit local ipv6 playback to 10 mbps by default.

@catsout
Copy link
Contributor Author

catsout commented Mar 25, 2020

Sorry, I forgot to add [0] for getaddrinfo. I didn't find it as jellyfin-mpv-shim run ok.

@iwalton3 iwalton3 merged commit 194f5fd into jellyfin:master Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants