⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaulttunnel.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
/*
 *  SSL-Explorer
 *
 *  Copyright (C) 2003-2006 3SP LTD. 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
			
package com.sslexplorer.vpn.base;

import com.sslexplorer.vpn.util.*;

public class DefaultTunnel implements Tunnel {

    int id, type;
    String username;
    boolean autoStart;
    String transport;
    int sourcePort;
    int destinationPort;
    String destinationHost;
    boolean allowExternalHosts;
    boolean permanent;
    boolean temporarySingleConnect;
    String ticket;
    String name;
    boolean useLocalhostWorkaround = false;

    public DefaultTunnel() {
        this(-1, LOCAL_TUNNEL, false, TCP_TUNNEL, "", -1, -1, "localhost", false, true, true, "", false);
    }

    /**
     * @param id tunnel id
     * @param type type
     * @param autoStart automatically start tunnel upon login
     * @param transport transport
     * @param username username
     * @param sourcePort source port
     * @param destinationPort destination port
     * @param destinationHost destination host
     * @param allowExternHosts allow external hosts
     * @param permanent permanent
     * @param temporarySingleConnect temporary single connect
     * @param name tunnel name
     */
    public DefaultTunnel(int id, int type, boolean autoStart, String transport, String username, int sourcePort,
                         int destinationPort, String destinationHost, boolean allowExternalHosts, boolean permanent,
                         boolean temporarySingleConnect, String name, boolean useLocalhostWorkaround) {
        this.id = id;
        this.type = type;
        this.autoStart = autoStart;
        this.transport = transport;
        this.permanent = permanent;
        this.username = username;
        this.allowExternalHosts = allowExternalHosts;
        this.sourcePort = sourcePort;
        this.destinationPort = destinationPort;
        this.destinationHost = destinationHost;
        this.temporarySingleConnect = temporarySingleConnect;
        this.name = name;
        this.useLocalhostWorkaround = useLocalhostWorkaround;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#getId()
     */
    public int getId() {
        return id;
    }

    public String getTicket() {
        return ticket;
    }

    public void setTicket(String ticket) {
        this.ticket = ticket;
    }

    public String getName() {
        return name;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#getType()
     */
    public int getType() {
        return type;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#isAutoStart()
     */
    public boolean isAutoStart() {
        return autoStart;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#isPermanent()
     */
    public boolean isPermanent() {
        return permanent;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#getTransport()
     */
    public String getTransport() {
        return transport;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#getUsername()
     */
    public String getUsername() {
        return username;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#getSourcePort()
     */
    public int getSourcePort() {
        return sourcePort;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#getDestinationPort()
     */
    public int getDestinationPort() {
        return destinationPort;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#getDestinationHost()
     */
    public String getDestinationHost() {
        return destinationHost;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.forwarding.Tunnel#isAllowExternalHosts()
     */
    public boolean isAllowExternalHosts() {
        return allowExternalHosts;
    }
    
    public boolean isLocalhostWorkaround() {
    	return useLocalhostWorkaround;
    }
    
    public void setLocalhostWorkaround(boolean useLocalhostWorkaround) {
    	this.useLocalhostWorkaround = useLocalhostWorkaround;
    }

    /**
     * @param allowExternalHosts The allowExternalHosts to set.
     */
    public void setAllowExternalHosts(boolean allowExternalHosts) {
        this.allowExternalHosts = allowExternalHosts;
    }

    /**
     * @param autoStart The autoStart to set.
     */
    public void setAutoStart(boolean autoStart) {
        this.autoStart = autoStart;
    }

    /**
     * @param destinationHost The destinationHost to set.
     */
    public void setDestinationHost(String destinationHost) {
        this.destinationHost = destinationHost;
    }

    /**
     * @param destinationPort The destinationPort to set.
     */
    public void setDestinationPort(int destinationPort) {
        this.destinationPort = destinationPort;
    }

    /**
     * @param id The id to set.
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * @param sourcePort The sourcePort to set.
     */
    public void setSourcePort(int sourcePort) {
        this.sourcePort = sourcePort;
    }

    /**
     * @param transport The transport to set.
     */
    public void setTransport(String transport) {
        this.transport = transport;
    }

    /**
     * @param type The type to set.
     */
    public void setType(int type) {
        this.type = type;
    }

    /**
     * @param username The username to set.
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.vpn.base.Tunnel#isTemporarySingleConnect()
     */
    public boolean isTemporarySingleConnect() {
        return temporarySingleConnect;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -