Knowledge Base 相关文章

服务器运维与选型文章

汇总海外服务器选型、站群部署、高防防护与运维实践,帮助快速定位部署与优化方案。

文章列表

从入门到放弃系列--如何成为全栈工程师04

从入门到放弃系列--如何成为全栈工程师04

之前的3节课,我告诉了你基础的html、div+css布局,你应该已经了解网页是怎么制作的,在开从第5节课开始,我会用一个完整的实例,带你制作快速制作一个企业网站,这节课,我要把让你明白,当你在浏览器里输入一个网址,网页是怎么出现的,以及,在做一个网站之前,我们必须要准备的事情,还有一些常见名词的解释;

阅读 302
查询IP所在地

查询IP所在地

using system; using system.io; using system.collections; using system.configuration; using system.text; using system.text.regularexpressions; using system.web; namespace xxxx.common { /// <summary> /// 利用纯真ip数据库(qqwry.dat)查询ip所在地 /// 优点:查询速度快、方便更新ip库 /// </summary> public static class ipscanner { private static string datapath = httpcontext.current.server.mappath("/libary/qqwry.dat"); private static string ip; private static string country; private static string local; private static long firststartip = 0; private static long laststartip = 0; private static filestream objfs = null; private static long startip = 0; private static long endip = 0; private static int countryflag = 0; private static long endipoff = 0; //private static string errmsg = null; #region 搜索匹配数据 private static int qqwry() { long ip_int = iptoint(ip); int nret = 0; if (ip_int >= iptoint("127.0.0.0") && ip_int <= iptoint("127.255.255.255")) { country = "本机内部环回地址"; local = ""; nret = 1; } else if ((ip_int >= iptoint("0.0.0.0") && ip_int <= iptoint("2.255.255.255")) || (ip_int >= iptoint("64.0.0.0") && ip_int <= iptoint("126.255.255.255")) || (ip_int >= iptoint("58.0.0.0") && ip_int <= iptoint("60.255.255.255"))) { country = "网络保留地址"; local = ""; nret = 1; } objfs = new filestream(datapath, filemode.open, fileaccess.read); try { //objfs.seek(0,seekorigin.begin); objfs.position = 0; byte[] buff = new byte[8]; objfs.read(buff, 0, 8); firststartip = buff[0] + buff[1] * 256 + buff[2] * 256 * 256 + buff[3] * 256 * 256 * 256; laststartip = buff[4] * 1 + buff[5] * 256 + buff[6] * 256 * 256 + buff[7] * 256 * 256 * 256; long recordcount = convert.toint64((laststartip - firststartip) / 7.0); if (recordcount <= 1) { country = "filedataerror"; objfs.close(); return 2; } long range = recordcount; long rangb = 0; long recno = 0; while (rangb < range - 1) { recno = (range + rangb) / 2; getstartip(recno); if (ip_int == startip) { rangb = recno; break; } if (ip_int > startip) rangb = recno; else range = recno; } getstartip(rangb); getendip(); if (startip <= ip_int && endip >= ip_int) { getcountry(); local = local.replace("(我们一定要解放台湾!!!)", ""); } else { nret = 3; country = "未知"; local = ""; } objfs.close(); return nret; } catch { return 1; } } #endregion #region 检验ip是否合法 /// <summary> /// 检验ip是否合法 /// </summary> /// <param name="checkip">需要检验的ip</param> /// <returns>true 合法/false 非法</returns> public static bool checkip(string checkip) { string pattern = @"(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))\.){3}((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))"; regex objre = new regex(pattern + "ip"); match objma = objre.match(checkip + "ip"); if (objma.success) { return true; } else { return false; } } #endregion #region ip字符串转换成int数据 /// <summary> /// 将ip字符串转换成int数据 /// </summary> /// <param name="ip">ip字符串</param> /// <returns>int数据</returns> public static long iptoint(string ip) { char[] dot = new char[] { '.' }; string[] iparr = ip.split(dot); if (iparr.length == 3) ip = ip + ".0"; iparr = ip.split(dot); long ip_int = 0; long p1 = long.parse(iparr[0]) * 256 * 256 * 256; long p2 = long.parse(iparr[1]) * 256 * 256; long p3 = long.parse(iparr[2]) * 256; long p4 = long.parse(iparr[3]); ip_int = p1 + p2 + p3 + p4; return ip_int; } #endregion #region int数据转换成ip字符串 /// <summary> /// 将int数据转换成ip字符串 /// </summary> /// <param name="ip_int"></param> /// <returns></returns> public static string inttoip(long ip_int) { long seg1 = (ip_int & 0xff000000) >> 24; if (seg1 < 0) seg1 += 0x100; long seg2 = (ip_int & 0x00ff0000) >> 16; if (seg2 < 0) seg2 += 0x100; long seg3 = (ip_int & 0x0000ff00) >> 8; if (seg3 < 0) seg3 += 0x100; long seg4 = (ip_int & 0x000000ff); if (seg4 < 0) seg4 += 0x100; string ip = seg1.tostring() + "." + seg2.tostring() + "." + seg3.tostring() + "." + seg4.tostring(); return ip; } #endregion #region 获取起始ip范围 private static long getstartip(long recno) { long offset = firststartip + recno * 7; //objfs.seek(offset,seekorigin.begin); objfs.position = offset; byte[] buff = new byte[7]; objfs.read(buff, 0, 7); endipoff = convert.toint64(buff[4].tostring()) + convert.toint64(buff[5].tostring()) * 256 + convert.toint64(buff[6].tostring()) * 256 * 256; startip = convert.toint64(buff[0].tostring()) + convert.toint64(buff[1].tostring()) * 256 + convert.toint64(buff[2].tostring()) * 256 * 256 + convert.toint64(buff[3].tostring()) * 256 * 256 * 256; return startip; } #endregion #region 获取结束ip private static long getendip() { //objfs.seek(endipoff,seekorigin.begin); objfs.position = endipoff; byte[] buff = new byte[5]; objfs.read(buff, 0, 5); endip = convert.toint64(buff[0].tostring()) + convert.toint64(buff[1].tostring()) * 256 + convert.toint64(buff[2].tostring()) * 256 * 256 + convert.toint64(buff[3].tostring()) * 256 * 256 * 256; countryflag = buff[4]; return endip; } #endregion #region 获取国家/区域偏移量 private static string getcountry() { switch (countryflag) { case 1: case 2: country = getflagstr(endipoff + 4); local = (1 == countryflag) ? " " : getflagstr(endipoff + 8); break; default: country = getflagstr(endipoff + 4); local = getflagstr(objfs.position); break; } return " "; } #endregion #region 获取国家/区域字符串 private static string getflagstr(long offset) { int flag = 0; byte[] buff = new byte[3]; while (1 == 1) { //objfs.seek(offset,seekorigin.begin); objfs.position = offset; flag = objfs.readbyte(); if (flag == 1 || flag == 2) { objfs.read(buff, 0, 3); if (flag == 2) { countryflag = 2; endipoff = offset - 4; } offset = convert.toint64(buff[0].tostring()) + convert.toint64(buff[1].tostring()) * 256 + convert.toint64(buff[2].tostring()) * 256 * 256; } else { break; } } if (offset < 12) return " "; objfs.position = offset; return getstr(); } #endregion #region getstr private static string getstr() { byte lowc = 0; byte upc = 0; string str = ""; byte[] buff = new byte[2]; while (1 == 1) { lowc = (byte)objfs.readbyte(); if (lowc == 0) break; if (lowc > 127) { upc = (byte)objfs.readbyte(); buff[0] = lowc; buff[1] = upc; system.text.encoding enc = system.text.encoding.getencoding("gb2312"); str += enc.getstring(buff); } else { str += (char)lowc; } } return str; } #endregion #region 获取ip地址 /// <summary> /// 根据ip查询所在地 /// </summary> /// <param name="scanip">查询ip</param> /// <returns>所在地</returns> public static string iplocation(string scanip) { if (checkip(scanip) == true) { ip = scanip; qqwry(); country = country.trim().replace("cz88.net", ""); local = local.trim().replace("cz88.net", ""); string location = country + " " + local; return location.trim(); } else { return "非法的ip地址"; } } #endregion } }

阅读 330
突破67 GHz带宽纪录:氮化硅波导集成碳纳米管光探测器实现1.55μm与2μm双波段高速探测

突破67 GHz带宽纪录:氮化硅波导集成碳纳米管光探测器实现1.55μm与2μm双波段高速探测

随着全球数据流量呈指数级增长、人工智能算力需求爆发式提升,传统基于1.55 μm通信c波段的光互连系统正逼近其物理极限。在此背景下,2 μm波段凭借石英光纤更低的传输损耗(约0.2 db/km)以及数倍于c波段的可用频谱资源,被视为下一代超大容量光通信、星地激光链路、红外传感与气体监测的关键窗口。然而,在2 μm波段实现兼具高速、高灵敏度、低暗电流且与cmos工艺兼容的探测器,长期是领域内一大瓶颈。

阅读 223
服务器基础解析:从工作原理到应用场景

服务器基础解析:从工作原理到应用场景

1. 服务器到底是什么? 我第一次接触服务器这个概念是在大学计算机课上,教授指着机房角落里那个嗡嗡作响的黑色大铁柜说:"这就是我们系的服务器"。当时我完全不明白,为什么一个看起来像大号电脑主机的东西,能让全班30台电脑同时运行同一个程序。直到后来自己搭建了第一个网站,才真正理解了服务器的核心价值。

阅读 208
定制AI开发如何申请美国研发税收抵免?

定制AI开发如何申请美国研发税收抵免?

在 ai 应用加速落地的今天,很多团队都在投入精力做“定制 ai 开发”——也就是根据业务场景,用开源模型做微调、搭建专属知识库、开发 rag 检索增强应用、优化推理链路。大家关注点通常集中在技术选型、模型效果和部署成本上,却很少有人意识到:这类软件开发活动,很可能符合美国联邦研发税收抵免(r&d tax credit)的申请资格。

阅读 220
12月第三周各国域名总量榜:中国729万居全球第二

12月第三周各国域名总量榜:中国729万居全球第二

idc评述网(idcps.com)12月26日报道:根据webhosting.info最新数据,截至2013年12月23日,中国域名总量已增至7,293,614个,仅次美国,居全球第二名,12月第三周新增34,682个。而中国香港,域名注册总量为793,355个,12月第三周净减411个,位居全球第十五名。下面,idc评述网与大家一起关注12月第三周全球各国域名总量top20最新数据。

阅读 296
香港高防IP如何添加

香港高防IP如何添加

用户需要购买合适的高防 ip 套餐,并联系客服进行配置。接下来,需要进行转发规则的配置。用户提供域名、ip 和端口等信息,由自己或者服务商技术人员为其配置转发协议、转发端口和源站等规则。通过这样的配置,用户可以将业务 ip 替换成高防 ip 上的地址,并修改 dns 解析将业务域名指向高防 ip 。 这样一来,当服务器遭受 ddos 攻击时,攻击流量会被引流到高防 ip 上进行清洗,而源服务器则可以正常访问。

阅读 338
探索快速的美国VPS选择指南,助力在线业务

探索快速的美国VPS选择指南,助力在线业务

  vps是许多在线业务成功运行的关键组成部分之一。它们提供了性能、可靠性和安全性,使您的网站或应用程序能够在互联网上畅行无阻。美国作为全球领先的vps提供国之一,提供了广泛的选择,但也需要仔细考虑以找到最适合您需求的vps。在本指南中,我们将探讨美国vps的选择因素、提供商建议以及如何优化您的在线业务。

阅读 172
联系客服