GeoIP2:检验IP地址位置识别的实用性

news2024/9/24 11:30:12

文章目录

  • 前言
  • 安装环境
    • 软件版本说明
    • libmaxminddb 环境安装
    • ngx_http_geoip2_module 安装
    • GeoLite2 数据库下载
    • 定时更新
    • 测试定位
    • 安装模块
  • 应用场景
    • 重点
    • 仅限中国访问,国外禁止
    • 仅限中国访问,但放开国外部分IP
    • 不同国家展示不同页面
    • IP地址解析
  • 总结



前言



GeoIP2是一种被广泛使用的IP地址定位技术,它可以根据用户的IP地址确定其所在的地理位置信息。无论是网络安全还是市场营销等领域,GeoIP2都是一个非常实用的工具。因为它易于使用,所以它经常被外贸等行业广泛应用。

由于之前,我也有了相关的需求,也是开始测试各种定位相关的工具。这个工具的测试,是在我写通过API限制城市之前。为了避免忘记,我将记录下测试Geoip2的过程整理后,与大家分享。希望这篇文章可以对需要定位IP地址的读者有所帮助。



安装环境



如果不是环境特别差,没有要求不能动nginx的版本的话,直接更换openresty吧。
这个环境基本上是上一篇的环境一致,对于这个模块的测试实际上是在上一个环境之前,修改后才将文档放出来的



软件版本说明



个人实际的软件版本

nginx:1.20.1
https://nginx.org/download/nginx-1.20.1.tar.gz
我使用源码安装


libmaxminddb:1.6.0
https://github.com/maxmind/libmaxminddb
https://github.com/maxmind/libmaxminddb/releases/download/1.6.0/libmaxminddb-
1.6.0.tar.gz
我使用yum安装,因为这些组件很少会出现版本不适配的问题


ngx_http_geoip2_module:3.4
https://github.com/leev/ngx_http_geoip2_module/
https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/3.4.tar.gz




GeoLite2 数据库下载
https://dev.maxmind.com/geoip/geoip2/geolite2/


libmaxminddb 环境安装



安装 libmaxminddb 库(开源的C库,主要用于解析MaxMind GeoIP2数据库文件)
MaxMind数据库更新工具GeoIP Update,
以及与 MaxMind 数据库相关的一些实用工具mmdblookup

目的是用于解析和更新之后添加的地图数据库



<1>源码安装
wget https://github.com/maxmind/libmaxminddb/releases/download/1.6.0/libmaxminddb-1.6.0.tar.gz
tar -xf libmaxminddb-1.6.0.tar.gz
cd libmaxminddb-1.6.0
./configure
make && make install
echo "/usr/local/lib" >> /etc/ld.so.conf.d/libc.conf 
sudo ldconfig

<2>Ubuntu安装
apt install libmaxminddb0 libmaxminddb-dev mmdb-bin geoipupdate


<3>Centos安装
yum install libmaxminddb libmaxminddb-devel mmdb-utils geoipupdate


ngx_http_geoip2_module 安装



用于将MaxMind GeoIP2数据库中的地理位置信息与HTTP请求相关联。它可以在Nginx配置文件中使用,并且提供了一些指令和变量,可以使用这些指令和变量来处理基于地理位置的HTTP请求

$geoip2_city:         解析出的城市名称
$geoip2_country_code: 解析出的国家代码,例如US表示美国
$geoip2_country_name: 解析出的国家名称,例如United States表示美国
$geoip2_latitude:     解析出的纬度,以十进制度数表示
$geoip2_longitude:    解析出的经度,以十进制度数表示
$geoip2_region:       解析出的行政区域名称,例如California表示加利福尼亚州
$geoip2_region_code:  解析出的行政区域代码,例如CA表示加利福尼亚州


wget https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/3.4.tar.gz -O /usr/local/src/ngx_http_geoip2_module-3.4.tar.gz
cd /usr/local/src/
tar -xzf ngx_http_geoip2_module-3.4.tar.gz


GeoLite2 数据库下载



