Skip to content

This project provides the pm CLI, which rewrites the existing v2ray/sing-box/xray management scripts in Go, centrally managing installation, configuration, updates, removal, and operation and maintenance, and supports supervisord monitoring.

Notifications You must be signed in to change notification settings

linzeyan/proxy-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proxy Manager (pm)

本專案提供 pm CLI,用 Go 重寫既有的 v2ray/sing-box/xray 管理腳本,集中管理安裝、設定、更新、移除與運行維護,並支援 supervisord 監控。

本專案為以下三個庫的改寫與整合:

目標

  • 單一 CLI 管理多核心(v2ray/xray/sing-box)。
  • 設定檔可透過命令與互動式選單建立/修改/刪除。
  • 支援 Caddy 自動 TLS 與反向代理設定。
  • 支援 supervisord 監控與自動重啟。

目錄結構(使用者態)

/etc/
  v2ray/
    bin/
    conf/
    config.json
  xray/
    bin/
    conf/
    config.json
  sing-box/
    bin/
    conf/
    config.json
/etc/caddy/
  Caddyfile
  233boy/
  sites/
/etc/supervisor/
  supervisord.conf
  conf.d/
    v2ray.conf
    xray.conf
    sing-box.conf
~/.proxy-manager/
  client/               # 客戶端設定檔 
  core/                 # 客戶端核心程式 (v2ray/xray/sing-box)
  logs/                 # 客戶端日誌
/var/log/
  v2ray/
    access.log
    error.log
  xray/
    access.log
    error.log
  sing-box/
    access.log
    error.log
/var/log/supervisor/
  supervisord.log
  v2ray.log
  v2ray.err.log
  xray.log
  xray.err.log
  sing-box.log
  sing-box.err.log
/var/run/
  supervisord.pid
  supervisor.sock

建置

make build

產物會在 bin/pm

測試

go test ./...

常用指令

安裝與更新

pm install
pm update core
pm update dat
pm update caddy
pm uninstall

xray 安裝與更新

pm xray install
pm xray update core
pm xray update dat
pm xray update caddy
pm xray uninstall

設定管理

pm add vmess-tcp
pm add vmess-ws-tls --host example.com
pm change <config.json>
pm del <config.json>
pm info <config.json>
pm url <config.json>
pm qr <config.json>

sing-box 設定管理

pm sing-box add vless-reality
pm sing-box add vmess-ws-tls --host example.com
pm sing-box change <config.json>
pm sing-box del <config.json>
pm sing-box info <config.json>
pm sing-box url <config.json>
pm sing-box qr <config.json>

xray 設定管理

pm xray add vless-reality
pm xray add vless-xhttp-tls --host example.com
pm xray change <config.json>
pm xray del <config.json>
pm xray info <config.json>
pm xray url <config.json>
pm xray qr <config.json>

進階操作

pm dns
pm fix <config.json>
pm fix-all
pm fix-config.json
pm fix-caddyfile
pm bbr

sing-box 進階操作

pm sing-box dns
pm sing-box fix <config.json>
pm sing-box fix-all
pm sing-box fix-config.json
pm sing-box fix-caddyfile

xray 進階操作

pm xray dns
pm xray fix <config.json>
pm xray fix-all
pm xray fix-config.json
pm xray fix-caddyfile
pm xray bbr

運行管理

pm start
pm stop
pm restart
pm status
pm test
pm log
pm logerr

sing-box 運行管理

pm sing-box start
pm sing-box stop
pm sing-box restart
pm sing-box status
pm sing-box test
pm sing-box log
pm sing-box logerr

xray 運行管理

pm xray start
pm xray stop
pm xray restart
pm xray status
pm xray test
pm xray log
pm xray logerr

客戶端管理

# 設定管理
pm client add <proxy-url> [--name <name>]
pm client list
pm client info <name>
pm client delete <name>

# 核心管理
pm client install <v2ray|xray|singbox>
pm client update <v2ray|xray|singbox>
pm client uninstall <v2ray|xray|singbox>

# 連線管理
pm client connect <name> [--core <core>] [--socks-port <port>] [--http-port <port>] [--daemon]

supervisord 管理

pm supervisor install
pm supervisor configure
pm supervisor start
pm supervisor status
pm supervisor stop
pm supervisor restart

sing-box supervisord 管理

pm sing-box supervisor install
pm sing-box supervisor configure
pm sing-box supervisor start
pm sing-box supervisor status
pm sing-box supervisor stop
pm sing-box supervisor restart

xray supervisord 管理

pm xray supervisor install
pm xray supervisor configure
pm xray supervisor start
pm xray supervisor status
pm xray supervisor stop
pm xray supervisor restart

注意事項

  • pm 會使用系統路徑寫入 v2ray/xray 與 Caddy 的檔案(例如 /etc/v2ray/etc/xray/etc/sing-box/etc/caddy)。
  • supervisord 設定檔位於 /etc/supervisor/
  • 核心日誌位於 /var/log/{core}/
  • supervisord 日誌位於 /var/log/supervisor/

v2ray 行為要點

  • v2ray 核心與設定檔位於 /etc/v2ray/

xray 行為要點

  • TLS 的 ws/h2/grpc/xhttp 會透過 Caddy 反代,xray inbound 監聽 127.0.0.1
  • xray 核心與設定檔位於 /etc/xray/

sing-box 行為要點

  • 當使用帶 TLS 的 ws/h2/httpupgrade,且提供 host 且未指定 --no-auto-tls 時,會自動走 Caddy 反代,sing-box inbound 監聽 127.0.0.1
  • tuic/hysteria2/trojan 或非 Caddy 情境下會自動生成 tls.key/tls.cer(透過 sing-box generate tls-keypair),Reality 會自動生成 keypair。
  • sing-box 核心與設定檔位於 /etc/sing-box/

About

This project provides the pm CLI, which rewrites the existing v2ray/sing-box/xray management scripts in Go, centrally managing installation, configuration, updates, removal, and operation and maintenance, and supports supervisord monitoring.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages