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

Force IPv4 / measure IPv4 speed #1

Closed
sanderjo opened this issue Jun 2, 2016 · 1 comment
Closed

Force IPv4 / measure IPv4 speed #1

sanderjo opened this issue Jun 2, 2016 · 1 comment

Comments

@sanderjo
Copy link
Owner

sanderjo commented Jun 2, 2016

Sometimes you want to know the IPv4 speed. So: offer an option to force ipv4

Manual proof of concept:

sander@raspi2:~/git/fast.com $ host api.fast.com
api.fast.com is an alias for fast.geo.netflix.com.
fast.geo.netflix.com is an alias for fast.eu-west-1.prodaa.netflix.com.
fast.eu-west-1.prodaa.netflix.com has address 176.34.255.139
fast.eu-west-1.prodaa.netflix.com has address 176.34.105.245
fast.eu-west-1.prodaa.netflix.com has address 54.217.252.92
fast.eu-west-1.prodaa.netflix.com has IPv6 address 2a01:578:3::b022:ff8b
fast.eu-west-1.prodaa.netflix.com has IPv6 address 2a01:578:3::36d9:fc5c
fast.eu-west-1.prodaa.netflix.com has IPv6 address 2a01:578:3::b022:69f5


sander@raspi2:~/git/fast.com $ curl 'https://176.34.255.139/netflix/speedtest?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=3'
curl: (51) SSL: certificate subject name 'api.fast.com' does not match target host name '176.34.255.139'


sander@raspi2:~/git/fast.com $ curl 'http://176.34.255.139/netflix/speedtest?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=3' | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   395  100   395    0     0   4593      0 --:--:-- --:--:-- --:--:--  4647
[
    {
        "url": "https://ipv4_1-cxl0-c059.1.ams001.ix.nflxvideo.net/speedtest?c=nl&n=15435&v=3&e=1464865113&t=dL3njW8Lwz2RDxJGoGM2fxXCz4o"
    },
    {
        "url": "https://ipv4_1-cxl0-c073.1.ams001.ix.nflxvideo.net/speedtest?c=nl&n=15435&v=3&e=1464865113&t=sYFyz7Sjvc4HkEYPsovFV70Mywo"
    },
    {
        "url": "https://ipv4_1-lagg0-c061.1.nyc001.ix.nflxvideo.net/speedtest?c=nl&n=15435&v=3&e=1464865113&t=NGeaXNH0q2OtWqJiV0dnYKthdJ0"
    }
]
sander@raspi2:~/git/fast.com $

sander@raspi2:~/git/fast.com $ wget "https://ipv4_1-cxl0-c059.1.ams001.ix.nflxvideo.net/speedtest?c=nl&n=15435&v=3&e=1464865113&t=dL3njW8Lwz2RDxJGoGM2fxXCz4o" -O /dev/null
--2016-06-02 12:03:06--  https://ipv4_1-cxl0-c059.1.ams001.ix.nflxvideo.net/speedtest?c=nl&n=15435&v=3&e=1464865113&t=dL3njW8Lwz2RDxJGoGM2fxXCz4o
Resolving ipv4_1-cxl0-c059.1.ams001.ix.nflxvideo.net (ipv4_1-cxl0-c059.1.ams001.ix.nflxvideo.net)... 198.38.114.141
Connecting to ipv4_1-cxl0-c059.1.ams001.ix.nflxvideo.net (ipv4_1-cxl0-c059.1.ams001.ix.nflxvideo.net)|198.38.114.141|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26214400 (25M) [application/octet-stream]
Saving to: â/dev/nullâ

/dev/null                                           100%[====================================================================================================================>]  25.00M  3.60MB/s   in 7.0s

2016-06-02 12:03:13 (3.55 MB/s) - â/dev/nullâ saved [26214400/26214400]

sander@raspi2:~/git/fast.com $

In python:

>>> print socket.getaddrinfo('api.fast.com', 80, socket.AF_INET)
[(2, 1, 6, '', ('176.34.255.139', 80)), (2, 2, 17, '', ('176.34.255.139', 80)), (2, 3, 0, '', ('176.34.255.139', 80)), (2, 1, 6, '', ('176.34.105.245', 80)), (2, 2, 17, '', ('176.34.105.245', 80)), (2, 3, 0, '', ('176.34.105.245', 80)), (2, 1, 6, '', ('54.217.252.92', 80)), (2, 2, 17, '', ('54.217.252.92', 80)), (2, 3, 0, '', ('54.217.252.92', 80))]
>>> for item in socket.getaddrinfo('api.fast.com', 80, socket.AF_INET): print item
...
(2, 1, 6, '', ('176.34.105.245', 80))
(2, 2, 17, '', ('176.34.105.245', 80))
(2, 3, 0, '', ('176.34.105.245', 80))
(2, 1, 6, '', ('54.217.252.92', 80))
(2, 2, 17, '', ('54.217.252.92', 80))
(2, 3, 0, '', ('54.217.252.92', 80))
(2, 1, 6, '', ('176.34.255.139', 80))
(2, 2, 17, '', ('176.34.255.139', 80))
(2, 3, 0, '', ('176.34.255.139', 80))
>>>
@sanderjo
Copy link
Owner Author

sanderjo commented Jun 2, 2016

Solved: a74d356

@sanderjo sanderjo closed this as completed Jun 2, 2016
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

No branches or pull requests

1 participant