UPDATE 2.2
This commit is contained in:
@@ -0,0 +1,233 @@
|
||||
package org.kne.cloud.network.frpc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.net.URL;
|
||||
|
||||
import org.ini4j.Ini;
|
||||
import org.ini4j.InvalidFileFormatException;
|
||||
|
||||
public class FrpcIni extends Ini {
|
||||
|
||||
public FrpcIni() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FrpcIni(File input) throws IOException, InvalidFileFormatException {
|
||||
super(input);
|
||||
// TODO 自动生成的构造函数存根
|
||||
}
|
||||
|
||||
public FrpcIni(InputStream input) throws IOException, InvalidFileFormatException {
|
||||
super(input);
|
||||
// TODO 自动生成的构造函数存根
|
||||
}
|
||||
|
||||
public FrpcIni(Reader input) throws IOException, InvalidFileFormatException {
|
||||
super(input);
|
||||
// TODO 自动生成的构造函数存根
|
||||
}
|
||||
|
||||
public FrpcIni(URL input) throws IOException, InvalidFileFormatException {
|
||||
super(input);
|
||||
// TODO 自动生成的构造函数存根
|
||||
}
|
||||
|
||||
public FrpcIni(String str) throws InvalidFileFormatException {
|
||||
this();
|
||||
loadFromString(str);
|
||||
}
|
||||
|
||||
public void setServerAddr(String addr) {
|
||||
add("common", "server_addr", addr);
|
||||
}
|
||||
|
||||
public String getServerAddr() {
|
||||
return get("common", "server_addr");
|
||||
}
|
||||
|
||||
public void setToken(String addr) {
|
||||
add("common", "token", addr);
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return get("common", "token");
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
add("common", "protocol", protocol);
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return get("common", "protocol");
|
||||
}
|
||||
|
||||
public void setServerPort(int port) {
|
||||
add("common", "server_port", port);
|
||||
}
|
||||
|
||||
public int getServerPort() {
|
||||
return get("common", "server_port", int.class);
|
||||
}
|
||||
|
||||
public void setDnsServer(String dns) {
|
||||
add("common", "dns_server", dns);
|
||||
}
|
||||
|
||||
public String getDnsServer() {
|
||||
return get("common", "dns_server");
|
||||
}
|
||||
public void setConnectServerLocalIp(String connectserverlocalip) {
|
||||
add("common", "connect_server_local_ip", connectserverlocalip);
|
||||
}
|
||||
|
||||
public String getConnectServerLocalIp() {
|
||||
return get("common", "connect_server_local_ip");
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
add("common", "user", user);
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return get("common", "user");
|
||||
}
|
||||
|
||||
public void setTcpMux(boolean tcpmux) {
|
||||
add("common", "tcp_mux", tcpmux);
|
||||
}
|
||||
|
||||
public boolean getTcpMux() {
|
||||
return get("common", "tcp_mux",boolean.class);
|
||||
}
|
||||
|
||||
public void setTlsEnable(boolean tlsenable) {
|
||||
add("common", "tls_enable", tlsenable);
|
||||
}
|
||||
|
||||
public boolean getTlsEnable() {
|
||||
return get("common", "tls_enable",boolean.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void setType(String tunnel,String type) {
|
||||
add(tunnel, "type", type);
|
||||
}
|
||||
|
||||
public String getType(String tunnel) {
|
||||
return get(tunnel, "type");
|
||||
}
|
||||
public void setLocalIP (String tunnel,String localip) {
|
||||
add(tunnel, "local_ip", localip);
|
||||
}
|
||||
|
||||
public String getLocalIP(String tunnel) {
|
||||
return get(tunnel, "local_ip");
|
||||
}
|
||||
public void setLocalPort (String tunnel,int localport) {
|
||||
add(tunnel, "local_port", localport);
|
||||
}
|
||||
|
||||
public int getLocalPort(String tunnel) {
|
||||
return get(tunnel, "local_port",int.class);
|
||||
}
|
||||
public void setRemotePort (String tunnel,int remoteport) {
|
||||
add(tunnel, "remote_port", remoteport);
|
||||
}
|
||||
|
||||
public int getRemotePort(String tunnel) {
|
||||
return get(tunnel, "remote_port",int.class);
|
||||
}
|
||||
public void setUseEncryption (String tunnel,boolean useencryption) {
|
||||
add(tunnel, "use_encryption", useencryption);
|
||||
}
|
||||
|
||||
public boolean getUseEncryption(String tunnel) {
|
||||
return get(tunnel, "use_encryption",boolean.class);
|
||||
}
|
||||
public void setUseCompression (String tunnel,boolean usecompression) {
|
||||
add(tunnel, "use_compression", usecompression);
|
||||
}
|
||||
|
||||
public boolean getUseCompression(String tunnel) {
|
||||
return get(tunnel, "use_compression",boolean.class);
|
||||
}
|
||||
public void setSk(String tunnel,String sk) {
|
||||
add(tunnel, "sk", sk);
|
||||
}
|
||||
|
||||
public String getSk(String tunnel) {
|
||||
return get(tunnel, "sk");
|
||||
}
|
||||
public void setRole(String tunnel,String sk) {
|
||||
add(tunnel, "role", sk);
|
||||
}
|
||||
|
||||
public String getRole(String tunnel) {
|
||||
return get(tunnel, "role");
|
||||
}
|
||||
public void setServerName(String tunnel,String servername) {
|
||||
add(tunnel, "server_name", servername);
|
||||
}
|
||||
|
||||
public String getServerName(String tunnel) {
|
||||
return get(tunnel, "server_name");
|
||||
}
|
||||
|
||||
public void setBindAddr(String tunnel,String bindaddr) {
|
||||
add(tunnel, "bind_addr", bindaddr);
|
||||
}
|
||||
|
||||
public String getBindAddr(String tunnel) {
|
||||
return get(tunnel, "bind_addr");
|
||||
}
|
||||
public void setBindPort (String tunnel,int bindport) {
|
||||
add(tunnel, "bind_port", bindport);
|
||||
}
|
||||
|
||||
public int getBindPort(String tunnel) {
|
||||
return get(tunnel, "bind_port",int.class);
|
||||
}
|
||||
public void setKeepTunnelOpen (String tunnel,boolean keeptunnelopen) {
|
||||
add(tunnel, "keep_tunnel_open", keeptunnelopen);
|
||||
}
|
||||
|
||||
public boolean getKeepTunnelOpen(String tunnel) {
|
||||
return get(tunnel, "keep_tunnel_open",boolean.class);
|
||||
}
|
||||
|
||||
|
||||
public String storeToString() {
|
||||
StringWriter sw = new StringWriter();
|
||||
try {
|
||||
store(sw);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
public void loadFromString(String ini) throws InvalidFileFormatException {
|
||||
try {
|
||||
load(new StringReader(ini));
|
||||
} catch (InvalidFileFormatException e) {
|
||||
throw e;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user