Skip to content

Commit 714985a

Browse files
committed
Add MultiAddress.has(Protocol p)
1 parent 58021a2 commit 714985a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/io/ipfs/multiaddr/MultiAddress.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ public byte[] getBytes() {
2929
}
3030

3131
public boolean isRelayed() {
32+
return has(Protocol.get("p2p-circuit"));
33+
}
34+
35+
public boolean has(Protocol p) {
3236
String[] parts = toString().substring(1).split("/");
33-
return Arrays.asList(parts).contains("/p2p-circuit");
37+
return Arrays.asList(parts).contains(p.name());
3438
}
3539

3640
public boolean isPublic(boolean testReachable) {

0 commit comments

Comments
 (0)