加入收藏 | 设为首页 | 会员中心 | 我要投稿 晋中站长网 (https://www.0354zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 移动互联 > 评测 > 正文

一份完整的 IPv6 环境下 DNS 相关测试

发布时间:2019-07-24 00:24:16 所属栏目:评测 来源:董涛 张欣接
导读:董涛,网易游戏高级运维工程师,主要工作方向为网易集团 DNS 的运维与开发。 张欣接,网易集团 DNS 团队负责人,负责网易域名系统的架构设计及生态建设。 一、IPv6 支持度报告 IPv6 简介 IPv6(Internet Protocol version 6,互联网通信协议第 6 版)是用

  1. import requests 
  2. response = requests.get("http://IPv6test.ntes53.netease.com:8000", stream=True) 
  3. print response.raw._fp.fp._sock.getpeername() 

C++

  1. #include <stdio.h> 
  2. #include <curl/curl.h> 
  3.  
  4. int main(void) 
  5.   CURL *curl; 
  6.   CURLcode res; 
  7.  
  8.   curl = curl_easy_init(); 
  9.   if(curl) { 
  10.     curl_easy_setopt(curl, CURLOPT_URL, "http://IPv6test.ntes53.netease.com:8000"); 
  11.     /* example.com is redirected, so we tell libcurl to follow redirection */  
  12.     curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); 
  13.       // curl_easy_setopt(curl, CURL_IPRESOLVE_V6, 1L);  // 使用 IPv6 地址 
  14.       // curl_easy_setopt(curl, CURL_IPRESOLVE_V4, 1L);  // 使用 IPv4 地址 
  15.       // curl_easy_setopt(curl, CURL_IPRESOLVE_WHATEVER, 1L);  // 获取系统允许的 IPv4 或者 IPv6 地址  
  16.     /* Perform the request, res will get the return code */  
  17.     res = curl_easy_perform(curl); 
  18.     /* Check for errors */  
  19.     if(res != CURLE_OK) 
  20.       fprintf(stderr, "curl_easy_perform() failed: %sn", 
  21.               curl_easy_strerror(res)); 
  22.  
  23.     /* always cleanup */  
  24.     curl_easy_cleanup(curl); 
  25.   } 
  26.   return 0; 
 

(编辑:晋中站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读