https://dev.maxmind.com/geoip/geoip2/geolite2/

MaxMind 公司要求用户注册并创建帐户才能下载 Geo 数据库。注册过程是免费的,并且没有任何付款要求。但是建议注册的时候使用谷歌等邮箱,并且不要连接VPN或代理,IP所在国家和注册时候填入的国家保持一致。如果被检测为不一致会被认为使用代理,并对该ip封禁一段时间,可以更换其他的IP(网络连接方式),再次进行注册。
(手机号不是必填的,真实信息不泄露,用途随意选择)

GeoIP2数据库包含了有关世界上各个地理位置的信息,如国家、城市、邮政编码、经纬度、时区等等,开发者可以根据IP地址(支持IPv4 和 IPv6), 定位该IP所在的洲、经纬度、国家、省市、ASN 等信息,并将这些地理位置数据与他们的应用程序集成在一起,从而实现更好的用户定位和服务。GeoLite2是GeoIP2的免费版本,与GeoIP2数据库相比准确性较差,但是实际上就像前一篇说的,精度始终不要有太高的期望。



<1>注册
在这里插入图片描述



在这里插入图片描述



在这里插入图片描述



在这里插入图片描述



在这里插入图片描述

成功后,邮箱会收到激活邮件,点击进入并修改密码



<2>创建密钥(用于后面设置自动更新)
https://www.maxmind.com/en/accounts/847212/license-key

在这里插入图片描述



在这里插入图片描述



在这里插入图片描述



在这里插入图片描述

下载配置文件,里面包含秘钥
GeoIP.conf

上传到/etc/下



<3>下载数据库

在这里插入图片描述

or

在这里插入图片描述



在这里插入图片描述
提供各种数据库格式和下载方式。最后要上传到服务器,统一存放,解压即可,无需编译

基本下载:
GeoLite2 City
GeoLite2 Country

mkdir /usr/local/Geoip2
ls  /usr/local/Geoip2/
GeoLite2-Country.mmdb GeoLite2-City.mmdb    

GeoLite2-Country.mmdb仅提供有关IP地址所属国家的信息,包含一个IP地址范围和一个对应的国家代码和英文名称

GeoLite2-City.mmdb则提供了更详细的信息,包括IP地址的精确位置、城市、邮政编码、地理坐标以及其他更详细的地理位置信息

可以根据您的应用程序需要来选择使用哪个数据库。如果只需要知道用户的来源国家,则可以仅使用GeoLite2-Country,如果需要更详细的位置信息(如城市、地区等),则应使用GeoLite2-City



定时更新



<1>修改上传配置文件
添加要更新数据库的位置

cat /etc/GeoIP.conf 

AccountID 841951
LicenseKey 3qvF5fxxxxxxxxxU8_mmk
EditionIDs GeoLite2-City GeoLite2-Country
DatabaseDirectory /usr/local/Geoip2


<2>创建计划任务

crontab -l
0 * * * 6 /usr/bin/geoipupdate > /var/log/geoipupdate.log 2>&1 


测试定位



mmdblookup 命令可指定数据库文件,并通过命令和参数, 查找IP所在位置的相关数据,并以JSON格式输出

