WEB-RTC源码下载前置

一、安装V2RAY-CORE

1、下载V2RAY-CORE安装脚本
https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh
(可以直接下载)

二、安装geoip.dat 和 geosite.dat

2、下载 geoip.dat 和 geosite.dat安装脚本
https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh
(需要修改geoip.dat 和 geosite.dat从本地安装,注意运行脚本前需要先安装V2RAY-CORE)
DOWNLOAD_LINK_GEOIP="https://github.com/v2fly/geoip/releases/latest/download/geoip.dat"
DOWNLOAD_LINK_GEOSITE="https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat"

#!/usr/bin/env bash
# shellcheck disable=SC2268

# This Bash script to install the latest release of geoip.dat and geosite.dat from local paths

# Depends on cURL, please solve it yourself

# You may plan to execute this Bash script regularly:

# install -m 755 install-dat-release.sh /usr/local/bin/install-dat-release

# 0 0 * * * /usr/local/bin/install-dat-release > /dev/null 2>&1

# You can set this variable whatever you want in shell session right before running this script by issuing:
# export DAT_PATH='/usr/local/lib/v2ray'
DAT_PATH=${DAT_PATH:-/usr/local/share/v2ray}

file_ip='geoip.dat'
file_dlc='dlc.dat'
file_site='geosite.dat'
local_geoip="/home/huanowine/Desktop/source-webrtc/v2ray/geoip.dat"
local_dlc="/home/huanowine/Desktop/source-webrtc/v2ray/dlc.dat"

check_if_running_as_root() {
  # If you want to run as another user, please modify $UID to be owned by this user
  if [[ "$UID" -ne '0' ]]; then
    echo "WARNING: The user currently executing this script is not root. You may encounter the insufficient privilege error."
    read -r -p "Are you sure you want to continue? [y/n] " cont_without_been_root
    if [[ x"${cont_without_been_root:0:1}" = x'y' ]]; then
      echo "Continuing the installation with current user..."
    else
      echo "Not running with root, exiting..."
      exit 1
    fi
  fi
}

install_file() {
  install -m 644 "${local_dlc}" "${DAT_PATH}/${file_site}"
  install -m 644 "${local_geoip}" "${DAT_PATH}/${file_ip}"
}

main() {
  check_if_running_as_root
  install_file
}

main "$@"

三、安装V2rayA

  1. 添加公钥
wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/v2raya.asc   #添加公钥
echo "deb https://apt.v2raya.org/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list    #添加v2rayA软件源
sudo apt update    #更新软件源
  1. 安装 v2rayA
sudo apt install v2raya
  1. 启动 v2rayA
sudo systemctl start v2raya.service

四、下载源码

首先,下载depot_tools

mkdir webrtc
cd webrtc
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

然后,配置环境变量,后面需要用到的工具都在depot_tools文件夹里面。将 depot_tools 永久添加到 .bashrc 为了确保每次打开终端时都能自动加载 depot_tools,你可以将上面的路径添加到 .bashrc 文件中:

echo 'export PATH="$PATH:/home/huanowine/Desktop/source-webrtc/depot_tools"' >> ~/.bashrc
source ~/.bashrc

 获取web-rtc源码,时间会比较长

fetch --nohooks webrtc
gclient sync

如果不想编译,只是看代码,可以直接下载源码,不需要depot_tools

https://webrtc.googlesource.com/src.git

源码下载完成以后,在src目录

五、开始安装依赖库

cd src

./build/install-build-deps.sh --no-chromeos-fonts

六.生成工程

cd src

gn gen out/Default