当前位置: 首页>>代码示例>>Java>>正文


Java Router.getOnionPort方法代码示例

本文整理汇总了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;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:22,代码来源:IntroductionProcessor.java

示例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();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:14,代码来源:HttpConnection.java

示例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());
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:5,代码来源:ConnectionImpl.java


注:本文中的com.subgraph.orchid.Router.getOnionPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。