add version config
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
use crate::config::versions;
|
||||
use axum::extract::Query;
|
||||
use prost::Message;
|
||||
use proto::{Dispatch, Gateserver, RegionInfo};
|
||||
use serde::Deserialize;
|
||||
|
||||
pub const QUERY_DISPATCH_ENDPOINT: &str = "/query_dispatch";
|
||||
pub const QUERY_GATEWAY_ENDPOINT: &str = "/query_gateway";
|
||||
@@ -24,38 +27,45 @@ pub async fn query_dispatch() -> String {
|
||||
rbase64::encode(&buff)
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct QueryGatewayParameters {
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn query_gateway() -> String {
|
||||
let rsp = Gateserver {
|
||||
retcode: 0,
|
||||
ip: String::from("127.0.0.1"),
|
||||
port: 23301,
|
||||
asset_bundle_url: String::from(
|
||||
"https://autopatchcn.bhsr.com/asb/BetaLive/output_6828321_72f2df86102b",
|
||||
),
|
||||
lua_url: String::from(
|
||||
"https://autopatchcn.bhsr.com/lua/BetaLive/output_6828764_f749b48347fd",
|
||||
),
|
||||
ex_resource_url: String::from(
|
||||
"https://autopatchcn.bhsr.com/design_data/BetaLive/output_6834225_44836493b261",
|
||||
),
|
||||
ifix_version: String::from("0"),
|
||||
lua_version: String::from("6755976"),
|
||||
jblkncaoiao: true,
|
||||
hjdjakjkdbi: true,
|
||||
ldknmcpffim: true,
|
||||
feehapamfci: true,
|
||||
eebfeohfpph: true,
|
||||
dfmjjcfhfea: true,
|
||||
najikcgjgan: true,
|
||||
giddjofkndm: true,
|
||||
fbnbbembcgn: false,
|
||||
dedgfjhbnok: false,
|
||||
use_tcp: true,
|
||||
linlaijbboh: false,
|
||||
ahmbfbkhmgh: false,
|
||||
nmdccehcdcc: false,
|
||||
..Default::default()
|
||||
pub async fn query_gateway(parameters: Query<QueryGatewayParameters>) -> String {
|
||||
let rsp = if let Some(config) = versions.get(¶meters.version) {
|
||||
Gateserver {
|
||||
retcode: 0,
|
||||
ip: String::from("127.0.0.1"),
|
||||
port: 23301,
|
||||
asset_bundle_url: config.asset_bundle_url.clone(),
|
||||
ex_resource_url: config.ex_resource_url.clone(),
|
||||
lua_url: config.lua_url.clone(),
|
||||
lua_version: config.lua_version.clone(),
|
||||
ifix_version: String::from("0"),
|
||||
jblkncaoiao: true,
|
||||
hjdjakjkdbi: true,
|
||||
ldknmcpffim: true,
|
||||
feehapamfci: true,
|
||||
eebfeohfpph: true,
|
||||
dfmjjcfhfea: true,
|
||||
najikcgjgan: true,
|
||||
giddjofkndm: true,
|
||||
fbnbbembcgn: false,
|
||||
dedgfjhbnok: false,
|
||||
use_tcp: true,
|
||||
linlaijbboh: false,
|
||||
ahmbfbkhmgh: false,
|
||||
nmdccehcdcc: false,
|
||||
..Default::default()
|
||||
}
|
||||
} else {
|
||||
Gateserver {
|
||||
retcode: 9,
|
||||
msg: format!("forbidden version: {} or invalid bind", parameters.version),
|
||||
..Default::default()
|
||||
}
|
||||
};
|
||||
|
||||
let mut buff = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user