📄 configurationdefaults.java
字号:
/* Written and copyright 2001-2003 Tobias Minich.
*
* ConfigurationDefaults.java
*
* Created on 31. Juli 2003, 21:31
* Copyright (C) 2003, 2004, 2005, 2006 Aelitis, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* AELITIS, SAS au capital de 46,603.30 euros
* 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
*
*/
package org.gudy.azureus2.core3.config.impl;
import java.util.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.stats.StatsWriterPeriodic;
import org.gudy.azureus2.core3.torrent.TOTorrent;
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncer;
import org.gudy.azureus2.core3.tracker.host.TRHost;
import org.gudy.azureus2.core3.tracker.server.TRTrackerServer;
import org.gudy.azureus2.core3.util.*;
/**
*
* @author Tobias Minich
*/
/**
* Some (proposed) option naming conventions:
* - Starts with a general identifier
* General_ for, well, general things =)
* Server_ for webinterface specific things
* GUI_ (eventually) for GUI specific things
* Core_ (eventually) for core specific things
* - Second is some identifing term. It starts with a small letter denoting
* the vaiable type.
* b Boolean
* i Integer
* s String
* - Directory options should end with _Directory. This activates some
* special validity checks in the webinterface option parsing code.
* (Namely they are created if they don't exist and the option isn't changed
* with a logged error if a normal file of the same name exists)
*/
public class ConfigurationDefaults {
private static final Long ZERO = new Long(0);
private static final Long ONE = new Long(1);
private static final Long FALSE = ZERO;
private static final Long TRUE = ONE;
private static ConfigurationDefaults configdefaults;
private static AEMonitor class_mon = new AEMonitor( "ConfigDef");
private HashMap def = null;
public int def_int = 0;
public long def_long = 0;
public float def_float = 0;
public int def_boolean = 0;
public String def_String = "";
public byte[] def_bytes = null;
private Hashtable parameter_verifiers = new Hashtable();
public static ConfigurationDefaults
getInstance()
{
try{
class_mon.enter();
if(configdefaults == null){
configdefaults = new ConfigurationDefaults();
}
return configdefaults;
}finally{
class_mon.exit();
}
}
/** Creates a new instance of Defaults */
protected
ConfigurationDefaults()
{
def = new HashMap();
/** Core settings **/
def.put("Override Ip", "");
def.put("Enable incremental file creation", FALSE);
def.put("TCP.Listen.Port", new Long( 6881 ));
def.put("TCP.Listen.Port.Enable", TRUE );
def.put("UDP.Listen.Port", new Long( 6881 ));
def.put("UDP.Listen.Port.Enable", TRUE );
def.put("UDP.NonData.Listen.Port", new Long( 6881 )); // two effective enablers for this, dht + tracker udp client
def.put("UDP.NonData.Listen.Port.Same", TRUE ); // control over whether non-data and data udp port are the same
def.put("HTTP.Data.Listen.Port", new Long( Constants.isWindows?80:8080 ));
def.put("HTTP.Data.Listen.Port.Override", ZERO);
def.put("HTTP.Data.Listen.Port.Enable", FALSE );
def.put("max active torrents", new Long(4));
def.put("max downloads", new Long(4));
def.put("min downloads", ONE);
def.put("Newly Seeding Torrents Get First Priority", TRUE);
def.put("Max.Peer.Connections.Per.Torrent", new Long(COConfigurationManager.CONFIG_DEFAULT_MAX_CONNECTIONS_PER_TORRENT));
def.put("Max.Peer.Connections.Per.Torrent.When.Seeding", new Long(COConfigurationManager.CONFIG_DEFAULT_MAX_CONNECTIONS_PER_TORRENT));
def.put("Max.Peer.Connections.Per.Torrent.When.Seeding.Enable", FALSE );
def.put("Max.Peer.Connections.Total", new Long(COConfigurationManager.CONFIG_DEFAULT_MAX_CONNECTIONS_GLOBAL));
def.put( "Peer.Fast.Initial.Unchoke.Enabled", FALSE );
def.put( "File Max Open", new Long(50));
def.put( "Use Config File Backups", TRUE);
def.put( "Max Uploads", new Long(4) );
def.put( "Max Uploads Seeding", new Long(4));
def.put( "enable.seedingonly.maxuploads", FALSE );
def.put( "max.uploads.when.busy.inc.min.secs", new Long( 30 ));
def.put( "Max Download Speed KBs", ZERO );
def.put( "Max Upload Speed KBs", ZERO);
def.put( "Max Upload Speed Seeding KBs", ZERO );
def.put( "enable.seedingonly.upload.rate", FALSE );
def.put( "Auto Upload Speed Enabled", FALSE );
def.put( "Auto Upload Speed Seeding Enabled", FALSE );
def.put( "AutoSpeed Available", FALSE ); // informative read-only parameter
def.put( "AutoSpeed Min Upload KBs", ZERO );
def.put( "AutoSpeed Max Upload KBs", ZERO );
def.put( "AutoSpeed Max Increment KBs", ONE);
def.put( "AutoSpeed Max Decrement KBs", new Long(4));
def.put( "AutoSpeed Choking Ping Millis", new Long(200) );
def.put( "AutoSpeed Download Adj Enable", FALSE );
def.put( "AutoSpeed Download Adj Ratio", "1.0" );
def.put( "AutoSpeed Latency Factor", new Long(50));
def.put( "Auto Upload Speed Debug Enabled", FALSE );
def.put( "ASN Autocheck Performed Time", ZERO );
def.put( "LAN Speed Enabled", TRUE );
def.put( "Max LAN Download Speed KBs", ZERO );
def.put( "Max LAN Upload Speed KBs", ZERO );
def.put("Use Resume", TRUE);
def.put("On Resume Recheck All", FALSE);
def.put("Save Resume Interval", new Long(5));
def.put("Check Pieces on Completion", TRUE);
def.put("Stop Ratio", new Float(0));
def.put("Stop Peers Ratio", ZERO);
def.put("Disconnect Seed", TRUE);
def.put("Seeding Piece Check Recheck Enable", TRUE );
def.put("priorityExtensions", "");
def.put("priorityExtensionsIgnoreCase", FALSE);
def.put("Ip Filter Enabled", TRUE);
def.put("Ip Filter Allow",FALSE);
def.put("Ip Filter Enable Banning", TRUE);
def.put("Ip Filter Ban Block Limit", new Long(4));
def.put("Ip Filter Banning Persistent", TRUE);
def.put("Ip Filter Enable Description Cache", TRUE);
def.put("Allow Same IP Peers",FALSE);
def.put("Use Super Seeding",FALSE);
def.put("Pause Downloads On Exit", FALSE );
def.put("Resume Downloads On Start", FALSE );
// SWT GUI Settings
def.put("User Mode", ZERO);
//default data location options
def.put("Use default data dir", FALSE);
def.put("Default save path", "" );
def.put("update.start",TRUE);
def.put("update.periodic",TRUE);
def.put("update.opendialog",TRUE);
// Logging
def.put("Logger.Enabled", FALSE); //logging in general
def.put("Logging Enable", FALSE); //file logging
def.put("Logging Dir", "");
def.put("Logging Max Size", new Long(5));
int[] logComponents = { 0, 1, 2, 4 };
for (int i = 0; i < logComponents.length; i++)
for (int j = 0; j <= 3; j++)
def.put("bLog" + logComponents[i] + "-" + j, TRUE);
def.put("Logger.DebugFiles.Enabled", TRUE);
def.put("Logging Enable UDP Transport", FALSE);
//tracker proxy defaults
def.put( "Enable.Proxy", FALSE );
def.put( "Enable.SOCKS", FALSE );
def.put( "Proxy.Host", "" );
def.put( "Proxy.Port", "" );
def.put( "Proxy.Username", "<none>" ); // default is explicit "none", as opposed to "not defined"
def.put( "Proxy.Password", "" );
def.put( "Proxy.Check.On.Start", TRUE );
// data proxy defaults
def.put( "Proxy.Data.Enable", FALSE);
def.put( "Proxy.Data.SOCKS.version", "V4" );
def.put( "Proxy.Data.SOCKS.inform", TRUE);
def.put( "Proxy.Data.Same", TRUE);
def.put( "Proxy.Data.Host", "" );
def.put( "Proxy.Data.Port", "" );
def.put( "Proxy.Data.Username", "<none>" );
def.put( "Proxy.Data.Password", "" );
//old
def.put( "Start Num Peers", new Long(-1) );
def.put( "Max Upload Speed", new Long(-1) );
def.put( "Max Clients", new Long(-1) );
def.put( "Server.shared.port", TRUE );
def.put( "Low Port", new Long(6881) );
def.put( "Already_Migrated", FALSE );
//misc
def.put( "ID", "" );
def.put( "Play Download Finished", FALSE );
def.put( "Play Download Finished File", "" );
def.put( "Watch Torrent Folder", FALSE );
def.put( "Watch Torrent Folder Interval", ONE );
def.put( "Start Watched Torrents Stopped", FALSE );
def.put( "Watch Torrent Folder Path", "" );
def.put( "Prioritize First Piece", FALSE );
def.put( "Prioritize Most Completed Files", FALSE );
def.put( "Use Lazy Bitfield", FALSE );
def.put( "Zero New", FALSE );
def.put( "XFS Allocation", FALSE );
def.put( "Copy And Delete Data Rather Than Move", FALSE);
def.put( "File.save.peers.enable", TRUE );
def.put( "File.strict.locking", TRUE );
def.put( "Move Deleted Data To Recycle Bin", TRUE);
def.put( "Popup Download Finished", FALSE);
def.put( "Popup File Finished", FALSE);
def.put( "Popup Download Added", FALSE);
def.put( "Show Timestamp For Alerts", FALSE);
//default torrent directory option
def.put( "Save Torrent Files", TRUE );
def.put("General_sDefaultTorrent_Directory", SystemProperties.getUserPath()+"torrents");
def.put( "Bind IP", "" );
def.put( "Stats Export Peer Details", FALSE );
def.put( "Stats XSL File", "" );
def.put( "Stats Enable", FALSE );
def.put( "Stats Period", new Long(StatsWriterPeriodic.DEFAULT_SLEEP_PERIOD) );
def.put( "Stats Dir", "" );
def.put( "Stats File", StatsWriterPeriodic.DEFAULT_STATS_FILE_NAME );
def.put( "File.Torrent.IgnoreFiles", TOTorrent.DEFAULT_IGNORE_FILES );
def.put( "File.save.peers.max", new Long( TRTrackerAnnouncer.DEFAULT_PEERS_TO_CACHE ) );
// tracker
def.put( "Tracker Compact Enable", TRUE );
def.put( "Tracker Key Enable Client", TRUE );
def.put( "Tracker Key Enable Server", TRUE );
def.put( "Tracker Separate Peer IDs", FALSE);
def.put( "Tracker Client Connect Timeout", new Long(120));
def.put( "Tracker Client Read Timeout", new Long(60));
def.put( "Tracker Client Send OS and Java Version", TRUE);
def.put( "Tracker Client Show Warnings", TRUE);
def.put( "Tracker Public Enable", FALSE );
def.put( "Tracker Log Enable", FALSE );
def.put( "Tracker Port Enable", FALSE );
def.put( "Tracker Port", new Long( TRHost.DEFAULT_PORT ) );
def.put( "Tracker Port Backups", "" );
def.put( "Tracker Port SSL Enable", FALSE );
def.put( "Tracker Port SSL", new Long( TRHost.DEFAULT_PORT_SSL ) );
def.put( "Tracker Port SSL Backups", "" );
def.put( "Tracker Port Force External", FALSE );
def.put( "Tracker Host Add Our Announce URLs", TRUE );
def_put( "Tracker IP", "", new IPVerifier());
def.put( "Tracker Port UDP Enable", FALSE );
def.put( "Tracker Port UDP Version", new Long(2) );
def.put( "Tracker Send Peer IDs", TRUE );
def.put( "Tracker Max Peers Returned", new Long(100) );
def.put( "Tracker Scrape Cache", new Long( TRTrackerServer.DEFAULT_SCRAPE_CACHE_PERIOD ) );
def.put( "Tracker Announce Cache", new Long( TRTrackerServer.DEFAULT_ANNOUNCE_CACHE_PERIOD ) );
def.put( "Tracker Announce Cache Min Peers", new Long( TRTrackerServer.DEFAULT_ANNOUNCE_CACHE_PEER_THRESHOLD ) );
def.put( "Tracker Poll Interval Min", new Long( TRTrackerServer.DEFAULT_MIN_RETRY_DELAY) );
def.put( "Tracker Poll Interval Max", new Long( TRTrackerServer.DEFAULT_MAX_RETRY_DELAY) );
def.put( "Tracker Scrape Retry Percentage", new Long( TRTrackerServer.DEFAULT_SCRAPE_RETRY_PERCENTAGE ) );
def.put( "Tracker Password Enable Web", FALSE );
def.put( "Tracker Password Web HTTPS Only", FALSE);
def.put( "Tracker Password Enable Torrent", FALSE );
def.put( "Tracker Username", "" );
def.put( "Tracker Password", null );
def.put( "Tracker Poll Inc By", new Long( TRTrackerServer.DEFAULT_INC_BY ) );
def.put( "Tracker Poll Inc Per", new Long( TRTrackerServer.DEFAULT_INC_PER ) );
def.put( "Tracker NAT Check Enable", TRUE);
def.put( "Tracker NAT Check Timeout", new Long(TRTrackerServer.DEFAULT_NAT_CHECK_SECS));
def.put( "Tracker Max Seeds Retained", ZERO );
def.put( "Tracker Max Seeds", ZERO );
def.put( "Tracker Max GET Time", new Long(20));
def.put( "Tracker Max POST Time Multiplier", ONE);
def.put( "Tracker Max Threads", new Long( 48 ));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -