这是一个 .NET 10 AOT Worker Service,用于自动获取 relay domain 并更新腾讯云 EdgeOne 的源站组。
${domain}.${relayDomain}uglink 的源站组{
"AppSettings": {
"Domain": "myugnas",
"OriginGroupName": "uglink",
"ZoneId": "your-zone-id",
"CheckIntervalMinutes": 5,
"TencentCloud": {
"SecretId": "your-secret-id",
"SecretKey": "your-secret-key"
}
}
}
配置项说明:
Domain: 域名别名,用于获取 relay domainOriginGroupName: 源站组名称ZoneId: 腾讯云 EdgeOne 的 Zone IDCheckIntervalMinutes: 检查间隔(分钟)TencentCloud.SecretId: 腾讯云 SecretIdTencentCloud.SecretKey: 腾讯云 SecretKey如果不希望在配置文件中存放密钥,也可以通过环境变量设置:
$env:TENCENTCLOUD_SECRET_ID = "your-secret-id"
$env:TENCENTCLOUD_SECRET_KEY = "your-secret-key"
程序会优先使用配置文件中的值,配置文件为空时才会从环境变量读取。
cd UGLinkEO
dotnet run
dotnet publish -c Release -r win-x64
支持的运行时标识符(RID):
win-x64:Windows 64位linux-x64:Linux 64位osx-x64:macOS 64位UGLinkEO/
├── Models/ # 数据模型
│ ├── EdgeOneOriginGroup.cs # EdgeOne 源站组相关模型
│ ├── GetNodeInfoRequest.cs # 获取节点信息请求
│ └── UGNasApiResponse.cs # 绿联 API 响应模型
├── Services/ # 服务类
│ ├── AppJsonContext.cs # System.Text.Json 源生成器上下文
│ ├── TencentCloudTeoService.cs # 腾讯云 EdgeOne API 服务
│ └── UGNasService.cs # 绿联 API 服务
├── AppSettings.cs # 配置类
├── Program.cs # 程序入口
├── Worker.cs # 后台工作服务
├── TrimmerRoots.xml # AOT 裁剪根配置
└── appsettings.json # 应用配置
https://api.ugnas.com/api/p2p/v2/ta/nodeInfo/byAlias程序内置完整的错误处理机制:
MIT License