Skip to content

Commit b7cab68

Browse files
committed
改用 Maven 包管理
1 parent ea59a67 commit b7cab68

File tree

5 files changed

+46
-5
lines changed

5 files changed

+46
-5
lines changed

pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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>

src/main/java/HmacSha1Signature.java

100644100755
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import javax.crypto.spec.SecretKeySpec;
88

99

10+
/**
11+
* @author haseochen
12+
*/
1013
public class HmacSha1Signature {
1114
private static final String HMAC_SHA1_ALGORITHM = "HmacSHA1";
1215

src/main/java/IpChecker.java

100644100755
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import java.io.InputStreamReader;
44
import java.net.URL;
55

6+
/**
7+
* @author haseochen
8+
*/
69
public class IpChecker {
710

811
public static String getIp() throws Exception {

src/main/java/StringToSign.java

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import java.util.*;
55

66
/**
7-
* Created by haseochen on 2017/8/4.
7+
*
8+
* @author haseochen
9+
* @date 2017/8/4
810
*/
911
public class StringToSign {
1012
private static final String ISO8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";

src/main/java/UpdateDomainRecord.java

100644100755
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ public static void main(String[] args) throws Exception {
3232
parameters.put("SignatureNonce", UUID.randomUUID().toString());
3333
parameters.put("Format", "json");
3434

35-
if (args[0].equals("DescribeDomainRecords")) {
35+
if ("DescribeDomainRecords".equals(args[0])) {
3636
parameters.put("DomainName", args[3]);
3737
}
3838

39-
if (args[0].equals("UpdateDomainRecord")) {
39+
if ("UpdateDomainRecord".equals(args[0])) {
4040
parameters.put("RecordId", args[3]);
4141
parameters.put("RR", args[4]);
4242
parameters.put("Type", "A");
4343
parameters.put("Value", IpChecker.getIp());
4444
}
4545

4646
// 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] + "&");
4949

5050
// final request URL
5151
parameters.put("Signature", signature);

0 commit comments

Comments
 (0)