-
下载源码:
- 访问Hiddify的GitHub仓库(如
https://github.com/hiddify/hiddify)。 - 克隆仓库到你的项目目录中:
git clone https://github.com/hiddify/hiddify.git。
- 访问Hiddify的GitHub仓库(如
-
安装依赖项:
- 进入仓库目录:
cd hiddify。 - 安装Python依赖:
pip install -r requirements.txt。
- 进入仓库目录:
-
编译源码:
- 使用构建工具安装:
pip install setuptools wheel。 - 在
dist目录下运行:python setup.py install。
- 使用构建工具安装:
-
运行节点:
- 运行启动命令:
python -m hiddify.run --config config.json。
- 运行启动命令:
-
配置JSON文件:
- 创建或编辑
config.json:{ "listen": "...:505", "server": { "listen": "...:5051", "max_connections": 100, "max_message_size": 100000 }, "connections": { "allowed": ["192.168.*.*", "10.../24"], "max_connections": 100, "max_message_size": 100000 }, "identity": { "private_key_path": "id_key.pem", "certificate_path": "id_cert.pem", "token_path": "token.json" }, "api": { "enabled": true, "listen": "...:505", "max_connections": 100, "max_message_size": 100000 }, "network": { "enabled": true, "protocol": "i2p", "server_uri": "http2://localhost:4223" } } listen设置为...:505,允许来自任何IP的连接。- 根据需要配置服务器和连接限制。
- 创建或编辑
-
身份验证配置(可选):
- 如果需要身份验证,在
config.json中添加身份验证配置:"auth": { "enabled": true, "method": "password", "username": "username", "password": "yourpassword" } - 或使用OAuth:
"auth": { "enabled": true, "method": "oauth", "client_id": "your_client_id", "client_secret": "your_client_secret", "token_url": "https://auth.example.com/token" }
- 如果需要身份验证,在
-
生成身份文件:
- 使用现有的工具生成私钥和证书:
openssl genrsa -out id_key.pem openssl req -x509 -newkey rsa:2048 -keyout id_key.pem -out id_cert.pem -days 365
- 使用现有的工具生成私钥和证书:
-
配置网络层(如Tor或I2P):
- 在
config.json中设置网络协议:"network": { "enabled": true, "protocol": "tor", // 或 "i2p" "server_uri": "http2://localhost:4223" // 根据你的网络层设置 } - 如果使用Tor,确保Tor网络可用。
- 在
-
添加节点到网络中:
- 更新节点列表,运行命令:
python -m hiddify.update --config config.json。
- 更新节点列表,运行命令:
-
测试节点:
- 查看运行状态:
python -m hiddify.status --config config.json。 - 检查是否有错误日志,确保节点正常运行。
- 查看运行状态:
-
安全性和维护:
- 定期检查日志文件,确保没有异常警告。
- 更新软件,及时修复已知漏洞。
- 设置防火墙规则,防止未经授权的访问。
通过以上步骤,你已经配置了一个Hiddify节点,其他用户可以通过连接到你的IP和端口(如...:505)使用你的网络服务,确保安全存储私钥和证书文件,保护你的隐私和数据安全。