<1>mmdblookup --file ./GeoLite2-Country.mmdb --ip 123.123.123.123

  {
    "continent": 
      {
        "code": 
          "AS" <utf8_string>
        "geoname_id": 
          6255147 <uint32>
        "names": 
          {
            "de": 
              "Asien" <utf8_string>
            "en": 
              "Asia" <utf8_string>
            "es": 
              "Asia" <utf8_string>
            "fr": 
              "Asie" <utf8_string>
            "ja": 
              "アジア" <utf8_string>
            "pt-BR": 
              "Ásia" <utf8_string>
            "ru": 
              "Азия" <utf8_string>
            "zh-CN": 
              "亚洲" <utf8_string>
          }
      }
    "country": 
      {
        "geoname_id": 
          1814991 <uint32>
        "iso_code": 
          "CN" <utf8_string>
        "names": 
          {
            "de": 
              "China" <utf8_string>
            "en": 
              "China" <utf8_string>
            "es": 
              "China" <utf8_string>
            "fr": 
              "Chine" <utf8_string>
            "ja": 
              "中国" <utf8_string>
            "pt-BR": 
              "China" <utf8_string>
            "ru": 
              "Китай" <utf8_string>
            "zh-CN": 
              "中国" <utf8_string>
          }
      }
    "registered_country": 
      {
        "geoname_id": 
          1814991 <uint32>
        "iso_code": 
          "CN" <utf8_string>
        "names": 
          {
            "de": 
              "China" <utf8_string>
            "en": 
              "China" <utf8_string>
            "es": 
              "China" <utf8_string>
            "fr": 
              "Chine" <utf8_string>
            "ja": 
              "中国" <utf8_string>
            "pt-BR": 
              "China" <utf8_string>
            "ru": 
              "Китай" <utf8_string>
            "zh-CN": 
              "中国" <utf8_string>
          }
      }
  }



<2>mmdblookup --file ./GeoLite2-City.mmdb --ip 123.123.123.123

  {
    "city": 
      {
        "geoname_id": 
          1816670 <uint32>
        "names": 
          {
            "de": 
              "Beijing" <utf8_string>
            "en": 
              "Beijing" <utf8_string>
            "es": 
              "Pekín" <utf8_string>
            "fr": 
              "Pékin" <utf8_string>
            "ja": 
              "北京市" <utf8_string>
            "pt-BR": 
              "Pequim" <utf8_string>
            "ru": 
              "Пекин" <utf8_string>
            "zh-CN": 
              "北京" <utf8_string>
          }
      }
    "continent": 
      {
        "code": 
          "AS" <utf8_string>
        "geoname_id": 
          6255147 <uint32>
        "names": 
          {
            "de": 
              "Asien" <utf8_string>
            "en": 
              "Asia" <utf8_string>
            "es": 
              "Asia" <utf8_string>
            "fr": 
              "Asie" <utf8_string>
            "ja": 
              "アジア" <utf8_string>
            "pt-BR": 
              "Ásia" <utf8_string>
            "ru": 
              "Азия" <utf8_string>
            "zh-CN": 
              "亚洲" <utf8_string>
          }
      }
    "country": 
      {
        "geoname_id": 
          1814991 <uint32>
        "iso_code": 
          "CN" <utf8_string>
        "names": 
          {
            "de": 
              "China" <utf8_string>
            "en": 
              "China" <utf8_string>
            "es": 
              "China" <utf8_string>
            "fr": 
              "Chine" <utf8_string>
            "ja": 
              "中国" <utf8_string>
            "pt-BR": 
              "China" <utf8_string>
            "ru": 
              "Китай" <utf8_string>
            "zh-CN": 
              "中国" <utf8_string>
          }
      }
    "location": 
      {
        "accuracy_radius": 
          50 <uint16>
        "latitude": 
          39.914300 <double>
        "longitude": 
          116.386100 <double>
        "time_zone": 
          "Asia/Shanghai" <utf8_string>
      }
    "registered_country": 
      {
        "geoname_id": 
          1814991 <uint32>
        "iso_code": 
          "CN" <utf8_string>
        "names": 
          {
            "de": 
              "China" <utf8_string>
            "en": 
              "China" <utf8_string>
            "es": 
              "China" <utf8_string>
            "fr": 
              "Chine" <utf8_string>
            "ja": 
              "中国" <utf8_string>
            "pt-BR": 
              "China" <utf8_string>
            "ru": 
              "Китай" <utf8_string>
            "zh-CN": 
              "中国" <utf8_string>
          }
      }
    "subdivisions": 
      [
        {
          "geoname_id": 
            2038349 <uint32>
          "iso_code": 
            "BJ" <utf8_string>
          "names": 
            {
              "en": 
                "Beijing" <utf8_string>
              "fr": 
                "Municipalité de Pékin" <utf8_string>
              "zh-CN": 
                "北京市" <utf8_string>
            }
        }
      ]
  }



