加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 移动互联 > 正文

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

发布时间:2019-07-23 13:10: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; 
 

(编辑:湖南网)

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

热点阅读