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


Java NetworkAdmin.hasIPV6Potential方法代码示例

本文整理汇总了Java中com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin.hasIPV6Potential方法的典型用法代码示例。如果您正苦于以下问题:Java NetworkAdmin.hasIPV6Potential方法的具体用法?Java NetworkAdmin.hasIPV6Potential怎么用?Java NetworkAdmin.hasIPV6Potential使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin的用法示例。


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

示例1: sendLTHandshake

import com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin; //导入方法依赖的package包/类
private void sendLTHandshake() {
	String client_name = Constants.AZUREUS_PROTOCOL_NAME + " " + Constants.AZUREUS_VERSION;
	int localTcpPort = TCPNetworkManager.getSingleton().getTCPListeningPortNumber();
	String tcpPortOverride = COConfigurationManager.getStringParameter("TCP.Listen.Port.Override");
	try
	{
		localTcpPort = Integer.parseInt(tcpPortOverride);
	} catch (NumberFormatException e)	{} // ignore as invalid input
	boolean require_crypto = NetworkManager.getCryptoRequired( manager.getAdapter().getCryptoLevel());
	
	Map data_dict = new HashMap();

	data_dict.put("v", client_name);
	data_dict.put("p", new Integer(localTcpPort));
	data_dict.put("e", new Long(require_crypto ? 1L : 0L));
	data_dict.put("upload_only", new Long(manager.isSeeding() && !( ENABLE_LAZY_BITFIELD || manual_lazy_bitfield_control )? 1L : 0L));
	
	int metainfo_size = is_metadata_download?0:manager.getTorrentInfoDictSize();
	
	if ( metainfo_size > 0 ){
		
		data_dict.put("metadata_size", new Integer(metainfo_size));
	}
	
	NetworkAdmin na = NetworkAdmin.getSingleton();
	
	if ( !na.isSocksActive()){
			// don't send public address in handshake
		InetAddress defaultV6 = na.hasIPV6Potential(true) ? na.getDefaultPublicAddressV6() : null;
		
		if(defaultV6 != null){
			data_dict.put("ipv6",defaultV6.getAddress());
		}
	}
	
	LTHandshake lt_handshake = new LTHandshake(data_dict, other_peer_bt_lt_ext_version );
	
	lt_handshake.addDefaultExtensionMappings( true, is_metadata_download || metainfo_size > 0 );
	
	connection.getOutgoingMessageQueue().addMessage(lt_handshake, false);
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:42,代码来源:PEPeerTransportProtocol.java

示例2: calcBind

import com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin; //导入方法依赖的package包/类
protected void
calcBind()
{
	if ( explicit_bind_ip != null ){
		
		if(altProtocolDelegate != null)
		{
			altProtocolDelegate.destroy();
			altProtocolDelegate = null;
		}
		
		target_bind_ip = explicit_bind_ip;
		
	}else{
		
		InetAddress altAddress = null;
		NetworkAdmin adm = NetworkAdmin.getSingleton();
		try
		{
			if (default_bind_ip instanceof Inet6Address && !default_bind_ip.isAnyLocalAddress() && adm.hasIPV4Potential())
				altAddress = adm.getSingleHomedServiceBindAddress(NetworkAdmin.IP_PROTOCOL_VERSION_REQUIRE_V4);
			else if (default_bind_ip instanceof Inet4Address && adm.hasIPV6Potential())
				altAddress = adm.getSingleHomedServiceBindAddress(NetworkAdmin.IP_PROTOCOL_VERSION_REQUIRE_V6);
		} catch (UnsupportedAddressTypeException e)
		{
		}
		
		if(altProtocolDelegate != null && !altProtocolDelegate.explicit_bind_ip.equals(altAddress))
		{
			altProtocolDelegate.destroy();
			altProtocolDelegate = null;
		}
		
		if(altAddress != null && altProtocolDelegate == null)
		{
			altProtocolDelegate = new PRUDPPacketHandlerImpl(port,altAddress,packet_transformer);
			altProtocolDelegate.stats = stats;
			altProtocolDelegate.primordial_handlers = primordial_handlers;
			altProtocolDelegate.request_handler = request_handler;
		}
			
		
		target_bind_ip = default_bind_ip;
	}
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:46,代码来源:PRUDPPacketHandlerImpl.java

示例3: sendLTHandshake

import com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin; //导入方法依赖的package包/类
private void sendLTHandshake() {
	String client_name = Constants.AZUREUS_PROTOCOL_NAME + " " + Constants.AZUREUS_VERSION;
	int localTcpPort = TCPNetworkManager.getSingleton().getTCPListeningPortNumber();
	String tcpPortOverride = COConfigurationManager.getStringParameter("TCP.Listen.Port.Override");
	try
	{
		localTcpPort = Integer.parseInt(tcpPortOverride);
	} catch (NumberFormatException e)	{} // ignore as invalid input
	boolean require_crypto = NetworkManager.getCryptoRequired( manager.getAdapter().getCryptoLevel());
	
	Map data_dict = new HashMap();

	data_dict.put("v", client_name);
	data_dict.put("p", new Integer(localTcpPort));
	data_dict.put("e", new Long(require_crypto ? 1L : 0L));
	
	boolean upload_only = 
			manager.isSeeding() && 
			!( ENABLE_LAZY_BITFIELD || manual_lazy_bitfield_control || manager.isSuperSeedMode());
	
		// maintain this for any kinds of compatability 
	
	data_dict.put( "upload_only", new Long(upload_only? 1L : 0L));
	
	int metainfo_size;
	
	if ( manager.isPrivateTorrent()){
		
		metainfo_size = 0;
		
	}else{
		
		metainfo_size = is_metadata_download?0:manager.getTorrentInfoDictSize();
	}
	
	if ( metainfo_size > 0 ){
		
		data_dict.put("metadata_size", new Integer(metainfo_size));
	}
	
	NetworkAdmin na = NetworkAdmin.getSingleton();
	
	if ( !na.isSocksActive()){
			// don't send public address in handshake
		InetAddress defaultV6 = na.hasIPV6Potential(true) ? na.getDefaultPublicAddressV6() : null;
		
		if(defaultV6 != null){
			data_dict.put("ipv6",defaultV6.getAddress());
		}
	}
	
	LTHandshake lt_handshake = new LTHandshake(data_dict, other_peer_bt_lt_ext_version );
	
	lt_handshake.addDefaultExtensionMappings( true, is_metadata_download || metainfo_size > 0, true );
	
	connection.getOutgoingMessageQueue().addMessage(lt_handshake, false);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:58,代码来源:PEPeerTransportProtocol.java

示例4: sendLTHandshake

import com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin; //导入方法依赖的package包/类
private void sendLTHandshake() {
	String client_name = Constants.AZUREUS_PROTOCOL_NAME + " " + Constants.AZUREUS_VERSION;
	int localTcpPort = TCPNetworkManager.getSingleton().getTCPListeningPortNumber();
	String tcpPortOverride = COConfigurationManager.getStringParameter("TCP.Listen.Port.Override");
	try
	{
		localTcpPort = Integer.parseInt(tcpPortOverride);
	} catch (NumberFormatException e)	{} // ignore as invalid input
	boolean require_crypto = NetworkManager.getCryptoRequired( manager.getAdapter().getCryptoLevel());
	
	Map data_dict = new HashMap();

	data_dict.put("v", client_name);
	data_dict.put("p", new Integer(localTcpPort));
	data_dict.put("e", new Long(require_crypto ? 1L : 0L));
	
	boolean upload_only = 
			manager.isSeeding() && 
			!( ENABLE_LAZY_BITFIELD || manual_lazy_bitfield_control || manager.isSuperSeedMode());
	
		// maintain this for any kinds of compatability 
	
	data_dict.put( "upload_only", new Long(upload_only? 1L : 0L));
	
	int metainfo_size;
	
	if ( manager.isPrivateTorrent()){
		
		metainfo_size = 0;
		
	}else{
		
		metainfo_size = is_metadata_download?0:manager.getTorrentInfoDictSize();
	}
	
	if ( metainfo_size > 0 ){
		
		data_dict.put("metadata_size", new Integer(metainfo_size));
	}
	
	NetworkAdmin na = NetworkAdmin.getSingleton();
	
	if ( peer_item_identity.getNetwork() == AENetworkClassifier.AT_PUBLIC && !na.isSocksActive()){
			// don't send public address in handshake
		InetAddress defaultV6 = na.hasIPV6Potential(true) ? na.getDefaultPublicAddressV6() : null;
		
		if(defaultV6 != null){
			data_dict.put("ipv6",defaultV6.getAddress());
		}
	}
	
	LTHandshake lt_handshake = new LTHandshake(data_dict, other_peer_bt_lt_ext_version );
	
	lt_handshake.addDefaultExtensionMappings( true, is_metadata_download || metainfo_size > 0, true );
	
	connection.getOutgoingMessageQueue().addMessage(lt_handshake, false);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:58,代码来源:PEPeerTransportProtocol.java


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