上面获取的参数可用于对nginx的Geoip2模块的设置

多找一些各地的IP进行测试,并和百度,高德以及其他定位api得出的结果进行对比
如果根据geoip2给的经纬度去做地图显示功能是很离谱的

据了解即使是搞外贸的也只是常用国家或地区级别的定位功能和推广功能


安装模块



编译安装可查看前文

<1>编译参数

此次在编译参数末尾加上
--add-dynamic-module=/usr/local/src/ngx_http_geoip2_module-3.4
也可写相对路径这一类
../ngx_http_geoip2_module-3.4

由于每个人环境不同,如编译时遇到报错,根据自己报错解决问题或安装依赖
可以直接安装前文中的依赖包



<2>make编译后拷贝生成的文件到自己配置文件指定的modules目录

cd objs/
cp -r objs/ngx_http_geoip2_module.so /usr/share/nginx/modules/
cp -r objs/ngx_stream_geoip2_module.so  /usr/share/nginx/modules/

根据直接情况决定,是要平滑升级还能直接更换
cp -r objs/nginx  /usr/sbin/nginx


应用场景



有些人的服务器放到了国外,客户仅仅只是某些国家,而要禁止其他国家访问,可以减少流量和攻击

有些搞人外贸的,给不同国家的用户,展示不同的页面和报价



重点



加载Geoip2 模块动态链接库



load_module modules/ngx_http_geoip2_module.so;
load_module modules/ngx_stream_geoip2_module.so;

events {
    worker_connections 102400;
}


必须在events之前


仅限中国访问,国外禁止



<1>http块设置

http {

....

geoip2 /usr/local/Geoip2/GeoLite2-Country.mmdb {
  $geoip2_data_country_code country iso_code;
}

map $geoip2_data_country_code $allowed_country {
    CN yes;      #中国
    TW yes;      #中国台湾
    HK yes;      #中国香港
    MO yes;      #中国澳门
    default no;
  } 

...
} 

GeoIP2模块存在着很多变量,会根据设置的匹配规则,将该变量设置为匹配的值。并且只有引入的变量才可被使用,例如要做IP地址解析服务,需要配置城市,经纬度等变量

由于这里只演示国家级别配置,只配置了Country数据库,引入geoip2_data_country_code这一变量
$geoip2_data_country_code  变量包含客户端IP地址所属的国家的ISO代码。它与geoip2_data_country不同,因为它返回的是国家的ISO代码而不是国家名称,后面可根据IP解析出的ISO代码判断其国家


map                         用于定义映射表,它需要两个参数:源变量和目标变量
$geoip2_data_country_code   作为源变量,它表示客户端IP地址所属的国家的ISO代码
$allowed_country            作为目标变量,它将在映射表中查找匹配项,并返回相应的值
default no;                 这是默认值,意思是如果没有匹配到任何条目,则将$allowed_country设置为“no”
CN yes;                     是告知Nginx如果客户端IP地址所属的国家代码是CN(中国),则将$allowed_country设置为“yes”

<2>server或location块配置
根据需求放到server或location


location /sheying/ {

  if ($allowed_country != yes ) {
  #or
  #if ($allowed_country = no) {
    return 403 
  }
   root /usr/share/nginx/sheying/;
   index  index.html; 
  }




如果变量$allowed_country不等于yes(或等于no),将返回HTTP状态码403,禁止访问


仅限中国访问,但放开国外部分IP



<1>http块设置

http  {

....

geoip2 /usr/local/Geoip2/GeoLite2-Country.mmdb {
  $geoip2_data_country_code country iso_code;
}


#map也可放到server里
map $geoip2_data_country_code $allowed_country {
    default no;
    CN yes;
}


# 指定放开的外国IP地址
map $remote_addr $is_foreign {
    default 1; 
    192.168.0.0/16 0;   # 指定局域网内的 IP 地址不被拒绝
    10.0.0.0/8 0;       # 指定局域网内的 IP 地址不被拒绝
    172.16.0.0/12 0;    # 指定局域网内的 IP 地址不被拒绝
    12.12.12.12 0;      # 允许特定外国IP地址或网段或ipv6或ipv6网段访问
    104.16.0.0/13;      # 允许特定外国IP地址或网段或ipv6或ipv6网段访问
}


....
}




