GithubHelp home page GithubHelp logo

iyuuproxy's Introduction

iyuu目前已使用香港轻量云做转发。将更新IYUUPlus代码,全量生效。不用再折腾此方法啦。

docker容器本地自签证书反代iyuu使用例

思路就是,本地自签证书,nginx反代做假域名,hosts指向反代ip将发起的iyuu域名请求转发至源ip。

方法不一定要用docker,可自行变通。本人只在ubuntu环境下测试过。

配置和证书都已经有了,其他环境有问题的,请麻烦自行解决,或者另行方法。

创建反代容器:

容器互相访问,可不开放443端口。以免与其他应用冲突。

如需在局域网内其他设备使用,如macvlan容器、win电脑等,则需要开端口。修改compose文件注释即可。

git clone https://github.com/AisukaYuki/iyuuproxy.git
cd ./iyuuproxy
#运行iyuuproxy容器
docker-compose up -d
#查看ip命令,也可在各docker管理器查看
docker inspect iyuuproxy | grep IPAddress 
shell输出:
 "SecondaryIPAddresses": null,
 "IPAddress": "",
    "IPAddress": "172.29.0.2",

如上ip为 172.29.0.2,测试是否生效:

注:如果开启了443端口映射,则可以直接使用宿主ip。
curl -k --resolve 'api.iyuu.cn:443:172.29.0.2' https://api.iyuu.cn

#返回json内容则成功
{"ret":200,"data":{"title":"Welcome IYUU","time":1705208847,"ip":"192.168.0.1","userAgent":"curl\/7.81.0","group":"QQ群:859882209, 931954050, 924099912, 586608623"},"msg":"","version":"2.0.0"}

使用方法:以iyuuplus为例

修改iyuuplus的compose文件添加extra_hosts参数后重建,如:

version: '3.4'
   services:
     iyuuplus:
      container_name: iyuuplus
      image: iyuucn/iyuuplus:latest
      extra_hosts: 
        - "api.iyuu.cn:172.29.0.2"
      ports:
        - 8787:8787
      volumes:
        - ./db:/IYUU/db
      restart: unless-stopped

或修改容器内 /etc/hosts 添加172.29.0.2 api.iyuu.cn

docker exec -it <容器ID或容器名称> /bin/sh -c 'echo "172.29.0.2 api.iyuu.cn" >> /etc/hosts'
#此方法容器重启后需要重新执行,建议添加外部挂载文件替换容器的/etc/hosts。重启容器不会失效。

当然你也可以直接修改宿主hosts文件,路由劫持DNS,总之方法很多。

其他容器操作同理

一般来说,无需导入证书信任,添加完hosts,iyuu登录和mp认证即可正常工作。

如果有特殊情况无法工作,可尝试导入证书,并添加信任。
docker cp ./iyuu.crt <容器ID或容器名称>:/usr/local/share/ca-certificates/iyuu.crt
docker exec -it <容器ID或容器名称> /bin/sh -c 'update-ca-certificates'

恢复则修改compose或hosts文件,删除添加的内容,重建或重启。

iyuuproxy's People

Contributors

aisukayuki avatar

Stargazers

c-3po avatar  avatar  avatar https://github.com/settings/admin avatar  avatar RACOWCOW avatar behinder85 avatar  avatar 冷曦 avatar  avatar Xiebro avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.