File tree Expand file tree Collapse file tree 5 files changed +46
-5
lines changed Expand file tree Collapse file tree 5 files changed +46
-5
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
+ <modelVersion >4.0.0</modelVersion >
6
+
7
+ <groupId >com.bihell</groupId >
8
+ <artifactId >ddns</artifactId >
9
+ <version >1.0-SNAPSHOT</version >
10
+ <properties >
11
+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
12
+ <project .reporting.outputEncoding>UTF-8</project .reporting.outputEncoding>
13
+ </properties >
14
+
15
+ <dependencies >
16
+ <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
17
+ <dependency >
18
+ <groupId >commons-codec</groupId >
19
+ <artifactId >commons-codec</artifactId >
20
+ <version >1.13</version >
21
+ </dependency >
22
+ <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
23
+ <dependency >
24
+ <groupId >com.squareup.okhttp3</groupId >
25
+ <artifactId >okhttp</artifactId >
26
+ <version >4.0.1</version >
27
+ </dependency >
28
+
29
+
30
+ </dependencies >
31
+
32
+
33
+ </project >
Original file line number Diff line number Diff line change 7
7
import javax .crypto .spec .SecretKeySpec ;
8
8
9
9
10
+ /**
11
+ * @author haseochen
12
+ */
10
13
public class HmacSha1Signature {
11
14
private static final String HMAC_SHA1_ALGORITHM = "HmacSHA1" ;
12
15
Original file line number Diff line number Diff line change 3
3
import java .io .InputStreamReader ;
4
4
import java .net .URL ;
5
5
6
+ /**
7
+ * @author haseochen
8
+ */
6
9
public class IpChecker {
7
10
8
11
public static String getIp () throws Exception {
Original file line number Diff line number Diff line change 4
4
import java .util .*;
5
5
6
6
/**
7
- * Created by haseochen on 2017/8/4.
7
+ *
8
+ * @author haseochen
9
+ * @date 2017/8/4
8
10
*/
9
11
public class StringToSign {
10
12
private static final String ISO8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'" ;
Original file line number Diff line number Diff line change @@ -32,20 +32,20 @@ public static void main(String[] args) throws Exception {
32
32
parameters .put ("SignatureNonce" , UUID .randomUUID ().toString ());
33
33
parameters .put ("Format" , "json" );
34
34
35
- if (args [0 ]. equals ( "DescribeDomainRecords" )) {
35
+ if ("DescribeDomainRecords" . equals ( args [0 ])) {
36
36
parameters .put ("DomainName" , args [3 ]);
37
37
}
38
38
39
- if (args [0 ]. equals ( "UpdateDomainRecord" )) {
39
+ if ("UpdateDomainRecord" . equals ( args [0 ])) {
40
40
parameters .put ("RecordId" , args [3 ]);
41
41
parameters .put ("RR" , args [4 ]);
42
42
parameters .put ("Type" , "A" );
43
43
parameters .put ("Value" , IpChecker .getIp ());
44
44
}
45
45
46
46
// calculate signature
47
- String get_stringToSign = StringToSign .getSign (parameters );
48
- String signature = HmacSha1Signature .calculateRFC2104HMAC (get_stringToSign .toString (), args [2 ] + "&" );
47
+ String getStringToSign = StringToSign .getSign (parameters );
48
+ String signature = HmacSha1Signature .calculateRFC2104HMAC (getStringToSign .toString (), args [2 ] + "&" );
49
49
50
50
// final request URL
51
51
parameters .put ("Signature" , signature );
You can’t perform that action at this time.
0 commit comments