mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Crate] Changed all address &str to &Ipv4Addr
This commit is contained in:
parent
a69896f737
commit
e620398615
65 changed files with 171 additions and 93 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// This file has code that has been documented by the NodeJS GameDig library
|
||||
// (MIT) from https://github.com/gamedig/node-gamedig/blob/master/protocols/minecraftbedrock.js
|
||||
|
||||
use std::net::Ipv4Addr;
|
||||
use crate::{
|
||||
bufferer::{Bufferer, Endianess},
|
||||
protocols::{
|
||||
|
|
@ -18,7 +19,7 @@ pub struct Bedrock {
|
|||
}
|
||||
|
||||
impl Bedrock {
|
||||
fn new(address: &str, port: u16, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
|
||||
fn new(address: &Ipv4Addr, port: u16, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
|
||||
let socket = UdpSocket::new(address, port)?;
|
||||
socket.apply_timeout(timeout_settings)?;
|
||||
|
||||
|
|
@ -92,7 +93,7 @@ impl Bedrock {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn query(address: &str, port: u16, timeout_settings: Option<TimeoutSettings>) -> GDResult<BedrockResponse> {
|
||||
pub fn query(address: &Ipv4Addr, port: u16, timeout_settings: Option<TimeoutSettings>) -> GDResult<BedrockResponse> {
|
||||
Bedrock::new(address, port, timeout_settings)?.get_info()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue