File tree Expand file tree Collapse file tree 7 files changed +40
-31
lines changed
Expand file tree Collapse file tree 7 files changed +40
-31
lines changed Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <OutputType >Exe</OutputType >
5- <TargetFramework >net6.0</TargetFramework >
6- <LangVersion >8.0</LangVersion >
7- <Version >0.0.3</Version >
5+ <TargetFramework >net8.0</TargetFramework >
6+ <Version >0.0.4</Version >
87 </PropertyGroup >
98
109 <ItemGroup >
11- <PackageReference Include =" McMaster.Extensions.CommandLineUtils" Version =" 4.0.1 " />
12- <PackageReference Include =" Newtonsoft.Json" Version =" 13.0.2 " />
10+ <PackageReference Include =" McMaster.Extensions.CommandLineUtils" Version =" 4.1.0 " />
11+ <PackageReference Include =" Newtonsoft.Json" Version =" 13.0.3 " />
1312 <PackageReference Include =" Nito.AsyncEx.Context" Version =" 5.1.2" />
1413 </ItemGroup >
1514
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ public class ConfigurationModel
2020 // 主域名。
2121 public string MainDomain { get ; set ; }
2222
23+ /// <summary>
24+ /// 公网 IP 获取服务器地址。
25+ /// </summary>
26+ public string PublicIpServer { get ; set ; }
27+
2328 // 需要批量变更的子域名记录集合。
2429 public List < SubDomainRecord > SubDomains { get ; set ; }
2530 }
Original file line number Diff line number Diff line change 1- FROM mcr.microsoft.com/dotnet/sdk:6 .0 AS builder
1+ FROM mcr.microsoft.com/dotnet/sdk:8 .0 AS builder
22WORKDIR /build
33COPY . .
44RUN dotnet restore
55RUN dotnet publish -c Release -o /publish
66
7- FROM mcr.microsoft.com/dotnet/runtime:6 .0 AS runtime
7+ FROM mcr.microsoft.com/dotnet/runtime:8 .0 AS runtime
88WORKDIR /app
99COPY --from=builder /publish .
1010
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public void Stop()
6060 }
6161 }
6262
63- private void Callback ( object ? state )
63+ private void Callback ( object state )
6464 {
6565 lock ( _taskTimer )
6666 {
Original file line number Diff line number Diff line change 11using System ;
22using System . Net . Http ;
33using System . Threading . Tasks ;
4+ using AliCloudDynamicDNS . Configuration ;
45
56namespace AliCloudDynamicDNS . Utility
67{
@@ -12,7 +13,7 @@ public static async Task<string> GetPublicNetworkIp()
1213 {
1314 using ( var client = new HttpClient ( ) )
1415 {
15- using ( var request = new HttpRequestMessage ( HttpMethod . Get , "http://182.254.141.185:9990/get-ip" ) )
16+ using ( var request = new HttpRequestMessage ( HttpMethod . Get , ConfigurationHelper . Configuration . PublicIpServer ) )
1617 {
1718 using ( var response = await client . SendAsync ( request ) )
1819 {
Original file line number Diff line number Diff line change 55 "AccessKey" : " AccessKey" ,
66 // 主域名。
77 "MainDomain" : " example.com" ,
8+ // 公网 IP 获取服务器地址。
9+ "PublicIpServer" : " https://api.myzony.com/get-ip" ,
810 // 需要批量变更的子域名记录集合。
911 "SubDomains" : [
1012 {
Original file line number Diff line number Diff line change @@ -12,28 +12,30 @@ AliCloudDynamicDNS 是基于 .NET Core 开发的动态 DNS 解析工具,借助
1212
1313``` json
1414{
15- // 阿里云的 Access Id。
16- "AccessId" : " AccessId" ,
17- // 阿里云的 Access Key。
18- "AccessKey" : " AccessKey" ,
19- // 主域名。
20- "MainDomain" : " example.com" ,
21- // 需要批量变更的子域名记录集合。
22- "SubDomains" : [
23- {
24- // 子域名记录类型。
25- "Type" : " A" ,
26- // 子域名记录前缀。
27- "SubDomain" : " sub1" ,
28- // TTL 时间。
29- "Interval" : 600
30- },
31- {
32- "Type" : " A" ,
33- "SubDomain" : " sub2" ,
34- "Interval" : 600
35- }
36- ]
15+ // 阿里云的 Access Id。
16+ "AccessId" : " AccessId" ,
17+ // 阿里云的 Access Key。
18+ "AccessKey" : " AccessKey" ,
19+ // 主域名。
20+ "MainDomain" : " example.com" ,
21+ // 公网 IP 获取服务器地址。
22+ "PublicIpServer" : " https://api.myzony.com/get-ip" ,
23+ // 需要批量变更的子域名记录集合。
24+ "SubDomains" : [
25+ {
26+ // 子域名记录类型。
27+ "Type" : " A" ,
28+ // 子域名记录前缀。
29+ "SubDomain" : " sub1" ,
30+ // TTL 时间。
31+ "Interval" : 600
32+ },
33+ {
34+ "Type" : " A" ,
35+ "SubDomain" : " sub2" ,
36+ "Interval" : 600
37+ }
38+ ]
3739}
3840```
3941
You can’t perform that action at this time.
0 commit comments