當前位置: 首頁>>代碼示例>>Java>>正文


Java NetworkAdmin.getDefaultPublicAddressV6方法代碼示例

本文整理匯總了Java中com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin.getDefaultPublicAddressV6方法的典型用法代碼示例。如果您正苦於以下問題:Java NetworkAdmin.getDefaultPublicAddressV6方法的具體用法?Java NetworkAdmin.getDefaultPublicAddressV6怎麽用?Java NetworkAdmin.getDefaultPublicAddressV6使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin的用法示例。


在下文中一共展示了NetworkAdmin.getDefaultPublicAddressV6方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例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 ( 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.getDefaultPublicAddressV6方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。