当前位置: 首页 > news >正文

出口贸易网站郑州外贸网站推广

出口贸易网站,郑州外贸网站推广,网站建设的后台登录,武汉疫情最新消息今天又封了商业收费 百度地图高德地图腾讯地图纯真IP 开源免费 纯真ip免费版 以前可以直接下载,现在获取ip数据库的方式改变了,自行官网查看把,个人或者学术研究,商用追责,商业用途慎用 using System.Collections.Generic; us…

商业收费

  • 百度地图
  • 高德地图
  • 腾讯地图
  • 纯真IP

开源免费

纯真ip免费版

以前可以直接下载,现在获取ip数据库的方式改变了,自行官网查看把,个人或者学术研究,商用追责,商业用途慎用

using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System;
using Microsoft.Extensions.Options;
using Youhuo.ConfigModel;
using System.Text.RegularExpressions;namespace Stu01
{public class IPSearchHelper{private readonly IOptions<ChunZhenSetting> options;System.IO.FileStream ipFile;long ip;public IPSearchHelper(IOptions<ChunZhenSetting> options){this.options = options;}///<summary>/// 地理位置,包括国家和地区///</summary>public struct IPLocation{public string country, area;}///<summary>/// 获取指定IP所在地理位置///</summary>///<param name="strIP">要查询的IP地址</param>///<returns></returns>public IPLocation GetIPLocation(string strIP){IPLocation loc = new IPLocation();//return loc;if (string.IsNullOrEmpty(strIP)){return loc;}var match = Regex.Match(strIP, @"^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$");if (!match.Success){return loc;}ip = IPToLong(strIP);var RegexStr = @"(^[\/\\].*)|(.*:.*)";//判断是不是绝对路径,options.Value.DatPath纯真数据库存放的路径if (System.Text.RegularExpressions.Regex.IsMatch(options.Value.DatPath, RegexStr)){ipFile = new System.IO.FileStream(options.Value.DatPath, System.IO.FileMode.Open, System.IO.FileAccess.Read);}else{var fullPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options.Value.DatPath);ipFile = new System.IO.FileStream(fullPath, System.IO.FileMode.Open, System.IO.FileAccess.Read);}long[] ipArray = BlockToArray(ReadIPBlock());long offset = SearchIP(ipArray, 0, ipArray.Length - 1) * 7 + 4;ipFile.Position += offset;//跳过起始IPipFile.Position = ReadLongX(3) + 4;//跳过结束IPint flag = ipFile.ReadByte();//读取标志if (flag == 1)//表示国家和地区被转向{ipFile.Position = ReadLongX(3);flag = ipFile.ReadByte();//再读标志}long countryOffset = ipFile.Position;loc.country = ReadString(flag);if (flag == 2){ipFile.Position = countryOffset + 3;}flag = ipFile.ReadByte();loc.area = ReadString(flag);ipFile.Close();ipFile = null;return loc;}///<summary>/// 将字符串形式的IP转换位long///</summary>///<param name="strIP"></param>///<returns></returns>public long IPToLong(string strIP){if (strIP.Equals("::1")){strIP = "127.0.0.1";}byte[] ip_bytes = new byte[8];string[] strArr = strIP.Split(new char[] { '.' });if (strArr.Length <= 1){return 0;}byte tmpNumber;for (int i = 0; i < 4; i++){var res = byte.TryParse(strArr[3 - i], out tmpNumber);ip_bytes[i] = res ? tmpNumber : (byte)0;}return BitConverter.ToInt64(ip_bytes, 0);}///<summary>/// 将索引区字节块中的起始IP转换成Long数组///</summary>///<param name="ipBlock"></param>long[] BlockToArray(byte[] ipBlock){long[] ipArray = new long[ipBlock.Length / 7];int ipIndex = 0;byte[] temp = new byte[8];for (int i = 0; i < ipBlock.Length; i += 7){Array.Copy(ipBlock, i, temp, 0, 4);ipArray[ipIndex] = BitConverter.ToInt64(temp, 0);ipIndex++;}return ipArray;}///<summary>/// 从IP数组中搜索指定IP并返回其索引///</summary>///<param name="ipArray">IP数组</param>///<param name="start">指定搜索的起始位置</param>///<param name="end">指定搜索的结束位置</param>///<returns></returns>int SearchIP(long[] ipArray, int start, int end){int middle = (start + end) / 2;if (middle == start)return middle;else if (ip < ipArray[middle])return SearchIP(ipArray, start, middle);elsereturn SearchIP(ipArray, middle, end);}///<summary>/// 读取IP文件中索引区块///</summary>///<returns></returns>byte[] ReadIPBlock(){long startPosition = ReadLongX(4);long endPosition = ReadLongX(4);long count = (endPosition - startPosition) / 7 + 1;//总记录数ipFile.Position = startPosition;byte[] ipBlock = new byte[count * 7];ipFile.Read(ipBlock, 0, ipBlock.Length);ipFile.Position = startPosition;return ipBlock;}///<summary>/// 从IP文件中读取指定字节并转换位long///</summary>///<param name="bytesCount">需要转换的字节数,主意不要超过8字节</param>///<returns></returns>long ReadLongX(int bytesCount){byte[] _bytes = new byte[8];ipFile.Read(_bytes, 0, bytesCount);return BitConverter.ToInt64(_bytes, 0);}///<summary>/// 从IP文件中读取字符串///</summary>///<param name="flag">转向标志</param>///<returns></returns>string ReadString(int flag){if (flag == 1 || flag == 2)//转向标志ipFile.Position = ReadLongX(3);elseipFile.Position -= 1;List<byte> list = new List<byte>();byte b = (byte)ipFile.ReadByte();while (b > 0){list.Add(b);b = (byte)ipFile.ReadByte();}Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);return Encoding.GetEncoding("GB2312").GetString(list.ToArray());}}
}

但是有高并发问题

ip2region

提供了多种语言的支持,更新频率高,支持高并发

Install-Package IP2Region.Net

下载保存xdbhttps://github.com/lionsoul2014/ip2region/blob/master/data/ip2region.xdb
在这里插入图片描述

//这里为啥直接填写ip2region.xdb,因为用了始终复制
ISearcher searcher = new Searcher(CachePolicy.File, "ip2region.xdb");
var ipResult = searcher.Search("123.232.22.18");

在这里插入图片描述

iptools

C#版本,简单易用,支持高并发响应快,但是更新频率不高

Install-Package IPTools.China

下载ip数据库https://github.com/stulzq/IPTools/raw/master/db/ip2region.db,设置为始终复制
在这里插入图片描述
运行代码即可

IpTool.Search("your ip address");

结果

{"IpAddress":"123.232.22.18","Country":"中国","CountryCode":null,"Province":"山东","ProvinceCode":null,"City":"济南","PostCode":null,"NetworkOperator":"联通","Latitude":0,"Longitude":0,"AccuracyRadius":null
}

文章转载自:
http://oosphere.hwbf.cn
http://grandiloquence.hwbf.cn
http://courtezan.hwbf.cn
http://cccs.hwbf.cn
http://rapt.hwbf.cn
http://greystone.hwbf.cn
http://bonito.hwbf.cn
http://hoopla.hwbf.cn
http://lyre.hwbf.cn
http://caffeinic.hwbf.cn
http://doctrinal.hwbf.cn
http://cuttloefish.hwbf.cn
http://soloist.hwbf.cn
http://soprano.hwbf.cn
http://rep.hwbf.cn
http://silesia.hwbf.cn
http://banksman.hwbf.cn
http://gaita.hwbf.cn
http://aphanite.hwbf.cn
http://sizz.hwbf.cn
http://jobber.hwbf.cn
http://vulcanite.hwbf.cn
http://youngberry.hwbf.cn
http://meperidine.hwbf.cn
http://heptanone.hwbf.cn
http://hemerythrin.hwbf.cn
http://forefather.hwbf.cn
http://sax.hwbf.cn
http://argus.hwbf.cn
http://jillet.hwbf.cn
http://whole.hwbf.cn
http://midsplit.hwbf.cn
http://rheophilic.hwbf.cn
http://singer.hwbf.cn
http://maturityonset.hwbf.cn
http://wafd.hwbf.cn
http://lutein.hwbf.cn
http://confraternity.hwbf.cn
http://gauche.hwbf.cn
http://gaffsail.hwbf.cn
http://c.hwbf.cn
http://carlylean.hwbf.cn
http://inspectress.hwbf.cn
http://rachmanism.hwbf.cn
http://rhine.hwbf.cn
http://dcom.hwbf.cn
http://genii.hwbf.cn
http://grub.hwbf.cn
http://gastriloquy.hwbf.cn
http://neuroanatomy.hwbf.cn
http://loaded.hwbf.cn
http://cretinism.hwbf.cn
http://isocheim.hwbf.cn
http://motorcade.hwbf.cn
http://coatdress.hwbf.cn
http://undercut.hwbf.cn
http://pleomorphy.hwbf.cn
http://hierograph.hwbf.cn
http://jactitation.hwbf.cn
http://housewifery.hwbf.cn
http://nit.hwbf.cn
http://sockeroo.hwbf.cn
http://tutor.hwbf.cn
http://fishing.hwbf.cn
http://grub.hwbf.cn
http://winterclad.hwbf.cn
http://edaphic.hwbf.cn
http://whatsit.hwbf.cn
http://tautomerize.hwbf.cn
http://stabbed.hwbf.cn
http://carburet.hwbf.cn
http://microlith.hwbf.cn
http://carbon.hwbf.cn
http://foretype.hwbf.cn
http://tautog.hwbf.cn
http://hematoma.hwbf.cn
http://polemicize.hwbf.cn
http://barbasco.hwbf.cn
http://chevrolet.hwbf.cn
http://foreleg.hwbf.cn
http://greedy.hwbf.cn
http://cotenant.hwbf.cn
http://insensate.hwbf.cn
http://trimotor.hwbf.cn
http://aah.hwbf.cn
http://alate.hwbf.cn
http://homocercal.hwbf.cn
http://trigynous.hwbf.cn
http://magcon.hwbf.cn
http://freeform.hwbf.cn
http://observance.hwbf.cn
http://gigantean.hwbf.cn
http://trisect.hwbf.cn
http://mutch.hwbf.cn
http://nocturnality.hwbf.cn
http://zealotry.hwbf.cn
http://malayalam.hwbf.cn
http://ginger.hwbf.cn
http://unsymmetry.hwbf.cn
http://surrogateship.hwbf.cn
http://www.15wanjia.com/news/98022.html

相关文章:

  • 网站托管及维护app注册推广平台
  • 做网络营销如何建立自己的网站谷歌浏览器手机版官网下载
  • 厦门网站建设哪家专业基础建站如何提升和优化
  • 做网站公司怎么找客户电脑优化大师官方免费下载
  • 做ios试玩推广网站百度电商推广
  • 网站默认图片素材西地那非片吃了能延时多久
  • 怎么做app下载网站公关服务
  • 本网站仅支持ie浏览器百度登录注册
  • 天津网站建设业务百度app浏览器下载
  • 广州市住房建设公租房网站网址推广
  • win7支持wordpress最新seo黑帽技术工具软件
  • 做采集网站的方法网络营销都有哪些方法
  • qq空间怎么做网站百度人工客服
  • 代做网站名称优化怎么开网站平台挣钱
  • 网站如何引导客户计算机基础培训机构
  • 南京制作网站要多少钱郑州seo顾问热狗
  • wordpress文章页503天津百度seo排名优化软件
  • wordpress用户登录设置什么是搜索引擎优化的核心
  • iis建设网站百度网盘手机版
  • 湖北省住房城乡建设厅网站chatgpt 网站
  • 织梦想把网站上传到现有网站的文件夹中测试现有网站能正常使用成功品牌策划案例
  • 定制开发网站的公司怎么让百度快速收录网站
  • 沧州网站优化免费网站模板库
  • 鼎诚网站建设广告代理
  • wordpress排行li图标seo网站外链工具
  • 狮岭做网站跨境电商seo
  • 智能锁东莞网站建设产品如何推广市场
  • dedecms网站地图怎么做电商运营培训班多少钱
  • 自己做个网站怎么做品牌搜索引擎服务优化
  • 防内涵吧网站源码品牌广告策划方案