@@ -38,7 +38,7 @@ public void Update(List<string> messages)
38
38
}
39
39
else
40
40
{
41
- string url = "https://www.duckdns.org/update?domains=" + Domain + "&token=" + Token + "&ip=&ipv6=" ;
41
+ string url = BuildURL ( Domain , Token , "" , "" ) ; // "https://www.duckdns.org/update?domains=" + Domain + "&token=" + Token + "&ip=&ipv6=";
42
42
string ret = Cli ( ) . DownloadString ( url ) ;
43
43
if ( ret != "OK" )
44
44
messages . Add ( "Failed" ) ;
@@ -82,7 +82,7 @@ private void UpdateDomain(DDnsDomain d, List<string> messages)
82
82
messages . Add ( d . Domain + ": IP resolution failed" ) ;
83
83
return ;
84
84
}
85
- string url = "https://www.duckdns.org/update?domains=" + d . Domain + "&token=" + Token + "&ip=" + ipv4 + "&ipv6=" + ipv6 ;
85
+ string url = BuildURL ( d . Domain , Token , ipv4 , ipv6 ) ; // "https://www.duckdns.org/update?domains=" + d.Domain + "&token=" + Token + "&ip=" + ipv4 + "&ipv6=" + ipv6;
86
86
string ret ;
87
87
if ( ! string . IsNullOrEmpty ( d . BindIP ) )
88
88
{
@@ -110,6 +110,16 @@ private void UpdateDomain(DDnsDomain d, List<string> messages)
110
110
}
111
111
}
112
112
113
+ private string BuildURL ( string domain , string token , string ipv4 , string ipv6 )
114
+ {
115
+ string url = ServiceURL ;
116
+ url = url . Replace ( "<DOM>" , domain ) ;
117
+ url = url . Replace ( "<TKN>" , token ) ;
118
+ url = url . Replace ( "<IP4>" , ipv4 ) ;
119
+ url = url . Replace ( "<IP6>" , ipv6 ) ;
120
+ return url ;
121
+ }
122
+
113
123
private void getHostIPs ( string host , out string ipv4 , out string ipv6 )
114
124
{
115
125
ipv4 = null ;
@@ -242,6 +252,7 @@ private string CharSwitch(string str)
242
252
public string Domain { get ; set ; }
243
253
public string Token { get ; set ; }
244
254
public string Interval { get ; set ; }
255
+ public string ServiceURL { get ; set ; } = "https://www.duckdns.org/update?domains=<DOM>&token=<TKN>&ip=<IP4>&ipv6=<IP6>" ;
245
256
public List < DDnsDomain > Domains { get ; } = new List < DDnsDomain > ( ) ;
246
257
}
247
258
@@ -339,6 +350,8 @@ private static void DeserializeInto(ref object o, Queue<string> data)
339
350
}
340
351
pname = pname . Trim ( ) ;
341
352
PropertyInfo pi = t . GetProperty ( pname ) ;
353
+ if ( pi == null )
354
+ continue ;
342
355
if ( array )
343
356
{
344
357
Type itemtype ;
0 commit comments