📄 configuration.java
字号:
package javatunnel;/** * * JavaTunnel * * Copyright (C) 2002 Andr閟 Ederra * * 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. */public class Configuration { public static final int mode_index = 0; public static final int MODE_REDIRECT = mode_index + 1; public static final String MODE_REDIRECT_STRING = "Redirect"; public static final int MODE_SSL = mode_index + 2; public static final String MODE_SSL_STRING = "SSLProxy"; public static final int MODE_HTTP = mode_index + 3; public static final String MODE_HTTP_STRING = "HTTPTunnel"; public static int BUFFERSIZE = 10000; private boolean useProxy = false; private String proxyAddress = null; private String destinationAddress = null; private String serverAddress = null; private int destinationPort = 0; private int proxyPort = 0; private int localPort = 0; private int serverPort = 0; private int mode; private boolean manageHostsFile = false; public Configuration(String configFile) { } public Configuration( String destinationAddress, int destinationPort, String proxyAddress, int proxyPort, int localPort) { setDestinationAddress(destinationAddress); setDestinationPort(destinationPort); setLocalPort(localPort); setProxyAddress(proxyAddress); setProxyPort(proxyPort); } public Configuration( String destinationAddress, int destinationPort, String proxyAddress, int proxyPort, String serverAddress, int serverPort, int localPort) { this( destinationAddress, destinationPort, proxyAddress, proxyPort, localPort); setServerAddress(serverAddress); setServerPort(serverPort); } public Configuration( String destinationAddress, int destinationPort, int localPort) { } public Configuration() { } /** * Gets the destinationPort. * * @return Returns a int */ public int getDestinationPort() { return destinationPort; } /** * Sets the destinationPort. * * @param destinationPort * The destinationPort to set */ public void setDestinationPort(int destinationPort) { this.destinationPort = destinationPort; } /** * Gets the localPort. * * @return Returns a int */ public int getLocalPort() { return localPort; } /** * Sets the localPort. * * @param localPort * The localPort to set */ public void setLocalPort(int localPort) { this.localPort = localPort; } /** * Gets the useProxy. * * @return Returns a boolean */ public boolean getUseProxy() { return useProxy; } /** * Sets the useProxy. * * @param useProxy * The useProxy to set */ public void setUseProxy(boolean useProxy) { this.useProxy = useProxy; } public void setProxyAddress(String proxyAddress) { this.proxyAddress = proxyAddress; } public String getProxyAddress() { return proxyAddress; } /** * Returns the destinationAddress. * * @return String */ public String getDestinationAddress() { return destinationAddress; } /** * Returns the proxyPort. * * @return int */ public int getProxyPort() { return proxyPort; } /** * Returns the serverPort. * * @return int */ public int getServerPort() { return serverPort; } /** * Returns the useProxy. * * @return boolean */ public boolean isUseProxy() { return useProxy; } /** * Sets the destinationAddress. * * @param destinationAddress * The destinationAddress to set */ public void setDestinationAddress(String destinationAddress) { this.destinationAddress = destinationAddress; } /** * Sets the proxyPort. * * @param proxyPort * The proxyPort to set */ public void setProxyPort(int proxyPort) { this.proxyPort = proxyPort; } /** * Sets the serverPort. * * @param serverPort * The serverPort to set */ public void setServerPort(int serverPort) { this.serverPort = serverPort; } /** * Returns the serverAddress. * * @return String */ public String getServerAddress() { return serverAddress; } /** * Sets the serverAddress. * * @param serverAddress * The serverAddress to set */ public void setServerAddress(String serverAddress) { this.serverAddress = serverAddress; } /** * Returns the mode. * * @return int */ public int getMode() { return mode; } /** * Sets the mode. * * @param mode * The mode to set */ public void setMode(int mode) { this.mode = mode; } /** * Sets the mode. * * @param mode * The mode to set */ public void setMode(String mode) { if (mode.equalsIgnoreCase(MODE_REDIRECT_STRING)) this.mode = MODE_REDIRECT; if (mode.equalsIgnoreCase(MODE_SSL_STRING)) this.mode = MODE_SSL; if (mode.equalsIgnoreCase(MODE_HTTP_STRING)) this.mode = MODE_HTTP; } /** * @return Returns the manageHostFile. */ public boolean isManageHostsFile() { return manageHostsFile; } /** * @param manageHostFile * The manageHostFile to set. */ public void setManageHostsFile(boolean manageHostFile) { this.manageHostsFile = manageHostFile; } static public String getModeString(int modeInt) { if (modeInt == MODE_REDIRECT) return MODE_REDIRECT_STRING; if (modeInt == MODE_SSL) return MODE_SSL_STRING; if (modeInt == MODE_HTTP) return MODE_HTTP_STRING; return "Unknown"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -