设置proxy

如何使用代理工具

OS

Windows

  • cmd
set http_proxy=http://127.0.0.1:8580
set https_proxy=http://127.0.0.1:8580
  • powershell
$proxy='http://<IP>:<PORT>'

$ENV:HTTP_PROXY=$proxy
$ENV:HTTPS_PROXY=$proxy

ref: https://stackoverflow.com/a/47624713

Ubuntu

export http_proxy="http://192.168.1.108:1080"
export https_proxy="http://192.168.1.108:1080"

With user and password

Set up the server in the tool:
Check “Run xxx as Server(listens 0.0.0.0)”

export http_proxy=http://USERNAME:PASSWORD@192.168.1.108:8580/
export https_proxy=http://USERNAME:PASSWORD@192.168.1.108:8580/

FreeBSD

v12.4

setenv HTTP_PROXY http://web-proxy.xxxxxx.com:8080
setenv HTTPS_PROXY https://web-proxy.xxxxxx.com:8080

software

VirtualBox

  • Adapter 1
    host only, vboxnet0

  • Adapter 2
    NAT

Guest os

sudo vi /etc/netplan/00-installer-config.yaml
network:
    version: 2
    renderer: networkd
    ethernets:
        enp0s3:
            addresses:
                - 192.168.56.12/24
            dhcp4: no
        enp0s8:
            dhcp4: no

Wine

#!/bin/bash

sudo dpkg --add-architecture i386

sudo curl -O https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key

sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo apt update

sudo apt install -y --install-recommends winehq-stable

usage wine

$ wine --version
$ wine fg798p.exe

git

set proxy

git config --global http.proxy http://127.0.0.1:8580

git config --global https.proxy https://127.0.0.1:8580

unset

git config --global --unset http.proxy
git config --global --unset https.proxy

node-js

.npmrc

npm

npm config delete https-proxy
npm config set proxy http://host:port
npm config set http-proxy http://host:port
npm config set https-proxy http://host:port
npm config set strict-ssl false

file

registry=https://registry.npmjs.org/
proxy=http://127.0.0.1:8580/
http-proxy=http://127.0.0.1:8580
https-proxy=http://127.0.0.1:8580
strict-ssl=false

yarn

  • v1
yarn config set proxy http://host:port
yarn config set https-proxy http://host:port
  • v2
yarn config set httpProxy http://host:port
yarn config set httpsProxy http://host:port

Agent Website

国内网站代理

ruby gems

安装指定版本:V1.17.3

gem install bundler -v 1.17.3

替换掉源地址:gemfile

https://rubygems.org/

变更为:

https://gems.ruby-china.com/

nodejs

npm cache clean --force
npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist

maven

conf/settings.xml

  <proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>127.0.0.1</host>
      <port>8580</port>
    </proxy>

Ref