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


Java DHTtype.IPV4_DHT属性代码示例

本文整理汇总了Java中lbms.plugins.mldht.kad.DHT.DHTtype.IPV4_DHT属性的典型用法代码示例。如果您正苦于以下问题:Java DHTtype.IPV4_DHT属性的具体用法?Java DHTtype.IPV4_DHT怎么用?Java DHTtype.IPV4_DHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在lbms.plugins.mldht.kad.DHT.DHTtype的用法示例。


在下文中一共展示了DHTtype.IPV4_DHT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: asNodeList

public NodeList asNodeList() {
	return new NodeList() {
		
		@Override
		public int packedSize() {
			return entries.size() * owner.getType().NODES_ENTRY_LENGTH;
		}
		
		@Override
		public Stream<KBucketEntry> entries() {
			return entries.stream();
		}

		@Override
		public AddressType type() {
			return owner.getType() == DHTtype.IPV4_DHT ? AddressType.V4 : AddressType.V6;
		}
	};
}
 
开发者ID:atomashpolskiy,项目名称:bt,代码行数:19,代码来源:KClosestNodesSearch.java

示例2: roundTripPut

StorageItem roundTripPut(StorageItem in) throws IOException, MessageException {
	// create message from item
	PutRequest req = new PutRequest();
	req.populateFromStorage(in);
	req.setID(Key.createRandomKey());
	req.setMTID(new byte[4]);
	req.setToken(new byte[4]);

	// encode
	ByteBuffer encoded = ByteBuffer.allocate(1500);
	req.encode(encoded);
	
	// decode
	Map<String, Object> decoded = new BDecoder().decode(encoded.duplicate());
	MessageDecoder decoder = new MessageDecoder(null, DHTtype.IPV4_DHT);
	decoder.toDecode(encoded, decoded);
	PutRequest roundTripped = (PutRequest) decoder.parseMessage();
	
	// re-create item from round-tripped message
	return new StorageItem(roundTripped);
}
 
开发者ID:atomashpolskiy,项目名称:bt,代码行数:21,代码来源:Bep44.java

示例3: MldhtService

@Inject
public MldhtService(IRuntimeLifecycleBinder lifecycleBinder, Config config, DHTConfig dhtConfig) {
    this.dht = new DHT(dhtConfig.shouldUseIPv6()? DHTtype.IPV6_DHT : DHTtype.IPV4_DHT);
    this.config = toMldhtConfig(dhtConfig);
    this.localAddress = config.getAcceptorAddress();
    this.useRouterBootstrap = dhtConfig.shouldUseRouterBootstrap();
    this.publicBootstrapNodes = dhtConfig.getPublicBootstrapNodes();
    this.bootstrapNodes = dhtConfig.getBootstrapNodes();

    lifecycleBinder.onStartup(LifecycleBinding.bind(this::start).description("Initialize DHT facilities").async().build());
    lifecycleBinder.onShutdown("Shutdown DHT facilities", this::shutdown);
}
 
开发者ID:atomashpolskiy,项目名称:bt,代码行数:12,代码来源:MldhtService.java

示例4: getNodes

public NodeList getNodes(DHTtype type)
{
	if(type == DHTtype.IPV4_DHT)
		return nodes;
	if(type == DHTtype.IPV6_DHT)
		return nodes6;
	return null;
}
 
开发者ID:atomashpolskiy,项目名称:bt,代码行数:8,代码来源:AbstractLookupResponse.java


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