<2>server或location块配置
根据需求放到server或location


location /sheying/ {

    if ($allowed_country = no) {
        if ($is_foreign) {
   			root /usr/share/nginx/sheying/;
  			index  index.html; 
        } else {
            return 403;
        }
    }




or
lua方法

location /sheying/ {
     access_by_lua_block {
        if ngx.var.allowed_country == "yes" or ngx.var.is_foreign == "yes" then
        	 ngx.exec('/usr/share/nginx/sheying/index.html')
        end
        return ngx.exit(ngx.HTTP_FORBIDDEN)
        }
    }


不同国家展示不同页面



静态页面



<1>http配置

geoip2 /usr/local/Geoip2/GeoLite2-Country.mmdb {
  $geoip2_data_country_code country iso_code;
}

map $geoip2_data_country_code $country_page {
    default /pay/defa; 
    CN /pay/cn;
    US /pay/us;
    JP /pay/jp;
}



<2>server或location配置


location /pay/ {
        root /usr/share/nginx/html/;
        index index.html;
}


一个日本ip访问https://xx.xx.xx.xxx/pay/
会跳转到https://xx.xx.xx.xxx/pay/jp/
重定向的本地路径应该是/usr/share/nginx/html/pay/jp/index.html

因为map配置路径为/pay/jp,root目录为/usr/share/nginx/html/,所以只有当日本用户请求的路径为https://xxx.xxx.x.xx/pay时,才会跳转到/usr/share/nginx/html/pay/jp/。请求为https://xx.xx.xx.xxx/下的其他路径不受影响



也可以按照前几个场景中的map配置,不在map中匹配路径。只在server或location中用if判断不同国家或城市走不同的路径

location /pay/ {
       if ($allowed_country = CN) {
        root /usr/share/nginx/html/pay/cn/;
        index index.html; 
       }
        if ($allowed_country = JP) {
        root /usr/share/nginx/html/pay/jp/;
        index index.html; 
       }
        
}


反向代理



<1>http配置
geoip2 /usr/local/Geoip2/GeoLite2-Country.mmdb {
  $geoip2_data_country_code country iso_code;
}

#upstream可以另写配置文件,然后include
upstream tomcat_cn {
   server 192.168.1.1:8080;
   server 192.168.1.2:8080;
 }
upstream tomcat_us {
   server 192.168.1.1:8081;
   server 192.168.1.2:8081;
 }

map $geoip2_data_country_code $country_page {
   default tomcat_cn;
   CN tomcat_cn;
   US tomcat_us;
}
<2>server或location配置

location /pay {
   proxy_pass http://$country_page/pay/;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}


IP地址解析



做一个类似ip-api.com的ip地址解析网站



http {
  .....
  geoip2 /usr/local/Geoip2/GeoLite2-Country.mmdb {
    auto_reload 7d;
    $geoip2_country_code country names en;
  }

  geoip2 /usr/local/Geoip2/GeoLite2-City.mmdb {
    $geoip2_data_country "default=中国" source=$remote_addr country names zh-CN;
    $geoip2_data_country_code country iso_code;               
    $geoip2_data_country_continent continent names zh-CN;       
    $geoip2_data_country_continent_code continent code;         
    $geoip2_data_province_name subdivisions 0 names zh-CN;      
    $geoip2_data_province_isocode subdivisions 0 names iso_code;
    $geoip2_data_city city names zh-CN;                        
    $geoip2_data_city_longitude location longitude;            
    $geoip2_data_city_latitude location latitude;              
    $geoip2_data_city_time_zone location time_zone;          


    $geoip2_data_country_en "default=United States" source=$remote_addr country names en; 
    $geoip2_data_country_code country iso_code;                  
    $geoip2_data_country_continent_en continent names en;          
    $geoip2_data_country_continent_code continent code;            
    $geoip2_data_province_name_en subdivisions 0 names en;          
    $geoip2_data_province_isocode subdivisions 0 names iso_code;   
    $geoip2_data_city city names en;                                
    $geoip2_data_city_longitude location longitude;             
    $geoip2_data_city_latitude location latitude;                
    $geoip2_data_city_time_zone location time_zone;           
  }
  ....

  map $geoip2_data_country_code $allowed_country {
    CN yes;
    TW yes;
    HK yes;
    MO yes;
    default no;
  }

} 

上面的配置是:中国的IP访问,返回的值是中文格式;中国以外的IP访问,返回的值是英文格式


$geoip2_data_country变量      指包含客户端IP地址所属的国家名称 (names en是英文格式;names zh-CN是中文格式)
defaults                     指如果无法从GeoIP2数据库中获取到客户端IP地址所在国家信息,则将此变量的值设置为"中国"
source=$http_x_forwarded_for 指将变量$geoip2_data_country的源设置为请求头中的X-Forwarded-For字段.这个字段通常用于代理服务器之间传递客户端IP地址信息,最常使用的是remote_addr,但是如果有特殊需要或者要获取真实IP,可写入自己配置的真实IP变量或者第三方提供nginx变量
country names                指定义输出格式,表示返回国家的名称的格式



    location = /ip-api/ { 
       if ( $geoip2_data_country_code ~* (CN|TW|HK|MO) ){
    	  rewrite (.*)  /ip-api/cn last;
    	}
          rewrite (.*) /ip-api/en last;

    }  
      
      location /ip-api/cn {
      default_type application/json;
      return 200 '{"current_ip":"$http_cf_connecting_ip","country":{"name": "$geoip2_data_country", "iso_code":  "$geoip2_data_country_code", "continent": "$geoip2_data_country_continent","continent_code": "$geoip2_data_country_continent_code"},"province":{"name":"$geoip2_data_province_name","iso_code":"$geoip2_data_province_isocode"},"city":{"name":"$geoip2_data_city","timezone":"$geoip2_data_city_time_zone"},"location":{"longitude":"$geoip2_data_city_longitude","latitude":"$geoip2_data_city_latitude"}}';
    }
      location /ip-api/en {
      default_type application/json;
      return 200 '{"current_ip":"$http_cf_connecting_ip","country":{"name": "$geoip2_data_country_en", "iso_code":  "$geoip2_data_country_code", "continent": "$geoip2_data_country_continent_en","continent_code": "$geoip2_data_country_continent_code"},"province":{"name":"$geoip2_data_province_name_en","iso_code":"$geoip2_data_province_isocode"},"city":{"name":"$geoip2_data_city","timezone":"$geoip2_data_city_time_zone"},"location":{"longitude":"$geoip2_data_city_longitude","latitude":"$geoip2_data_city_latitude"}}';
    }
   

curl http://xx.xx.xx.xx/ip-api  即可显示当前ip的解析


总结



从上面的演示场景中,应该可以看到Geoip2的基本用法。如果要限制城市或有其他需求,可以根据自己的实际需求,进行修改和配置。

通过测试Geoip2,我发现虽然它提供了定位的各种参数,但对于在中国的城市级别的定位精度存在问题。因此,如果您需要做城市级别的访问限制,要仔细考虑是否适用。不过,对于根据需求给不同国家或地区,展示不同页面或功能或推广来说,GeoIP2仍然是个好选择。



本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/430929.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

我好像发现了PMP通关密码,这14页纸直接背!

备考PMP的宝子们一定要用上这份通关口诀哦&#xff01; 一周就能背完的PMP考试技巧只有14页纸&#xff0c;共分成了4大模块&#xff0c;完全不用担心看不懂&#xff0c;需要的朋友可以戳下面的卡片在群文件下载&#xff0c;直接打印出来就能背哦&#xff0c;没有任何套路&…

Java每日一练(20230415)

目录 1. 扰乱字符串 &#x1f31f;&#x1f31f;&#x1f31f; 2. 单词拆分 &#x1f31f;&#x1f31f; 3. 模拟计算器 ※ &#x1f31f; 每日一练刷题专栏 &#x1f31f; Golang每日一练 专栏 Python每日一练 专栏 C/C每日一练 专栏 Java每日一练 专栏 1. 扰乱字符…

Improved Knowledge Distillation via Teacher Assistant小陈读paper系列

算是经典了吧哈哈 1.他们发现了学生性能下降了&#xff0c;什么时候呢&#xff1f;就是老师模型和学生模型差的太多的时候有了很大gap&#xff08;一个学生不能请一个维度跨越巨大的老师&#xff09;&#xff08;老师可以有效地将其知识转移到一定大小的学生&#xff0c;而不是…

Java导入导出

目录前端Apache POI引依赖导入导出工具类EasyExcel引依赖读Excel指定列名多个Sheet使用提供的转换器或自定义格式转换器对读取到的数据进行格式转换行头即列名写Excel指定导出列复杂头写入日期、数字或自定义格式转换对导出数据进行处理自定义样式合并单元格动态列表头自定义拦…

关于el-input-number 计数器 只能点击一次,之后点击没有效果

哈喽 大家好啊&#xff0c;今天使用计数器发现&#xff0c;点击一次了后就显示不了了 这里怎么点击都点击不了&#xff0c;只能点击一次 然后我发现我代码是这样写的&#xff1a; gitem是一个对象 gitem.saleNum gitem.reduceQuantity || 1;// 剩余可以编辑的数量 因为我这…

【SSL】ssl证书简介、ssl证书生成工具与ssl证书生成步骤

ssl证书简介、ssl证书生成工具与ssl证书生成步骤一、ssl证书是什么&#xff1f;二、ssl证书生成工具有哪些&#xff1f;2.1、工具一&#xff1a;CFSSL2.2、工具二&#xff1a;OpenSSL2.3、工具三&#xff1a;XCA三、ssl证书有什么用&#xff1f;四、ssl证书生成步骤4.1 步骤1&a…

01-SpringBoot入门应用

入门程序&#xff1a;使用SpringBoot开发一个web应用&#xff0c;浏览器发起请求/hello后&#xff0c;给浏览器返回字符串“Hello World ~” 1. 创建springboot工程&#xff0c;并勾选web开发相关依赖 由于我的idea没有Spring Initializr选项&#xff0c;所以我选择使用Maven…

ChatGPT常见术语清单;大厂ChatGPT混战汇总;提示工程技巧完全指南(中译);真机会VS假机会 | ShowMeAI日报

&#x1f440;日报&周刊合集 | &#x1f3a1;生产力工具与行业应用大全 | &#x1f9e1; 点赞关注评论拜托啦&#xff01; &#x1f916; 『OpenAI/ChatGPT 高频常见词解释清单』一份速查表搞懂最热门 AI 术语 OpenAI 和 ChatGPT 的爆火&#xff0c;以超高的频率将大量AI术…

ISE的仿真库编译步骤

Modelsim10.4与ISE14.7联合仿真 1、指定modelsim的安装位置 2、编译安装仿真库 &#xff08;1&#xff09;编译仿真库 点击“开始菜单 -> Xilinx ISE Design Suite 13.2 -> ISE Design Tools -> 64-bit Tools -> Simulation Library Compilation Wizard”&#xff…

Node 会话控制

文章目录Node 会话控制概述cookie运行流程设置cookie获取cookie删除cookiesession运行流程设置session获取session删除sessionsession和cookie的区别token运行流程JWT创建token校验tokenNode 会话控制 概述 所谓会话控制就是 对会话进行控制。 HTTP 是一种无状态的协议&…

DAY 38 LINUX iptables防火墙

所谓防火墙也称之为防护墙&#xff0c;它是一种位于内部网络与外部网络之间的网络安全系统。一项信息安全的防护系统。按照给定的规则&#xff0c;允许或者限制网络报文通过 硬件防⽕墙&#xff1a;通过硬件和软件的组合&#xff0c;基于硬件的防⽕墙保护整个内部网络安全。&a…

如何使用Win10搭建我的世界Minecraft服务器

简单几步在windwos搭建我的世界服务器,并通过cpolar工具将本地服务暴露到公网连接 1. Java环境搭建 以windows10系统为例&#xff0c;配置java环境&#xff0c;搭建我的世界服务器,下载最新版java版本 Java Downloads | Oracle 选择exe文件&#xff0c;下载完成后双击安装包…

JVM程序计数器到底存储的是当前执行的指令地址,还是下一条指令的地址

JVM程序计数器到底存储的是当前执行的指令地址&#xff0c;还是下一条指令的地址&#xff1f; 说法一&#xff1a;chatgpt 程序计数器&#xff08;Program Counter&#xff0c;PC&#xff09;存储的是下一条指令的地址。在CPU执行指令时&#xff0c;程序计数器始终跟踪着当前已…

【机器人仿真Webots教程】-Webots安装

Webots安装 文章目录Webots安装1. Webots简介2. Webots安装2.1 系统要求2.2 验证显卡驱动2.3 安装3. Webots仿真3.1 world文件3.2 Controller文件3.3 Supervisor Controller4. 启动方式1. Webots简介 webots是一个开源3D移动机器人仿真框架。其为Cyberbotics公司旗下研发开源框…

Fastjson反序列化漏洞复现(实战案例)

本文转载于&#xff1a;https://blog.csdn.net/jinzezhi/article/details/124274123 漏洞介绍 FastJson在解析json的过程中&#xff0c;支持使用autoType来实例化某一个具体的类&#xff0c;并调用该类的set/get方法来访问属性。通过查找代码中相关的方法&#xff0c;即可构造出…

【Python_Opencv图像处理框架】图像基本操作+90bb5729-b33a-4e82-a0d9-faa3e5cbf621

写在前面 很幸运能选择Python语言进行学习&#xff0c;这是有关Opencv的图像处理的第一篇文章&#xff0c;讲解了有关图像处理的一些基础操作&#xff0c;作为初学者&#xff0c;我尽己所能&#xff0c;但仍会存在疏漏的地方&#xff0c;希望各位看官不吝指正❤️ 写在中间 1…

unity物体运动经过特定点并绘出轨迹

经过线如果有圆滑可以参考 Unity物体运动时画出轨迹_天人合一peng的博客-CSDN博客 并修改里面的数值轨迹会有变化 float angle Mathf.Min(1, Vector3.Distance(this.transform.position, targetPos) / distanceToTarget) * 45; this.transform.rotation this.t…

App灰度发布实现路径之小程序容器

灰度从字面意思理解就是存在于黑与白之间的一个平滑过渡的区域&#xff0c;所以说对于互联网产品来说&#xff0c;上线和未上线就是黑与白之分&#xff0c;而实现未上线功能平稳过渡的一种方式就叫做灰度发布。 灰度发布将新版本应用程序推送给一部分用户进行测试和反馈的过程…

7、ThingsBoard使用docker compose集群部署

1、概述 今天我将讲解官方文档说的使用docker compose集群部署ThingsBoard,这种部署方式也是目前企业中常用的形式,希望大家能够掌握,我不是直接使用官方的镜像,我是自己拉起代码,然后自己构建镜像,在传到服务器上,使用自己的镜像来部署。而且这种部署中间有个大坑,我…

【大数据Hadoop】HDFS3.3.1-Namenode-缓存管理

缓存管理前言缓存概念HDFS 集中式缓存有两个主要概念。缓存管理命令HDFS 集中式缓存架构CacheManager 类实现CacheReplicationMonitor前言 Hadoop 2.3.0 版本新增了集中式缓存管理&#xff08;Centralized Cache Management&#xff09;功能&#xff0c;允许用户将一些文件和目…