proxy progress
This commit is contained in:
parent
e66b7a57b7
commit
53387a2d35
|
@ -110,6 +110,10 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
));
|
||||
}
|
||||
|
||||
public IoStream getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public boolean isClosed;
|
||||
|
||||
public CommunicationLoggingListener communicationLoggingListener = CommunicationLoggingListener.VOID;
|
||||
|
|
|
@ -3,6 +3,6 @@ package com.rusefi;
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class rusEFIVersion {
|
||||
public static final int CONSOLE_VERSION = 20200711;
|
||||
public static final int CONSOLE_VERSION = 20200717;
|
||||
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ConsoleTools {
|
|||
registerTool("compile_fsio_file", ConsoleTools::runCompileTool, "Convert all lines from a file to RPN form.");
|
||||
|
||||
registerTool("proxy_server", Backend::start, "NOT A USER TOOL");
|
||||
registerTool("network_connector", NetworkConnector::start, "Connect your rusEFI ECU to rusEFI Online");
|
||||
registerTool("network_connector", NetworkConnectorStartup::start, "Connect your rusEFI ECU to rusEFI Online");
|
||||
registerTool("network_authenticator", LocalApplicationProxy::start, "rusEFI Online Authenticator");
|
||||
|
||||
registerTool("print_auth_token", args -> printAuthToken(), "Print current rusEFI Online authentication token.");
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.rusefi.tools;
|
||||
|
||||
import com.opensr5.Logger;
|
||||
import com.rusefi.autodetect.PortDetector;
|
||||
import com.rusefi.io.ConnectionStateListener;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.proxy.NetworkConnector;
|
||||
import com.rusefi.server.Backend;
|
||||
import com.rusefi.ui.AuthTokenPanel;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class NetworkConnectorStartup {
|
||||
public static void start(String[] strings) throws IOException {
|
||||
String autoDetectedPort = PortDetector.autoDetectSerial(null);
|
||||
if (autoDetectedPort == null) {
|
||||
System.err.println("rusEFI not detected");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinkManager linkManager = new LinkManager(Logger.CONSOLE);
|
||||
linkManager.startAndConnect(autoDetectedPort, ConnectionStateListener.VOID);
|
||||
|
||||
String authToken = AuthTokenPanel.getAuthToken();
|
||||
NetworkConnector.runNetworkConnector(Backend.SERVER_PORT_FOR_CONTROLLERS, linkManager.getConnector().getBinaryProtocol().getStream(), Logger.CONSOLE,
|
||||
authToken);
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ import java.io.IOException;
|
|||
* Connector between rusEFI ECU and rusEFI server
|
||||
*/
|
||||
public class NetworkConnector {
|
||||
public static String RUSEFI_PROXY_HOSTNAME = "proxy.rusefi.com";
|
||||
public static String RUSEFI_PROXY_HOSTNAME = System.getProperty("RUSEFI_PROXY_URL", "proxy.rusefi.com");
|
||||
|
||||
@NotNull
|
||||
public static SessionDetails runNetworkConnector(int serverPortForControllers, IoStream targetEcuSocket, final Logger logger, String authToken) throws IOException {
|
||||
|
@ -43,7 +43,4 @@ public class NetworkConnector {
|
|||
baseBroadcastingThread.start();
|
||||
return deviceSessionDetails;
|
||||
}
|
||||
|
||||
public static void start(String[] strings) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ import java.util.function.Function;
|
|||
public class Backend {
|
||||
public static final String VERSION_PATH = "/version";
|
||||
public static final String BACKEND_VERSION = "0.0001";
|
||||
public static final int SERVER_PORT_FOR_APPLICATIONS = 8002;
|
||||
public static final int SERVER_PORT_FOR_CONTROLLERS = 8003;
|
||||
public static final int HTTP_PORT = 8001;
|
||||
|
||||
private final FkRegex showOnlineUsers = new FkRegex(ProxyClient.LIST_PATH,
|
||||
(Take) req -> getUsersOnline()
|
||||
|
@ -226,10 +229,10 @@ public class Backend {
|
|||
|
||||
Function<String, UserDetails> userDetailsFunction = new JsonUserDetailsResolver();
|
||||
|
||||
Backend backend = new Backend(userDetailsFunction, 8001, Logger.CONSOLE);
|
||||
backend.runApplicationConnector(8002, parameter -> {
|
||||
Backend backend = new Backend(userDetailsFunction, HTTP_PORT, Logger.CONSOLE);
|
||||
backend.runApplicationConnector(SERVER_PORT_FOR_APPLICATIONS, parameter -> {
|
||||
});
|
||||
backend.runControllerConnector(8003, parameter -> {
|
||||
backend.runControllerConnector(SERVER_PORT_FOR_CONTROLLERS, parameter -> {
|
||||
});
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue