-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ivmarkov
committed
Jan 5, 2024
1 parent
f4eac70
commit 59ab460
Showing
5 changed files
with
91 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,32 @@ | ||
use edge_net::captive::{DnsConf, DnsServer}; | ||
use core::time::Duration; | ||
|
||
use edge_net::captive::io::run; | ||
|
||
use embedded_nal_async::{IpAddr, Ipv4Addr, SocketAddr}; | ||
|
||
use std_embedded_nal_async::Stack; | ||
|
||
use log::*; | ||
|
||
fn main() { | ||
let mut dns_conf = DnsConf::new("192.168.71.1".parse().unwrap()); | ||
dns_conf.bind_port = 1053; | ||
let mut dns_server = DnsServer::new(dns_conf); | ||
dns_server.start().unwrap(); | ||
loop {} | ||
env_logger::init_from_env( | ||
env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"), | ||
); | ||
|
||
let stack: Stack = Default::default(); | ||
|
||
let mut tx_buf = [0; 1500]; | ||
let mut rx_buf = [0; 1500]; | ||
|
||
info!("Running Captive Portal DNS on UDP port 8853..."); | ||
|
||
futures_lite::future::block_on(run( | ||
&stack, | ||
SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), 8853), // Can't use DEFAULT_SOCKET because it uses DNS port 53 which needs root | ||
&mut tx_buf, | ||
&mut rx_buf, | ||
Ipv4Addr::new(192, 168, 0, 1), | ||
Duration::from_secs(60), | ||
)) | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters