X

naiveproxy 安装

2021/12/16

如果你是caddy用户 你一定会喜欢naiveproxy这款方便的代理工具

  1. 首先确保Golang环境已经配置

golang 安装参考 Install Go on Debian 10/11

  1. 安装xcaddy

You can download binaries that are already compiled for your platform from the Release tab.

You may also build xcaddy from source:

$ go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest

For Debian, Ubuntu, and Raspbian, an xcaddy package is available from our Cloudsmith repo:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-xcaddy.asc
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list
sudo apt update
sudo apt install xcaddy

  1. 编译naiveproxy版本的caddy
$(go env GOPATH)/bin/xcaddy build --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive

  1. 配置caddyfile

Example Caddyfile (replace user and pass accordingly):

{
  servers {
    protocol {
      experimental_http3
    }
  }
}
:443, example.com
tls me@example.com
route {
  forward_proxy {
    basic_auth user pass
    hide_ip
    hide_via
    probe_resistance
  }
  file_server { root /var/www/html }
}

  1. 运行
# Run with the Caddyfile:
sudo setcap cap_net_bind_service=+ep ./caddy
./caddy start

  1. 客户端配置

Run ./naive with the following config.json to get a SOCKS5 proxy at local port 1080.

{
  "listen": "socks://127.0.0.1:1080",
  "proxy": "https://user:pass@example.com"
}

Or quic://user:pass@example.com, if it works better. See also parameter usage and performance tuning.

Commit