✨ feat(web): integrate embedded web server, REST/SSE APIs and modernize configuration
- Add embedded KLALBWebServer with REST API, SSE streaming (200ms) and SPA hosting - Introduce enableTUN configuration flag with fallback and non-admin execution support - Refactor LineTable and ConnectLineTable to openConnections and autoConnections - Rename denyLineTableQuery/Broadcast to denyConnectionQuery/Broadcast with backwards compatibility - Support runtime config hot-reloading and automatic persistence to klalb-config.json - Update default Web API port to 4665 and update dashboard submodule reference
This commit is contained in:
@@ -16,12 +16,12 @@ public class KLALBControllerConfigItem extends KLALBConfigItem {
|
||||
private MultiProtocolSocketAddress TCPListen=new MultiProtocolSocketAddress("0.0.0.0",4565);
|
||||
private MultiProtocolSocketAddress UDPListen=new MultiProtocolSocketAddress("udp","0.0.0.0",4565);
|
||||
private String VirtualSocketName;
|
||||
private List<MultiProtocolSocketAddress>LineTable=new ArrayList<>();
|
||||
private List<MultiProtocolSocketAddress>ConnectLineTable=new ArrayList<>();
|
||||
private List<MultiProtocolSocketAddress>ntpServerTable=new ArrayList<>();
|
||||
private List<String>ExtraRoutes=new ArrayList<>();
|
||||
private boolean denyLineTableQuery=false;
|
||||
private boolean denyLineTableBroadcast=false;
|
||||
private List<MultiProtocolSocketAddress> openConnections = new ArrayList<>();
|
||||
private List<MultiProtocolSocketAddress> autoConnections = new ArrayList<>();
|
||||
private List<MultiProtocolSocketAddress> ntpServers = new ArrayList<>();
|
||||
private List<String> ExtraRoutes = new ArrayList<>();
|
||||
private boolean denyConnectionQuery = false;
|
||||
private boolean denyConnectionBroadcast = false;
|
||||
private String congestionAlgorithm="BBR";
|
||||
private double burstLimit=1.50;
|
||||
private double delayUpperBound=1.20;
|
||||
@@ -29,10 +29,37 @@ public class KLALBControllerConfigItem extends KLALBConfigItem {
|
||||
private long nagleDelayTime=1000000L;
|
||||
private long linkNagleDelayTime=1000000L;
|
||||
private int linkConnectionsCount=1;
|
||||
private boolean enableTUN = true;
|
||||
private String TUNName=CONST.KLALB_S_RV6;
|
||||
private String performanceStrategy="multifill";
|
||||
private String DeviceName;
|
||||
private String DeviceDescription;
|
||||
private boolean webUI = false;
|
||||
private int webPort = 4665;
|
||||
|
||||
public boolean isEnableTUN() {
|
||||
return enableTUN;
|
||||
}
|
||||
|
||||
public void setEnableTUN(boolean enableTUN) {
|
||||
this.enableTUN = enableTUN;
|
||||
}
|
||||
|
||||
public boolean isWebUI() {
|
||||
return webUI;
|
||||
}
|
||||
|
||||
public void setWebUI(boolean webUI) {
|
||||
this.webUI = webUI;
|
||||
}
|
||||
|
||||
public int getWebPort() {
|
||||
return webPort;
|
||||
}
|
||||
|
||||
public void setWebPort(int webPort) {
|
||||
this.webPort = webPort;
|
||||
}
|
||||
|
||||
public String getPerformanceStrategy() {
|
||||
return performanceStrategy;
|
||||
@@ -177,39 +204,52 @@ public class KLALBControllerConfigItem extends KLALBConfigItem {
|
||||
|
||||
|
||||
|
||||
public List<MultiProtocolSocketAddress> getLineTable() {
|
||||
return LineTable;
|
||||
public List<MultiProtocolSocketAddress> getOpenConnections() {
|
||||
return openConnections;
|
||||
}
|
||||
|
||||
public void setOpenConnections(List<MultiProtocolSocketAddress> openConnections) {
|
||||
this.openConnections = openConnections;
|
||||
}
|
||||
|
||||
public List<MultiProtocolSocketAddress> getLineTable() {
|
||||
return openConnections;
|
||||
}
|
||||
|
||||
public void setLineTable(List<MultiProtocolSocketAddress> lineTable) {
|
||||
LineTable = lineTable;
|
||||
this.openConnections = lineTable;
|
||||
}
|
||||
|
||||
public List<MultiProtocolSocketAddress> getAutoConnections() {
|
||||
return autoConnections;
|
||||
}
|
||||
|
||||
public void setAutoConnections(List<MultiProtocolSocketAddress> autoConnections) {
|
||||
this.autoConnections = autoConnections;
|
||||
}
|
||||
|
||||
public List<MultiProtocolSocketAddress> getConnectLineTable() {
|
||||
return ConnectLineTable;
|
||||
return autoConnections;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setConnectLineTable(List<MultiProtocolSocketAddress> connectLineTable) {
|
||||
ConnectLineTable = connectLineTable;
|
||||
this.autoConnections = connectLineTable;
|
||||
}
|
||||
|
||||
|
||||
public List<MultiProtocolSocketAddress> getNtpServers() {
|
||||
return ntpServers;
|
||||
}
|
||||
|
||||
public void setNtpServers(List<MultiProtocolSocketAddress> ntpServers) {
|
||||
this.ntpServers = ntpServers;
|
||||
}
|
||||
|
||||
public List<MultiProtocolSocketAddress> getNtpServerTable() {
|
||||
return ntpServerTable;
|
||||
return ntpServers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void setNtpServerTable(List<MultiProtocolSocketAddress> ntpServerTable) {
|
||||
this.ntpServerTable = ntpServerTable;
|
||||
this.ntpServers = ntpServerTable;
|
||||
}
|
||||
|
||||
public List<String> getExtraRoutes() {
|
||||
@@ -280,23 +320,36 @@ public class KLALBControllerConfigItem extends KLALBConfigItem {
|
||||
|
||||
|
||||
|
||||
public boolean isDenyLineTableQuery() {
|
||||
return denyLineTableQuery;
|
||||
public boolean isDenyConnectionQuery() {
|
||||
return denyConnectionQuery;
|
||||
}
|
||||
|
||||
public void setDenyConnectionQuery(boolean denyConnectionQuery) {
|
||||
this.denyConnectionQuery = denyConnectionQuery;
|
||||
}
|
||||
|
||||
public boolean isDenyLineTableQuery() {
|
||||
return denyConnectionQuery;
|
||||
}
|
||||
|
||||
public void setDenyLineTableQuery(boolean denyLineTableQuery) {
|
||||
this.denyLineTableQuery = denyLineTableQuery;
|
||||
this.denyConnectionQuery = denyLineTableQuery;
|
||||
}
|
||||
|
||||
public boolean isDenyConnectionBroadcast() {
|
||||
return denyConnectionBroadcast;
|
||||
}
|
||||
|
||||
public void setDenyConnectionBroadcast(boolean denyConnectionBroadcast) {
|
||||
this.denyConnectionBroadcast = denyConnectionBroadcast;
|
||||
}
|
||||
|
||||
public boolean isDenyLineTableBroadcast() {
|
||||
return denyLineTableBroadcast;
|
||||
return denyConnectionBroadcast;
|
||||
}
|
||||
|
||||
|
||||
public void setDenyLineTableBroadcast(boolean denyLineTableBroadcast) {
|
||||
this.denyLineTableBroadcast = denyLineTableBroadcast;
|
||||
this.denyConnectionBroadcast = denyLineTableBroadcast;
|
||||
}
|
||||
|
||||
|
||||
@@ -352,12 +405,12 @@ public class KLALBControllerConfigItem extends KLALBConfigItem {
|
||||
", TCPListen=" + TCPListen +
|
||||
", UDPListen=" + UDPListen +
|
||||
", VirtualSocketName='" + VirtualSocketName + '\'' +
|
||||
", LineTable=" + LineTable +
|
||||
", ConnectLineTable=" + ConnectLineTable +
|
||||
", ntpServerTable=" + ntpServerTable +
|
||||
", openConnections=" + openConnections +
|
||||
", autoConnections=" + autoConnections +
|
||||
", ntpServers=" + ntpServers +
|
||||
", ExtraRoutes=" + ExtraRoutes +
|
||||
", denyLineTableQuery=" + denyLineTableQuery +
|
||||
", denyLineTableBroadcast=" + denyLineTableBroadcast +
|
||||
", denyConnectionQuery=" + denyConnectionQuery +
|
||||
", denyConnectionBroadcast=" + denyConnectionBroadcast +
|
||||
", congestionAlgorithm='" + congestionAlgorithm + '\'' +
|
||||
", burstLimit=" + burstLimit +
|
||||
", delayUpperBound=" + delayUpperBound +
|
||||
@@ -365,6 +418,7 @@ public class KLALBControllerConfigItem extends KLALBConfigItem {
|
||||
", nagleDelayTime=" + nagleDelayTime +
|
||||
", linkNagleDelayTime=" + linkNagleDelayTime +
|
||||
", linkConnectionsCount=" + linkConnectionsCount +
|
||||
", enableTUN=" + enableTUN +
|
||||
", TUNName='" + TUNName + '\'' +
|
||||
", performanceStrategy='" + performanceStrategy + '\'' +
|
||||
", DeviceName='" + DeviceName + '\'' +
|
||||
@@ -378,11 +432,11 @@ public class KLALBControllerConfigItem extends KLALBConfigItem {
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
KLALBControllerConfigItem that = (KLALBControllerConfigItem) o;
|
||||
return nogui == that.nogui && denyLineTableQuery == that.denyLineTableQuery && denyLineTableBroadcast == that.denyLineTableBroadcast && Double.compare(burstLimit, that.burstLimit) == 0 && Double.compare(delayUpperBound, that.delayUpperBound) == 0 && Double.compare(delayLowerBound, that.delayLowerBound) == 0 && nagleDelayTime == that.nagleDelayTime && linkNagleDelayTime == that.linkNagleDelayTime && linkConnectionsCount == that.linkConnectionsCount && Objects.equals(language, that.language) && Objects.equals(VirtualAddress, that.VirtualAddress) && Objects.equals(VirtualASN, that.VirtualASN) && Objects.equals(DNS, that.DNS) && Objects.equals(TCPListen, that.TCPListen) && Objects.equals(UDPListen, that.UDPListen) && Objects.equals(VirtualSocketName, that.VirtualSocketName) && Objects.equals(LineTable, that.LineTable) && Objects.equals(ConnectLineTable, that.ConnectLineTable) && Objects.equals(ntpServerTable, that.ntpServerTable) && Objects.equals(ExtraRoutes, that.ExtraRoutes) && Objects.equals(congestionAlgorithm, that.congestionAlgorithm) && Objects.equals(TUNName, that.TUNName) && Objects.equals(performanceStrategy, that.performanceStrategy) && Objects.equals(DeviceName, that.DeviceName) && Objects.equals(DeviceDescription, that.DeviceDescription) && Objects.equals(NetworkInterfaceExcepts, that.NetworkInterfaceExcepts);
|
||||
return nogui == that.nogui && enableTUN == that.enableTUN && denyConnectionQuery == that.denyConnectionQuery && denyConnectionBroadcast == that.denyConnectionBroadcast && Double.compare(burstLimit, that.burstLimit) == 0 && Double.compare(delayUpperBound, that.delayUpperBound) == 0 && Double.compare(delayLowerBound, that.delayLowerBound) == 0 && nagleDelayTime == that.nagleDelayTime && linkNagleDelayTime == that.linkNagleDelayTime && linkConnectionsCount == that.linkConnectionsCount && Objects.equals(language, that.language) && Objects.equals(VirtualAddress, that.VirtualAddress) && Objects.equals(VirtualASN, that.VirtualASN) && Objects.equals(DNS, that.DNS) && Objects.equals(TCPListen, that.TCPListen) && Objects.equals(UDPListen, that.UDPListen) && Objects.equals(VirtualSocketName, that.VirtualSocketName) && Objects.equals(openConnections, that.openConnections) && Objects.equals(autoConnections, that.autoConnections) && Objects.equals(ntpServers, that.ntpServers) && Objects.equals(ExtraRoutes, that.ExtraRoutes) && Objects.equals(congestionAlgorithm, that.congestionAlgorithm) && Objects.equals(TUNName, that.TUNName) && Objects.equals(performanceStrategy, that.performanceStrategy) && Objects.equals(DeviceName, that.DeviceName) && Objects.equals(DeviceDescription, that.DeviceDescription) && Objects.equals(NetworkInterfaceExcepts, that.NetworkInterfaceExcepts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), language, nogui, VirtualAddress, VirtualASN, DNS, TCPListen, UDPListen, VirtualSocketName, LineTable, ConnectLineTable, ntpServerTable, ExtraRoutes, denyLineTableQuery, denyLineTableBroadcast, congestionAlgorithm, burstLimit, delayUpperBound, delayLowerBound, nagleDelayTime, linkNagleDelayTime, linkConnectionsCount, TUNName, performanceStrategy, DeviceName, DeviceDescription, NetworkInterfaceExcepts);
|
||||
return Objects.hash(super.hashCode(), language, nogui, VirtualAddress, VirtualASN, DNS, TCPListen, UDPListen, VirtualSocketName, openConnections, autoConnections, ntpServers, ExtraRoutes, denyConnectionQuery, denyConnectionBroadcast, congestionAlgorithm, burstLimit, delayUpperBound, delayLowerBound, nagleDelayTime, linkNagleDelayTime, linkConnectionsCount, enableTUN, TUNName, performanceStrategy, DeviceName, DeviceDescription, NetworkInterfaceExcepts);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user