Commit 0e7976f9 authored by Melledy's avatar Melledy Committed by GitHub
Browse files

Merge pull request #78 from MlgmXyysd/dispatch-refactor

 Refact dispatch server
parents dccee2df 54856147
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
# - mitmdump from mitmproxy # - mitmdump from mitmproxy
# #
# @author MlgmXyysd # @author MlgmXyysd
# @version 1.0 # @version 1.1
# #
## ##
from mitmproxy import http from mitmproxy import http
from proxy_config import USE_SSL
from proxy_config import REMOTE_HOST from proxy_config import REMOTE_HOST
from proxy_config import REMOTE_PORT
class MlgmXyysd_Genshin_Impact_Proxy: class MlgmXyysd_Genshin_Impact_Proxy:
...@@ -60,7 +62,12 @@ class MlgmXyysd_Genshin_Impact_Proxy: ...@@ -60,7 +62,12 @@ class MlgmXyysd_Genshin_Impact_Proxy:
def request(self, flow: http.HTTPFlow) -> None: def request(self, flow: http.HTTPFlow) -> None:
if flow.request.host in self.LIST_DOMAINS: if flow.request.host in self.LIST_DOMAINS:
if USE_SSL:
flow.request.scheme = "https"
else:
flow.request.scheme = "http"
flow.request.host = REMOTE_HOST flow.request.host = REMOTE_HOST
flow.request.port = REMOTE_PORT
addons = [ addons = [
MlgmXyysd_Genshin_Impact_Proxy() MlgmXyysd_Genshin_Impact_Proxy()
......
# This can also be replaced with another IP address. # This can also be replaced with another IP address.
REMOTE_HOST = "localhost" USE_SSL = True
\ No newline at end of file REMOTE_HOST = "127.0.0.1"
REMOTE_PORT = 443
\ No newline at end of file
package emu.grasscutter; package emu.grasscutter;
public final class Config { public final class Config {
public String DispatchServerIp = "127.0.0.1"; public String DispatchServerIp = "0.0.0.0";
public String DispatchServerPublicIp = ""; public String DispatchServerPublicIp = "127.0.0.1";
public int DispatchServerPort = 443; public int DispatchServerPort = 443;
public String DispatchServerKeystorePath = "./keystore.p12"; public String DispatchServerKeystorePath = "./keystore.p12";
public String DispatchServerKeystorePassword = ""; public String DispatchServerKeystorePassword = "";
public Boolean UseSSL = true; public Boolean UseSSL = true;
public String GameServerName = "Test"; public String GameServerName = "Test";
public String GameServerIp = "127.0.0.1"; public String GameServerIp = "0.0.0.0";
public String GameServerPublicIp = ""; public String GameServerPublicIp = "127.0.0.1";
public int GameServerPort = 22102; public int GameServerPort = 22102;
public int OverseaLogPort = 8888;
public int UploadLogPort = 80;
public String DatabaseUrl = "mongodb://localhost:27017"; public String DatabaseUrl = "mongodb://localhost:27017";
public String DatabaseCollection = "grasscutter"; public String DatabaseCollection = "grasscutter";
public String RESOURCE_FOLDER = "./resources/"; public String RESOURCE_FOLDER = "./resources/";
public String DATA_FOLDER = "./data/"; public String DATA_FOLDER = "./data/";
public String PACKETS_FOLDER = "./packets/"; public String PACKETS_FOLDER = "./packets/";
...@@ -28,21 +25,21 @@ public final class Config { ...@@ -28,21 +25,21 @@ public final class Config {
public GameRates Game = new GameRates(); public GameRates Game = new GameRates();
public ServerOptions ServerOptions = new ServerOptions(); public ServerOptions ServerOptions = new ServerOptions();
public GameRates getGameRates() { public GameRates getGameRates() {
return Game; return Game;
} }
public ServerOptions getServerOptions() { public ServerOptions getServerOptions() {
return ServerOptions; return ServerOptions;
} }
public static class GameRates { public static class GameRates {
public float ADVENTURE_EXP_RATE = 1.0f; public float ADVENTURE_EXP_RATE = 1.0f;
public float MORA_RATE = 1.0f; public float MORA_RATE = 1.0f;
public float DOMAIN_DROP_RATE = 1.0f; public float DOMAIN_DROP_RATE = 1.0f;
} }
public static class ServerOptions { public static class ServerOptions {
public int InventoryLimitWeapon = 2000; public int InventoryLimitWeapon = 2000;
public int InventoryLimitRelic = 2000; public int InventoryLimitRelic = 2000;
......
...@@ -7,7 +7,7 @@ public class ComboTokenReqJson { ...@@ -7,7 +7,7 @@ public class ComboTokenReqJson {
public String device; public String device;
public String sign; public String sign;
public class LoginTokenData { public static class LoginTokenData {
public String uid; public String uid;
public String token; public String token;
public boolean guest; public boolean guest;
......
...@@ -5,7 +5,7 @@ public class ComboTokenResJson { ...@@ -5,7 +5,7 @@ public class ComboTokenResJson {
public int retcode; public int retcode;
public LoginData data = new LoginData(); public LoginData data = new LoginData();
public class LoginData { public static class LoginData {
public int account_type = 1; public int account_type = 1;
public boolean heartbeat; public boolean heartbeat;
public String combo_id; public String combo_id;
......
...@@ -5,7 +5,7 @@ public class LoginResultJson { ...@@ -5,7 +5,7 @@ public class LoginResultJson {
public int retcode; public int retcode;
public VerifyData data = new VerifyData(); public VerifyData data = new VerifyData();
public class VerifyData { public static class VerifyData {
public VerifyAccountData account = new VerifyAccountData(); public VerifyAccountData account = new VerifyAccountData();
public boolean device_grant_required = false; public boolean device_grant_required = false;
public String realname_operation = "NONE"; public String realname_operation = "NONE";
...@@ -13,7 +13,7 @@ public class LoginResultJson { ...@@ -13,7 +13,7 @@ public class LoginResultJson {
public boolean safe_mobile_required = false; public boolean safe_mobile_required = false;
} }
public class VerifyAccountData { public static class VerifyAccountData {
public String uid; public String uid;
public String name = ""; public String name = "";
public String email; public String email;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment