文档说明: 只记录关键的地方; 发布时间: 2022-08-11
环境: debian 11 docker
状态: 已完成
备注:
一句命令即可使用准备好的服务
使用代理方式一:
| |
| socat -d -d TCP4-LISTEN:8016,reuseaddr,fork ssl:http-proxy.xiaoshuogeng.com:8017,verify=1,snihost=http-proxy.xiaoshuogeng.com,commonname=http-proxy.xiaoshuogeng.com,openssl-min-proto-version=TLS1.3,openssl-max-proto-version=TLS1.3 |
| |
| |
| |
| |
| |
| |
使用代理方式二:
| version: "3" |
| services: |
| socat-http-proxy-8016: |
| image: registry.cn-beijing.aliyuncs.com/jingjingxyk-public/app:socat-alpine-20221018T1839Z |
| restart: always |
| container_name: socat-http-proxy-8016 |
| ports: |
| - "8016:8016" |
| command: |
| - /bin/sh |
| - -c |
| - | |
| socat -d -d TCP4-LISTEN:8016,reuseaddr,fork ssl:http-proxy.xiaoshuogeng.com:8017,verify=1,snihost=http-proxy.xiaoshuogeng.com,commonname=http-proxy.xiaoshuogeng.com,openssl-min-proto-version=TLS1.3,openssl-max-proto-version=TLS1.3 |
| |
| |
| # 启动 |
| docker-compose -f docker-compose.yaml up -d |
| # 关闭 |
| docker-compose -f docker-compose.yaml down --remove-orphans |
| # 查看日志 |
| docker-compose -f docker-compose.yaml logs -f |
| |
第二步: 安装必要依赖
| test ! -f /etc/apt/source.list.save && cp /etc/apt/sources.list /etc/apt/sources.list.save |
| |
| sed -i "s@deb.debian.org@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && \ |
| sed -i "s@security.debian.org@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list |
| |
| apt update -y && apt install -y git curl python3 python3-pip python3-dev wget ninja-build ffmpeg sudo file |
| apt install -y libssl-dev ca-certificates make cmake gcc g++ zip |
| apt install -y lsb-release locales |
| apt install -y tcpdump nmap traceroute net-tools dnsutils iproute2 procps iputils-ping rsync |
| apt install -y libegl-mesa0 |
| |
| |
| |
| |
| |
| |
| set -exu |
| |
| __DIR__=$( |
| cd "$(dirname "$0")" |
| pwd |
| ) |
| cd ${__DIR__} |
| |
| export http_proxy=http://127.0.0.1:8016 |
| export https_proxy=http://127.0.0.1:8016 |
| |
| if [ -f depot_tools/.gitignore ];then |
| git -C depot_tools pull --depth=1 --progress --rebase=true |
| else |
| git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth=1 --progress |
| fi |
| |
| |
| export PATH="$PATH:${__DIR__}/depot_tools" |
| |
第四步:准备chromium
同步脚本
| vi download-chromium.sh |
| |
| |
| |
| set -eux |
| __CURRENT__=$(pwd) |
| __DIR__=$( |
| cd "$(dirname "$0")" |
| pwd |
| ) |
| cd ${__DIR__} |
| |
| cat > ${__DIR__}/.boto <<EOF |
| [Boto] |
| proxy = 127.0.0.1 |
| proxy_port = 8016 |
| proxy_type = http |
| # README https://gist.github.com/nickdiego/2b2faa35f5ab48e7438ee434d2756765 |
| EOF |
| |
| |
| proxy_server_url=http://127.0.0.1:8016 |
| export http_proxy=$proxy_server_url |
| export https_proxy=$proxy_server_url |
| |
| export PATH=${__DIR__}/depot_tools:$PATH |
| |
| export DEPOT_TOOLS_UPDATE=0 |
| gclient metrics --opt-out |
| |
| export NO_AUTH_BOTO_CONFIG=${__DIR__}/.boto |
| |
| |
| |
| |
| export GIT_CURL_VERBOSE=1 |
| |
| |
| curl -I https://chromium.googlesource.com |
| |
| |
| mkdir -p ${__DIR__}/chromium/chromium |
| |
| |
| |
| |
| cd ${__DIR__}/chromium/chromium |
| pwd |
| |
| |
| |
| |
| |
| |
| |
| if [ -f '.gclient' ] && [ -d ${__DIR__}/chromium/chromium/src/ ]; then |
| { |
| |
| |
| sed -i 's/"custom_vars": {}/"custom_vars": { \n "checkout_pgo_profiles": True, \n }/' ${__DIR__}/chromium/chromium/.gclient |
| |
| cd ${__DIR__}/chromium/chromium/src/ |
| git clean -fd |
| git checkout main |
| |
| |
| git pull origin main --depth=1 --rebase=true --progress |
| |
| cd ${__DIR__}/chromium/chromium/ |
| gclient sync -D --verbose --nohooks --no-history --auto_rebase -R --shallow |
| |
| cd ${__DIR__}/chromium/chromium/src/ |
| git checkout main |
| git merge origin/main |
| git branch |
| cd ${__DIR__}/chromium/chromium/ |
| gclient runhooks --verbose |
| |
| |
| cd ${__DIR__}/chromium/chromium/src/ |
| git clean -fd |
| } |
| else |
| { |
| test -d ${__DIR__}/chromium/chromium/src/ && rm -rf ${__DIR__}/chromium/chromium/src/ |
| fetch --nohooks --no-history chromium |
| gclient sync --nohooks --no-history |
| gclient runhooks --verbose |
| } |
| fi |
| |
| cd ${__DIR__}/chromium/chromium/src |
| git branch |
| cd ${__DIR__}/ |
| |
第四步:执行同步chromium
工程源代码
写这个脚本的初衷。源于四年前,回看下面的事。现在终于能自个实现了
- github issues 建议增加chromium镜像
- github tuna issues 申请chromium镜像
- github tuna issues 申请chromium镜像
参考文档
- nginx 的http_proxy_connect_module模块使用
- http 代理的服务端实现
- 构建能让socat支持TLSv.13特性的容器环境
- github chromium Source repository
- chromium Source repository
- chromium docs
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术