快速下载webRTC源码

第一步:准备服务

一句命令即可或者启动一个容器

使用代理方式一:


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



# 备注: 服务端就是一个 nginx 仅此而已
# socat 需要支持TLSv1.3 
# 如果你的socat 不支持相关参数,请使用下面容器的方式

使用代理方式二:

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
    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
     ports:
        - "8016:8016"
 
# 启动
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 

第二步:准备 depot_tools 脚本

# vi depot_tools.sh

#!/bin/bash
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"



第三步:准备 webRTC 同步脚本

# vi download-webrtc.sh

#!/bin/bash
set -exu

__DIR__=$(
  cd "$(dirname "$0")"
  pwd
)
cd ${__DIR__}

export PATH="$PATH:${__DIR__}/depot_tools"


export http_proxy=http://127.0.0.1:8016
export https_proxy=http://127.0.0.1:8016

cat > ${__DIR__}/.boto <<EOF
[Boto]
proxy = 127.0.0.1
proxy_port = 8016
proxy_type = http
# README https://gist.github.com/nickdiego/2b2faa35f5ab48e7438ee434d2756765
EOF

export DEPOT_TOOLS_UPDATE=0
gclient metrics --opt-out
# 显示git下载详细信息
#export GIT_TRACE_PACKET=1
#export GIT_TRACE=1
export GIT_CURL_VERBOSE=1

export NO_AUTH_BOTO_CONFIG=${__DIR__}/.boto

if [ -f .gclient ];then
    if [ -d src ] ;then
    cd src
        git checkout main
        git pull origin main   --depth=1 --progress  --rebase=true --allow-unrelated-histories
        git merge origin/main
        git clean -fd
        cd ..
    fi 
    gclient   sync --nohooks --no-history
    # gclient sync -D --verbose --nohooks --no-history --auto_rebase -R --shallow 
else
    fetch      --nohooks --no-history webrtc 
    gclient    --nohooks --no-history sync
fi

gclient  runhooks

第四步:执行同步 webRTC 工程


sh download-webrtc.sh

参考文档

  1. nginx 的http_proxy_connect_module模块使用
  2. http 代理的服务端实现
  3. 构建能让socat支持TLSv.13特性的容器环境
  4. 快速下载chromium源码
  5. webrtc.org
  6. WebRTC samples 示例
  7. WebRTC samples GitHub repository
  8. Source repository

下一篇: webRTC构建-Linux版

posted @ 2022-08-11 11:18  jingjingxyk  阅读(1062)  评论(0编辑  收藏  举报