mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-21 07:27:45 +00:00
Rename added variables/functions for better consistency
This commit is contained in:
parent
6d79a365f3
commit
efdec9b4c5
2 changed files with 8 additions and 8 deletions
|
@ -195,8 +195,8 @@ pub struct WorldConfig {
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
#[serde(default = "WorldConfig::default_listen_address")]
|
#[serde(default = "WorldConfig::default_listen_address")]
|
||||||
pub listen_address: String,
|
pub listen_address: String,
|
||||||
#[serde(default = "WorldConfig::default_world_address")]
|
#[serde(default = "WorldConfig::default_server_name")]
|
||||||
pub world_address: String,
|
pub server_name: String,
|
||||||
/// See the World Excel sheet.
|
/// See the World Excel sheet.
|
||||||
#[serde(default = "WorldConfig::default_world_id")]
|
#[serde(default = "WorldConfig::default_world_id")]
|
||||||
pub world_id: u16,
|
pub world_id: u16,
|
||||||
|
@ -223,7 +223,7 @@ impl Default for WorldConfig {
|
||||||
Self {
|
Self {
|
||||||
port: Self::default_port(),
|
port: Self::default_port(),
|
||||||
listen_address: Self::default_listen_address(),
|
listen_address: Self::default_listen_address(),
|
||||||
world_address: Self::default_world_address(),
|
server_name: Self::default_server_name(),
|
||||||
world_id: Self::default_world_id(),
|
world_id: Self::default_world_id(),
|
||||||
scripts_location: Self::default_scripts_location(),
|
scripts_location: Self::default_scripts_location(),
|
||||||
rcon_port: Self::default_rcon_port(),
|
rcon_port: Self::default_rcon_port(),
|
||||||
|
@ -243,7 +243,7 @@ impl WorldConfig {
|
||||||
"0.0.0.0".to_string()
|
"0.0.0.0".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_world_address() -> String {
|
fn default_server_name() -> String {
|
||||||
"127.0.0.1".to_string()
|
"127.0.0.1".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,9 +281,9 @@ impl WorldConfig {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_world_socketaddr(&self) -> SocketAddr {
|
pub fn get_public_socketaddr(&self) -> SocketAddr {
|
||||||
SocketAddr::from((
|
SocketAddr::from((
|
||||||
IpAddr::from_str(&self.world_address).expect("Invalid IP address format in config!"),
|
IpAddr::from_str(&self.server_name).expect("Invalid IP address format in config!"),
|
||||||
self.port,
|
self.port,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ impl LobbyConnection {
|
||||||
content_id,
|
content_id,
|
||||||
token: String::new(),
|
token: String::new(),
|
||||||
port: config.world.port,
|
port: config.world.port,
|
||||||
host: config.world.world_address,
|
host: config.world.server_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
let ipc = ServerLobbyIpcSegment {
|
let ipc = ServerLobbyIpcSegment {
|
||||||
|
@ -538,7 +538,7 @@ impl LobbyConnection {
|
||||||
pub async fn send_custom_world_packet(segment: CustomIpcSegment) -> Option<CustomIpcSegment> {
|
pub async fn send_custom_world_packet(segment: CustomIpcSegment) -> Option<CustomIpcSegment> {
|
||||||
let config = get_config();
|
let config = get_config();
|
||||||
|
|
||||||
let addr = config.world.get_world_socketaddr();
|
let addr = config.world.get_public_socketaddr();
|
||||||
|
|
||||||
let mut stream = TcpStream::connect(addr).await.unwrap();
|
let mut stream = TcpStream::connect(addr).await.unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue