📄 mconfig.java
字号:
package net.jumperz.app.MDragonfly;
import java.io.*;
import java.util.*;
public class MConfig
{
private static MConfig instance = new MConfig();
private File configFile;
private Properties prop;
private int threadCount;
private String logFileName;
private String algorithm;
private String privateKeyFileName;
private String certificateFileName;
private String host;
private String targetHost;
private int port;
private int targetPort;
//-----------------------------------------------------------------------------------
private MConfig()
{
// do nothing
}
//-----------------------------------------------------------------------------------
public static MConfig getInstance()
{
return instance;
}
//-----------------------------------------------------------------------------------
public void load( String configFileName )
throws IOException
{
configFile = new File( configFileName );
prop = new Properties();
prop.load( new FileInputStream( configFile ) );
threadCount = Integer.parseInt( prop.getProperty( "threadCount" ) );
logFileName = prop.getProperty( "logFileName" );
privateKeyFileName = prop.getProperty( "privateKeyFileName" );
certificateFileName = prop.getProperty( "certificateFileName" );
algorithm = prop.getProperty( "algorithm" );
if( !algorithm.equalsIgnoreCase( "RSA" )
&& !algorithm.equalsIgnoreCase( "DSA" )
)
{
throw new IOException( "Algorithm must be 'RSA' or 'DSA'." );
}
port = Integer.parseInt( prop.getProperty( "port" ) );
targetPort = Integer.parseInt( prop.getProperty( "targetPort" ) );
host = prop.getProperty( "host" );
targetHost = prop.getProperty( "targetHost" );
}
//-----------------------------------------------------------------------------------
public String getLogFileName()
{
return logFileName;
}
//-----------------------------------------------------------------------------------
public int getThreadCount()
{
return threadCount;
}
//-----------------------------------------------------------------------------------
public String getAlgorithm() {
return algorithm;
}
public String getCertificateFileName() {
return certificateFileName;
}
public String getPrivateKeyFileName() {
return privateKeyFileName;
}
public String getHost() {
return host;
}
public int getPort() {
return port;
}
public String getTargetHost() {
return targetHost;
}
public int getTargetPort() {
return targetPort;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -