Giter Club home page Giter Club logo

loyalsoldier / geoip Goto Github PK

View Code? Open in Web Editor NEW
3.3K 3.3K 586.0 21.7 MB

🌚 🌍 🌝 GeoIP 规则文件加强版,同时支持定制 V2Ray dat 格式路由规则文件 geoip.dat 和 MaxMind mmdb 格式文件 Country.mmdb。Enhanced edition of GeoIP files for V2Ray, Xray-core, Clash, Trojan-Go, Leaf and Hysteria, with replaced CN IPv4 CIDR available from ipip.net, appended CIDR lists and more.

License: Creative Commons Attribution Share Alike 4.0 International

Go 98.64% Shell 1.36%
anticensorship chinalist clash geoip gfw ipip ipipnet ipv4 ipv4-address ipv6 ipv6-address leaf maxmind-geoip proxy routing trojan-go v2ray xray

geoip's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geoip's Issues

定制`Country.mmdb`增加自己IP到HK,本地生成,结果仍归属于CN

生成流程

config.json(我将自定义的放在了input列表最后):

{
  "input": [
    {
      "type": "maxmindGeoLite2CountryCSV",
      "action": "add",
      "args": {
        "country": "./geolite2/GeoLite2-Country-Locations-en.csv",
        "ipv4": "./geolite2/GeoLite2-Country-Blocks-IPv4.csv",
        "ipv6": "./geolite2/GeoLite2-Country-Blocks-IPv6.csv"
      }
    },
    {
      "type": "cutter",
      "action": "remove",
      "args": {
        "wantedList": ["cn"],
        "onlyIPType": "ipv4"
      }
    },
    {
      "type": "text",
      "action": "add",
      "args": {
        "name": "cn",
        "uri": "https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt",
        "onlyIPType": "ipv4"
      }
    },
    {
      "type": "text",
      "action": "add",
      "args": {
        "name": "cn",
        "uri": "https://raw.githubusercontent.com/gaoyifan/china-operator-ip/ip-lists/china.txt",
        "onlyIPType": "ipv4"
      }
    },
    {
      "type": "text",
      "action": "add",
      "args": {
        "name": "cn",
        "uri": "https://raw.githubusercontent.com/gaoyifan/china-operator-ip/ip-lists/china6.txt",
        "onlyIPType": "ipv6"
      }
    },
    {
      "type": "text",
      "action": "add",
      "args": {
        "name": "cloudflare",
        "uri": "https://www.cloudflare.com/ips-v4"
      }
    },
    {
      "type": "text",
      "action": "add",
      "args": {
        "name": "cloudflare",
        "uri": "https://www.cloudflare.com/ips-v6"
      }
    },
    {
      "type": "text",
      "action": "add",
      "args": {
        "name": "telegram",
        "uri": "https://core.telegram.org/resources/cidr.txt"
      }
    },
    {
      "type": "private",
      "action": "add"
    },
    {
      "type": "text",
      "action": "add",
      "args": {
        "name": "hk",
        "uri": "geo/hk.txt"
      }
    }
  ],
  "output": [
    {
      "type": "maxmindMMDB",
      "action": "output",
      "args": {
        "outputName": "Country.mmdb",
        "overwriteList": [
          "hk"
        ]
      }
    },
    {
      "type": "text",
      "action": "output"
    }
  ]
}

geo/hk.txt:

43.198.178.151/32

生成log:

2023/08/14 02:03:00 ✅ [maxmindMMDB] Country.mmdb --> output\maxmind
2023/08/14 02:03:00 ✅ [text] hm.txt --> output\text
2023/08/14 02:03:00 ✅ [text] bj.txt --> output\text
……

测试流程

复制 output/maxmind/Country.mmdbC:\%userprofile%\.config\clash\

重启CFW。

使用 CFW Script Test 功能(基于 Clash Premium Script),对添加的IP进行测试。

代码:

def main(ctx, metadata):
  region = ctx.geoip(metadata["host"])
  return region

仍然返回CN:

image

请问如何增加自定义IP段的相关操作?

我想增加关于SpeedTest的代理IP段,但是在Config.json看不懂是如何定义一个IP段的,除了cn的那个url。
最终我在asn.csv文件里找到了关于您添加的AS字段,例如Twitter的“twitter,AS8945|AS54888|AS35995|AS13414”
请问我要如何添加和寻找Speedtest相关的测速节点IP段呢?

为什么已有mmdb但用不了

[root@localhost ~]# ./clash-linux-amd64-v1.10.0 -f Country.mmdb
INFO[0000] Can't find MMDB, start download
[root@localhost ~]# ls
公共 视频 文档 音乐 clash-linux-amd64-v1.10.0 index.html PixivBiu prometheus.yml
模板 图片 下载 桌面 Country.mmdb node_exporter-1.3.1.linux-amd64 prometheus-2.34.0.linux-amd64

getting HTTP 500 status code while fetching assets on the ripe.net

[user@xxx ~]# asn=AS55095 && curl -vIL "https://stat.ripe.net/data/ris-prefixes/data.json?list_prefixes=true&types=o&resource=${asn}"
*   Trying 193.0.6.150:443...
*   Trying 2001:67c:2e8:22::c100:696:443...
* Immediate connect fail for 2001:67c:2e8:22::c100:696: Network is unreachable
* Connected to stat.ripe.net (193.0.6.150) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/pki/tls/certs/ca-bundle.crt
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=stat.ripe.net
*  start date: Dec  9 05:09:16 2022 GMT
*  expire date: Mar  9 05:09:15 2023 GMT
*  subjectAltName: host "stat.ripe.net" matched cert's "stat.ripe.net"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Unknown (23):
* TLSv1.2 (OUT), TLS header, Unknown (23):
* TLSv1.2 (OUT), TLS header, Unknown (23):
* Using Stream ID: 1 (easy handle 0x588e70e45560)
* TLSv1.2 (OUT), TLS header, Unknown (23):
> HEAD /data/ris-prefixes/data.json?list_prefixes=true&types=o&resource=AS55095 HTTP/2
> Host: stat.ripe.net
> user-agent: curl/7.76.1
> accept: */*
>
* TLSv1.2 (IN), TLS header, Unknown (23):
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
* TLSv1.2 (OUT), TLS header, Unknown (23):
* TLSv1.2 (IN), TLS header, Unknown (23):
* TLSv1.2 (IN), TLS header, Unknown (23):
< HTTP/2 500
HTTP/2 500
< server: nginx
server: nginx
< date: Sat, 31 Dec 2022 06:11:25 GMT
date: Sat, 31 Dec 2022 06:11:25 GMT
< content-type: application/json; charset=utf-8
content-type: application/json; charset=utf-8
< content-length: 652
content-length: 652
< vary: Cookie, Accept-Encoding
vary: Cookie, Accept-Encoding
< access-control-allow-origin: *
access-control-allow-origin: *

<
* Connection #0 to host stat.ripe.net left intact

size of geoip too big

Hey, I am forking your repo and running the built in workflow but until yesterday the geoip file was around 5 mb but now its 46 mb. I tried deleting the repo and starting from scratch but still the size of generated file is 46mb.

https://github.com/t-e-s-tweb/geoip/releases/tag/202107280149

And its apparently happening to every body. I searched on other repos and this is what I found

https://github.com/URARUA/geoip/releases/tag/202107271336

https://github.com/IceCodeNew/geoip/releases/tag/202107270351

✨ 激赏 | Donation ✨

通过比特币激励我创作|Buy me a coffee by BTC:

  • 比特币(BTC)bech32 地址:bc1qfe4nxcanet4w4ph8pf6qqyf263y68vw26nv9j9
  • 比特币(BTC)地址:3PRyneb1D7jFFBakAaJiCRSsxsXAtMr7LN

IPv6也存在HK被放到CN分类下的问题

这个列表 https://github.com/Loyalsoldier/geoip/blob/release/text/cn.txt

包含了 2405:f3c0::/48 然而这个段是HK的。对比下maxmind的geolite2,应该是maxmind库不准的问题。
HK只包含了 2405:f3c0:1:55b0::/64 2405:f3c0:1:7a9d::/64
虽然可以fork自己改,不过为了方便一般用户能否官方生成v6时候不使用 GeoLite2 这个库呢?

(少开一个issue,geosite也有把tiktok相关域名全算到CN的问题。但是tiktok不是抖音,不应该算到CN下吧。

CloudFront有IPv6地址,但release/text里没有

根据 CloudFront 邊緣伺服器的位置和 IP 地址範圍 提到的网址 ip-ranges.json 我搜到包含"service": "CLOUDFRONT"的IPv6地址

    {
      "ipv6_prefix": "2600:9000:3000::/36",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2600:9000:ddd::/48",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2600:9000:5300::/40",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2600:9000:1000::/36",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2600:9000:2000::/36",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2400:7fc0:500::/40",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2600:9000:4000::/36",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2600:9000:fff::/48",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2404:c2c0:500::/40",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2600:9000:f000::/36",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },
    {
      "ipv6_prefix": "2600:9000:eee::/48",
      "region": "GLOBAL",
      "service": "CLOUDFRONT",
      "network_border_group": "GLOBAL"
    },

geoip:yahoo

Hi. Is it possible to add a geoip category for Yahoo, say geoip:yahoo? Thanks.

ipip国内数据

在本地怎么打 包含ipip.net的数据 release分支里面没有源文件

Remove 51IDC IP CIDR from geoip:cn

Some of the IPs they use, such as 118.184.78.78, are being used as polluted IPs by the public DNS in China.

Besttrace thinks it's a HK IP, some projects believe it is in line with geoip:cn.

Meanwhile, using HE's BGP tool, you can see that it is in both AS137443(HK) and AS58879(CN).

Although the probability of being polluted to this service provider's IP is low, it is not zero, so I would like to temporarily exclude the HK IP segment of this service provider

请问CLI是否支持手动查询匹配site或者ip是否在库

您好,我的xray项目使用了您的geosite和geoip库,但是我按照规范设置了一些rule之后,我发现有一些网站不是我想屏蔽的,但是我不知道如何查询目标网站是匹配中了geosite或者gepip的哪一个库,请问是否有方法可以手动进行查询并给出匹配中的库或者规则,我想象中它的功能可能像这个样子:

root:~$ ./geoip -f www.netflix.com
`www.netflix.com` >> geosite: Netflix
root:~$ ./geoip -f 223.5.5.5
`223.5.5.5` >> geoip: CN

如有冒犯,敬请海涵。

在 config.json 文件中配置 IP 源,但源中不能有以“::”开头的 IP 段

比如在 config.json 里添加含有 IP 段的源:

::ffff:198.18.5.138/128
::ffff:198.18.6.81/128
::ffff:198.18.6.83/128

在运行 GitHub Actions 时会报错,报错信息如下:

2023/08/12 04:00:10 AddPrefix(1[9](https://github.com/DustinWin/clash-geoip/actions/runs/5839247439/job/15837200252#step:11:10)8.18.5.138/-1) @ /home/runner/work/clash-geoip/clash-geoip/lib/lib.go:214 /home/runner/work/clash-geoip/clash-geoip/lib/lib.go:252 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/common_in.go:47 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/common_in.go:26 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/text_in.go:194 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/text_in.go:88 /home/runner/work/clash-geoip/clash-geoip/lib/instance.go:60 /home/runner/work/clash-geoip/clash-geoip/main.go:38 /opt/hostedtoolcache/go/1.19.12/x64/src/runtime/proc.go:250; AddPrefix(198.18.6.81/-1) @ /home/runner/work/clash-geoip/clash-geoip/lib/lib.go:214 /home/runner/work/clash-geoip/clash-geoip/lib/lib.go:252 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/common_in.go:47 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/common_in.go:26 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/text_in.go:194 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/text_in.go:88 /home/runner/work/clash-geoip/clash-geoip/lib/instance.go:60 /home/runner/work/clash-geoip/clash-geoip/main.go:38 /opt/hostedtoolcache/go/1.19.12/x64/src/runtime/proc.go:250; AddPrefix(198.18.6.83/-1) @ /home/runner/work/clash-geoip/clash-geoip/lib/lib.go:214 /home/runner/work/clash-geoip/clash-geoip/lib/lib.go:252 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/common_in.go:47 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/common_in.go:26 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/text_in.go:194 /home/runner/work/clash-geoip/clash-geoip/plugin/plaintext/text_in.go:88 /home/runner/work/clash-geoip/clash-geoip/lib/instance.go:60 /home/runner/work/clash-geoip/clash-geoip/main.go:38 /opt/hostedtoolcache/go/1.19.12/x64/src/runtime/proc.go:250
exit status 1
Error: Process completed with exit code 1.

202208180147 country not found in geoip.dat: facebook

最新 202208180147 有以下error

infra/conf/rule: invalid field rule > infra/conf/rule: failed to load geoip: facebook > infra/conf/geodata/standard: country not found in geoip.dat: facebook

前一个 202208110813 也运作正常, 没这个error

安卓TV Netflix 被检测到代理

设备时 amazon 的 火棒,用的 v2fly 中转 Netflix 请求,正常观看一会儿,就会弹出检测到VPN。

// 中转机 routing 配置
"routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "outboundTag": "vless_netflix_transport",
        "domains": ["geosite:netflix", "geosite:disney", "geosite:twitch", "domain:ip.gs"]
      },
      {
        "type": "field",
        "outboundTag": "vless_netflix_transport",
        // 想要使用 geoip:netflix 需要更换第三方 geoip
        // https://github.com/Loyalsoldier/geoip
        "ip": ["geoip:netflix"]
      },
      {
        "type": "field",
        "network": "tcp,udp",
        "outboundTag": "freedom" // 默认直连
      }
    ]
  }

明明已经配置好了 geosite 和 geoip, 但看上一两集非自制剧,就会提示检测到VPN。
强制结束Netflix,再重新打开就又能看几集。
感觉像是IP段没有覆盖完全。

另外我搜了网友说的,比如会发送DNS请求给 netflix ,而dns请求没有经过中转机中转,所以会被检测到。
或者说 NETFLIX有使用AWS的服务器,所以 amazonaws.com 也需要加入中转规则,
大佬您怎么看?可能是哪里的问题?
客户端使用的 ClashForAndroid 最新版。

ipip.net 使用新的tag

背景

现在的数据,CN 的 IP 数据被直接替换为 ipip.net, 但是这个也不是100%准确的

比如 202.111.33.236 这个 IP 地址查到是江苏电信的,在 maxmind 数据库中属于 CN, 但是不在 ipip.net

数据对比

https://www.diffchecker.com/sfir57f0
image

需求

所以是否可以把 ipip.net 做一个单独打 tag,如 cn-ipip,原始数据保留,这样可以让用户自己选择使用哪个数据库,甚至可以使用2个数据库,取并集

geolocation

i config v2ray server in hetzner. after 2week, google find my real location and i get 403 forbidden in all service like docker and other google. how can i prevent exposed my real geo location.

i dont have dns leak.

关于Geo资源文件

Geo资源文件(包括geoip.dat和geosite.dat)是否支持V2rayNG,并在其中添加成订阅源一样方便更新?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.