本文整理汇总了Java中com.subgraph.orchid.Router.getOnionPort方法的典型用法代码示例。如果您正苦于以下问题:Java Router.getOnionPort方法的具体用法?Java Router.getOnionPort怎么用?Java Router.getOnionPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.subgraph.orchid.Router
的用法示例。
在下文中一共展示了Router.getOnionPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIntroductionBuffer
import com.subgraph.orchid.Router; //导入方法依赖的package包/类
private ByteBuffer createIntroductionBuffer(int timestamp, Router rr, byte[] cookie, byte[] dhPublic) {
final ByteBuffer buffer = ByteBuffer.allocate(Cell.CELL_LEN);
final byte[] rpAddress = rr.getAddress().getAddressDataBytes();
final short rpPort = (short) rr.getOnionPort();
final byte[] rpIdentity = rr.getIdentityHash().getRawBytes();
final byte[] rpOnionKey = rr.getOnionKey().getRawBytes();
buffer.put((byte) INTRODUCTION_PROTOCOL_VERSION); // VER Version byte: set to 3. [1 octet]
addAuthentication(buffer);
//buffer.put((byte) 0); // AUTHT The auth type that is used [1 octet]
buffer.putInt(timestamp); // TS A timestamp [4 octets]
buffer.put(rpAddress); // IP Rendezvous point's address [4 octets]
buffer.putShort(rpPort); // PORT Rendezvous point's OR port [2 octets]
buffer.put(rpIdentity); // ID Rendezvous point identity ID [20 octets]
buffer.putShort((short) rpOnionKey.length); // KLEN Length of onion key [2 octets]
buffer.put(rpOnionKey); // KEY Rendezvous point onion key [KLEN octets]
buffer.put(cookie); // RC Rendezvous cookie [20 octets]
buffer.put(dhPublic); // g^x Diffie-Hellman data, part 1 [128 octets]
return buffer;
}
示例2: getHostnameFromStream
import com.subgraph.orchid.Router; //导入方法依赖的package包/类
private static String getHostnameFromStream(Stream stream) {
final StringBuilder sb = new StringBuilder();
final Router r = stream.getCircuit().getFinalCircuitNode().getRouter();
if(r == null) {
return null;
}
sb.append(r.getAddress().toString());
if(r.getOnionPort() != 80) {
sb.append(":");
sb.append(r.getOnionPort());
}
return sb.toString();
}
示例3: routerToSocketAddress
import com.subgraph.orchid.Router; //导入方法依赖的package包/类
private SocketAddress routerToSocketAddress(Router router) {
final InetAddress address = router.getAddress().toInetAddress();
return new InetSocketAddress(address, router.getOnionPort());
}