WireProxy 项目使用教程
1. 项目的目录结构及介绍
WireProxy 项目的目录结构如下:
wireproxy/
├── cmd/
│ └── wireproxy/
│ └── main.go
├── systemd/
│ └── wireproxy.service
├── dockerignore
├── gitignore
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── UseWithVPN.md
├── config/
│ ├── config.go
│ └── config_test.go
├── go.mod
├── go.sum
├── http.go
├── net.go
├── routine.go
├── test_config.sh
├── util.go
└── wireguard.go
目录介绍
cmd/wireproxy/
: 包含项目的入口文件main.go
。systemd/
: 包含用于 systemd 服务的配置文件wireproxy.service
。config/
: 包含配置文件的处理逻辑和测试文件。go.mod
和go.sum
: Go 模块依赖文件。http.go
,net.go
,routine.go
,util.go
,wireguard.go
: 项目的主要功能实现文件。README.md
和UseWithVPN.md
: 项目文档文件。
2. 项目的启动文件介绍
项目的启动文件位于 cmd/wireproxy/main.go
。这个文件是 WireProxy 应用程序的入口点,负责初始化配置和启动代理服务。
主要功能
- 解析命令行参数。
- 加载配置文件。
- 启动 SOCKS5 或 HTTP 代理服务。
3. 项目的配置文件介绍
WireProxy 的配置文件是一个文本文件,通常命名为 config.conf
。配置文件示例如下:
# SelfSecretKey 为 WireGuard 的私钥
SelfSecretKey = uCTIK+56CPyCvwJxmU5dBfuyJvPuSXAq1FzHdnIxe1Q=
# 允许的 IP 地址
AllowedIPs = 10.254.254.1/32, fdee:1337:c000:d00d::1/128
# 端点
Endpoint = 172.16.0.185:44044
# 持久化保持活跃
PersistentKeepalive = 25
[TCPServerTunnel]
ListenPort = 5000
Target = service-one:5000
[TCPServerTunnel]
ListenPort = 5001
Target = service-two:5001
[TCPServerTunnel]
ListenPort = 5080
Target = service-three:80
[Interface]
ListenPort = 5400
[Peer]
PublicKey = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=
AllowedIPs = 10.254.254.100/32
配置项介绍
SelfSecretKey
: WireGuard 的私钥。AllowedIPs
: 允许的 IP 地址范围。Endpoint
: WireGuard 服务器的端点地址。PersistentKeepalive
: 持久化保持活跃的时间间隔。TCPServerTunnel
: TCP 隧道配置,包括监听端口和目标服务地址。Interface
: 接口配置,包括监听端口。Peer
: 对等体配置,包括公钥和允许的 IP 地址。
通过以上配置文件,可以灵活地设置 WireProxy 的各项参数,以满足不同的使用需求。
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考