Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edd5877
commit 70893c3
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package snowblossom.channels; | ||
|
||
import snowblossom.channels.proto.ChannelPeerInfo; | ||
import snowblossom.channels.proto.ConnectInfo; | ||
import snowblossom.lib.AddressSpecHash; | ||
import snowblossom.lib.AddressUtil; | ||
|
||
public class PrintUtil | ||
{ | ||
|
||
public static String print(ChannelPeerInfo info) | ||
{ | ||
StringBuilder sb = new StringBuilder(); | ||
AddressSpecHash hash = new AddressSpecHash(info.getAddressSpecHash()); | ||
|
||
sb.append(AddressUtil.getAddressString(ChannelGlobals.NODE_ADDRESS_STRING, hash)); | ||
sb.append(" "); | ||
sb.append(info.getVersion()); | ||
sb.append("\n"); | ||
|
||
for(String type : info.getConnectInfosMap().keySet()) | ||
{ | ||
ConnectInfo conn_info = info.getConnectInfosMap().get(type); | ||
sb.append(String.format(" %s - %s %d\n", type, conn_info.getHost(), conn_info.getPort())); | ||
|
||
} | ||
|
||
|
||
|
||
return sb.toString(); | ||
|
||
} | ||
} |