配置文件
ed CLI 支持通过配置文件来自定义各种行为和参数。本文档详细介绍了配置文件的结构和各项设置。
配置文件位置
ed CLI 会在以下位置查找配置文件:
./config/config.yaml- 当前目录的 config 文件夹~/.edtunnel/config.yaml- 用户主目录的 .edtunnel 文件夹- 通过
--config参数指定的自定义路径
主配置文件 (config.yaml)
基本结构
yaml
# 基本设置
app:
name: "ed-cli"
version: "0.4.0"
log_level: "info" # debug, info, warn, error
# 认证设置
auth:
email: "your-email@example.com"
token: "your-access-token"
refresh_token: "your-refresh-token"
# 网络设置
network:
timeout: 30s
retry_count: 3
user_agent: "ed-cli/0.4.0"
# IP 测试设置
iptest:
default_limit: 10
default_speed_threads: 5
output_format: "table" # table, json, csv
save_results: true
results_dir: "./results"
# 订阅检查设置
sub_check:
concurrent: 200
timeout: 5
min_speed: 5.0
media_check: true
remove_duplicates: true
# 流媒体解锁检测
media_unlocks:
- "netflix"
- "disney"
- "youtube"
- "chatgpt"
# 节点过滤规则
filters:
# 排除的关键词
exclude_keywords:
- "过期"
- "expired"
- "官网"
# 包含的关键词
include_keywords:
- "优化"
- "IPLC"
- "专线"
# 地区过滤
regions:
include: ["HK", "SG", "JP", "US"]
exclude: ["CN"]
# 输出设置
output:
formats: ["yaml", "json", "clash"]
save_individual: true
save_combined: true
# 保存后端配置
save_backends:
# GitHub Gist
github_gist:
enabled: false
token: "your-github-token"
gist_id: "your-gist-id"
filename: "subscription.yaml"
# 本地文件
local_file:
enabled: true
path: "./results/"
filename_template: "{timestamp}_{type}.yaml"
# S3 兼容存储
s3:
enabled: false
endpoint: "https://s3.amazonaws.com"
bucket: "your-bucket"
region: "us-east-1"
access_key: "your-access-key"
secret_key: "your-secret-key"
path: "subscriptions/"
# WebDAV
webdav:
enabled: false
endpoint: "https://your-webdav-server.com"
username: "your-username"
password: "your-password"
path: "/subscriptions/"详细配置说明
应用设置 (app)
name: 应用名称version: 应用版本号log_level: 日志级别,可选值:debug, info, warn, error
认证设置 (auth)
email: EDtunnel 账户邮箱token: 访问令牌refresh_token: 刷新令牌
网络设置 (network)
timeout: 网络请求超时时间retry_count: 重试次数user_agent: HTTP 用户代理
IP 测试设置 (iptest)
default_limit: 默认测试的IP数量限制default_speed_threads: 默认测速线程数output_format: 输出格式 (table, json, csv)save_results: 是否保存测试结果results_dir: 结果保存目录
订阅检查设置 (sub_check)
concurrent: 并发检查数量timeout: 单个节点检查超时时间(秒)min_speed: 最低速度要求(MB/s)media_check: 是否进行流媒体检查remove_duplicates: 是否去除重复节点
V2Ray 配置模板
对于 iptest 功能,需要一个 V2Ray 配置模板:
模板位置
~/.edtunnel/v2ray.json
模板示例
json
{
"log": {
"level": "warning"
},
"inbounds": [
{
"port": 1080,
"protocol": "socks",
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "{{IP}}",
"port": {{PORT}},
"users": [
{
"id": "{{UUID}}",
"encryption": "none",
"flow": "xtls-rprx-vision"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"serverName": "{{HOST}}",
"allowInsecure": false
}
}
}
]
}模板变量
: 节点 IP 地址: 节点端口: 用户 UUID: 服务器主机名
MCP 服务器配置
MCP 服务器有独立的配置文件:
配置文件位置
configs/mcp-server.yaml
配置示例
yaml
server:
name: "ed-iptest-mcp"
version: "1.0.0"
stdio:
enabled: true
sse:
enabled: false
port: ":8080"
cors_origins:
- "http://localhost:3000"
- "https://your-frontend.com"
logging:
level: "info"
format: "json"
tasks:
max_concurrent: 5
default_timeout: "10m"
cleanup_interval: "1h"
iptest:
default_limit: 50
max_limit: 200
default_speed_threads: 5
resources:
max_results: 100
retention_period: "24h"环境变量
ed CLI 支持通过环境变量覆盖配置:
bash
# 认证信息
export ED_EMAIL="your-email@example.com"
export ED_TOKEN="your-access-token"
# 网络设置
export ED_TIMEOUT="30s"
export ED_RETRY_COUNT="3"
# 调试模式
export ED_DEBUG="true"
export ED_LOG_LEVEL="debug"
# 配置文件路径
export ED_CONFIG_PATH="/path/to/config.yaml"配置验证
使用以下命令验证配置文件:
bash
# 验证主配置
ed config validate
# 验证 MCP 配置
ed mcp-server --validate-config
# 显示当前配置
ed config show配置示例
基础用户配置
yaml
auth:
email: "user@example.com"
iptest:
default_limit: 20
default_speed_threads: 3
sub_check:
concurrent: 100
timeout: 10
min_speed: 5
media_check: true高级用户配置
yaml
auth:
email: "advanced@example.com"
iptest:
default_limit: 50
default_speed_threads: 10
save_results: true
results_dir: "./advanced_results"
sub_check:
concurrent: 500
timeout: 3
min_speed: 10
media_check: true
filters:
exclude_keywords: ["过期", "测试"]
regions:
include: ["HK", "SG", "JP", "US", "KR"]
exclude: ["CN", "RU"]
save_backends:
github_gist:
enabled: true
token: "ghp_xxxxxxxxxxxx"
gist_id: "your-gist-id"
s3:
enabled: true
endpoint: "https://s3.amazonaws.com"
bucket: "my-subscriptions"
region: "us-east-1"故障排除
常见配置问题
- 配置文件未找到: 检查路径是否正确
- YAML 语法错误: 使用 YAML 验证工具检查
- 权限问题: 确保配置文件有读取权限
- 认证失败: 检查邮箱和令牌是否正确
配置重置
bash
# 重置为默认配置
ed config reset
# 重新生成配置文件
ed config init