mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 04:50:36 +00:00
Fix net.serve no longer accepting ipv6
This commit is contained in:
parent
03c773fd79
commit
4a28499aaa
1 changed files with 7 additions and 4 deletions
|
@ -1,4 +1,7 @@
|
|||
use std::{collections::HashMap, net::Ipv4Addr};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
};
|
||||
|
||||
use mlua::prelude::*;
|
||||
|
||||
|
@ -6,7 +9,7 @@ use reqwest::Method;
|
|||
|
||||
use super::util::table_to_hash_map;
|
||||
|
||||
const DEFAULT_IP_ADDRESS: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1);
|
||||
const DEFAULT_IP_ADDRESS: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
|
||||
|
||||
const WEB_SOCKET_UPDGRADE_REQUEST_HANDLER: &str = r#"
|
||||
return {
|
||||
|
@ -155,7 +158,7 @@ impl FromLua<'_> for RequestConfig {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct ServeConfig<'a> {
|
||||
pub address: Ipv4Addr,
|
||||
pub address: IpAddr,
|
||||
pub handle_request: LuaFunction<'a>,
|
||||
pub handle_web_socket: Option<LuaFunction<'a>>,
|
||||
}
|
||||
|
@ -175,7 +178,7 @@ impl<'lua> FromLua<'lua> for ServeConfig<'lua> {
|
|||
let handle_request: Option<LuaFunction> = t.get("handleRequest")?;
|
||||
let handle_web_socket: Option<LuaFunction> = t.get("handleWebSocket")?;
|
||||
if handle_request.is_some() || handle_web_socket.is_some() {
|
||||
let address: Ipv4Addr = match &address {
|
||||
let address: IpAddr = match &address {
|
||||
Some(addr) => {
|
||||
let addr_str = addr.to_str()?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue