Skip to content

Commit 02fecdb

Browse files
committed
支持https
1 parent bbd5162 commit 02fecdb

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/main/java/io/udfs/api/UDFS.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public enum PinType {all, direct, indirect, recursive}
4141
public final Name name = new Name();
4242
public final Pubsub pubsub = new Pubsub();
4343

44-
public UDFS(String host, int port) {
45-
this(host, port, "/api/v0/", false);
44+
public UDFS(String host, int port, boolean ssl) {
45+
this(host, port, "/api/v0/", ssl);
4646
}
4747

4848
public UDFS(String multiaddr) {

src/test/java/io/udfs/api/APITest.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
import static org.junit.Assert.assertTrue;
1717

1818
public class APITest {
19-
20-
//private final UDFS udfs = new UDFS(new MultiAddress("/dns4/udfs1.ulord.one/tcp/5001"));
21-
private final UDFS udfs = new UDFS("192.168.12.221",5001);
19+
//http访问方式
20+
//private final UDFS udfs = new UDFS("######",5001,false);
21+
//https访问方式
22+
private final UDFS udfs = new UDFS("########",443,true);
2223
private final Random r = new Random(33550336); // perfect
2324

2425
@Test
@@ -122,10 +123,12 @@ public void pushSingleFileTest() throws IOException {
122123
@Test
123124
public void pushFileTest() throws IOException {
124125
//要添加文件使用
125-
NamedStreamable.FileWrapper file = new NamedStreamable.FileWrapper(new File("C:/Users/Allen/Desktop/UPaaS.png"));
126+
NamedStreamable.FileWrapper file = new NamedStreamable.FileWrapper(new File("F:/test/20181116.txt"));
126127
//添加文件到IPFS返回HASH值
127-
List<MerkleNode> addParts = udfs.push(file);
128+
//List<MerkleNode> addParts = udfs.push(file);
128129
//输出HASH值
130+
131+
List<MerkleNode> addParts = udfs.add(file);
129132
System.out.println(addParts.get(0).hash);
130133
}
131134

0 commit comments

Comments
 (0)