1 Commits
Author SHA1 Message Date
Dreaded_X 8dcb4aa8b7 --wip-- [skip ci] 2026-10-15 05:06:17 +02:00
21 changed files with 271 additions and 1955 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "ipxe/ipxe"]
path = ipxe/ipxe
url = git@github.com:rkubes/ipxe
-9
View File
@@ -1,14 +1,5 @@
[workspace]
pr_name = "chore(release): Release v{{ version }}"
changelog_path = "./CHANGELOG.md"
[[package]]
name = "crete"
changelog_include = ["ipxe"]
[[package]]
name = "ipxe"
release = false
[[package]]
name = "xtask"
Generated
+87 -1603
View File
File diff suppressed because it is too large Load Diff
+5 -6
View File
@@ -10,8 +10,8 @@ license = "GPL-3.0-or-later"
members = ["ipxe", "xtask"]
[workspace.dependencies]
schemars = { version = "1.2.3", features = ["semver1"] }
serde_json = "1.0.154"
schemars = { version = "1.2.2", features = ["semver1"] }
serde_json = "1.0.151"
[dependencies]
async-walkdir = "2.2.0"
@@ -19,8 +19,8 @@ byteorder = "1.5.0"
clap = { version = "4.6.7", features = ["derive"] }
clap_complete = "4.6.11"
futures = "0.3.34"
gix-discover = { version = "0.57.0", features = ["sha1"] }
minijinja = { version = "3.0.1", features = ["json", "serde"] }
gix-discover = { version = "0.56.0", features = ["sha1"] }
minijinja = { version = "2.24.0", features = ["json", "loader"] }
netascii = "0.1.0"
num_enum = "0.7.6"
optional_struct = "0.5.2"
@@ -34,12 +34,11 @@ serde = { version = "1.0.229", features = ["derive"] }
serde_json = { workspace = true }
serde_yaml = "0.9.34"
thiserror = "2.0.21"
tokio = { version = "1.54.0", features = ["full"] }
tokio = { version = "1.52.1", features = ["full"] }
ipxe = { path = "./ipxe" }
axum = { version = "0.8.9", features = ["macros"] }
socket2 = "0.6.5"
socket-pktinfo = "0.4.1"
serde-saphyr = "2.0.0"
[lib]
test = false
+1 -7
View File
@@ -4,13 +4,7 @@ version = "0.1.0"
edition = "2024"
[build-dependencies]
diffy = "0.5.2"
gix = { version = "0.89.0", default-features = false, features = [
"blocking-network-client",
"worktree-mutation",
"sha1",
"blocking-http-transport-reqwest-rust-tls",
] }
build-print = "1.0.1"
[dependencies]
include_dir = "0.7.4"
+29 -151
View File
@@ -1,180 +1,58 @@
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::atomic::AtomicBool;
use std::env;
use std::path::PathBuf;
use std::process::{Command, Stdio};
use diffy::apply;
use diffy::patch_set::{FileOperation, ParseOptions, PatchSet};
use gix::Repository;
use gix::progress::Discard;
const URL: &str = "https://github.com/ipxe/ipxe";
const REVISION: &str = "2fa08affe9a1a1422766f54b2fb045234b571f06";
const FILES: &[&str] = &["bin/ipxe.pxe", "bin-x86_64-efi/ipxe.efi"];
const SRC_DIR: &str = "src";
use build_print::error;
fn main() {
let manifest_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap())
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.canonicalize()
.unwrap();
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap())
.canonicalize()
.unwrap();
let repo_dir = out_dir.join("repo");
let repo = checkout(&out_dir, &repo_dir);
apply_patches(&repo, &manifest_dir, &repo_dir);
println!("cargo::rerun-if-changed=patches");
build(&manifest_dir, &repo_dir);
println!("cargo::rerun-if-changed=src/embed.ipxe");
copy_files(&repo_dir, &out_dir);
}
fn checkout(out_dir: &Path, repo_dir: &Path) -> Repository {
// Stamp file is used instead of comparing against HEAD to guard against incomplete clones
let stamp = out_dir.join("checkout.stamp");
if std::fs::read_to_string(&stamp).is_ok_and(|stamp| stamp == REVISION)
&& let Ok(repo) = gix::open(repo_dir)
{
return repo;
}
// Cleanup any left-overs
std::fs::remove_file(&stamp).ok();
std::fs::remove_dir_all(repo_dir).ok();
std::fs::create_dir_all(repo_dir).unwrap();
let mut prepare = gix::prepare_clone(URL, repo_dir)
.unwrap()
.with_revision(Some(REVISION))
.unwrap();
let interrupt = AtomicBool::new(false);
let (mut checkout, _) = prepare.fetch_then_checkout(Discard, &interrupt).unwrap();
let (repo, _) = checkout.main_worktree(Discard, &interrupt).unwrap();
std::fs::write(&stamp, REVISION).unwrap();
repo
}
fn apply_patches(repo: &Repository, manifest_dir: &Path, repo_dir: &Path) {
let commit_id = gix::ObjectId::from_hex(REVISION.as_bytes()).unwrap();
let tree = repo.find_commit(commit_id).unwrap().tree().unwrap();
// Get all the patches and sort them based on name
let mut patch_files: Vec<PathBuf> = std::fs::read_dir(manifest_dir.join("patches"))
.unwrap()
.map(|e| e.unwrap().path())
.filter(|e| e.extension().is_some_and(|e| e == "patch"))
.collect();
patch_files.sort();
let mut patched = HashMap::new();
for path in patch_files {
let text = std::fs::read_to_string(&path).unwrap();
let patch_set = PatchSet::parse(&text, ParseOptions::gitdiff());
for patch in patch_set {
let patch = patch.unwrap();
match patch.operation().strip_prefix(1) {
FileOperation::Modify { original, modified } => {
assert_eq!(original, modified);
let path = original.to_string();
// Either get the current in-memory patched file, otherwise get the prisine file
let current = patched
.remove(&path)
.unwrap_or_else(|| pristine(&tree, &path));
let new = apply(&current, patch.patch().as_text().unwrap()).unwrap();
patched.insert(path, new);
}
_ => todo!(),
}
}
}
// If the file was previously patched, but now isn't restore the pristine file
for path in modified_files(repo) {
if !patched.contains_key(&path) {
std::fs::write(repo_dir.join(&path), pristine(&tree, &path)).unwrap();
}
}
// Write all the patched files
for (path, content) in &patched {
let path = repo_dir.join(path);
let content = content.as_bytes();
// But only if the file is actually different from the one on disk
// This prevents changing the mtime unnecessarily
if std::fs::read(&path).ok().as_deref() != Some(content) {
std::fs::write(path, content).unwrap();
}
}
}
fn pristine(tree: &gix::Tree<'_>, path: &str) -> String {
let entry = tree.lookup_entry_by_path(path).unwrap().unwrap();
String::from_utf8(entry.object().unwrap().data.clone()).unwrap()
}
fn modified_files(repo: &gix::Repository) -> Vec<String> {
repo.status(Discard)
.unwrap()
.untracked_files(gix::status::UntrackedFiles::None)
.into_index_worktree_iter(Vec::<gix::bstr::BString>::new())
.unwrap()
.map(|item| item.unwrap().rela_path().to_string())
.collect()
}
fn build(manifest_dir: &Path, repo_dir: &Path) {
let src_dir = repo_dir.join(SRC_DIR);
let src_dir = manifest_dir.join("ipxe").join("src");
let mut command = Command::new("make");
command
.stdout(Stdio::piped())
.current_dir(&src_dir)
.env_remove("DEBUG")
.env_remove("PROFILE")
.args([
"-j",
&std::thread::available_parallelism()
.unwrap()
.get()
.to_string(),
])
.arg("DOWNLOAD_PROTO_HTTP=1")
.arg(format!(
"EMBED={}",
manifest_dir
.join("src")
.join("embed.ipxe")
.to_string_lossy()
))
.args(FILES);
.to_string_lossy(),
));
if let Ok(flags) = std::env::var("CARGO_MAKEFLAGS") {
command.env("MAKEFLAGS", flags);
let files = ["bin/ipxe.pxe", "bin-x86_64-efi/ipxe.efi"].map(PathBuf::from);
for file in &files {
command.arg(file);
}
let output = command.output().unwrap();
if !output.status.success() {
panic!("make failed:\n{}", String::from_utf8_lossy(&output.stderr));
}
error!("{}", String::from_utf8_lossy(&output.stderr));
}
fn copy_files(repo_dir: &Path, out_dir: &Path) {
let src_dir = repo_dir.join(SRC_DIR);
let bin_dir = out_dir.join("bin");
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap())
.canonicalize()
.unwrap()
.join("ipxe");
std::fs::create_dir_all(&bin_dir).unwrap();
for file in FILES {
let file = Path::new(file);
std::fs::remove_dir_all(&out_dir).ok();
for file in &files {
let input = src_dir.join(file);
let output = bin_dir.join(file.file_name().unwrap());
let output = out_dir.join(file.file_name().unwrap());
std::fs::create_dir_all(output.parent().unwrap()).unwrap();
std::fs::copy(input, output).unwrap();
}
}
Submodule
+1
Submodule ipxe/ipxe added at 8892af68a2
View File
-19
View File
@@ -1,19 +0,0 @@
diff --git a/src/config/general.h b/src/config/general.h
index 43858dceb..54cb1b657 100644
--- a/src/config/general.h
+++ b/src/config/general.h
@@ -60,10 +60,10 @@ FILE_SECBOOT ( PERMITTED );
//#define HTTP_ENC_PEERDIST /* PeerDist content encoding */
/* Disable protocols not historically included in BIOS builds */
-#if defined ( PLATFORM_pcbios )
- #undef DOWNLOAD_PROTO_HTTPS
- #undef HTTP_AUTH_NTLM
-#endif
+// #if defined ( PLATFORM_pcbios )
+// #undef DOWNLOAD_PROTO_HTTPS
+// #undef HTTP_AUTH_NTLM
+// #endif
/*****************************************************************************
*
+1 -1
View File
@@ -1,3 +1,3 @@
use include_dir::{Dir, include_dir};
pub static IPXE_DIR: Dir<'_> = include_dir!("$OUT_DIR/bin");
pub static IPXE_DIR: Dir<'_> = include_dir!("$OUT_DIR/ipxe");
+1 -1
View File
@@ -102,7 +102,7 @@ impl Cluster {
path.add_extension("yaml");
let content = tokio::fs::read_to_string(path).await.unwrap();
let mut cluster: OptionalClusterDeserialize = serde_saphyr::from_str(&content).unwrap();
let mut cluster: OptionalClusterDeserialize = serde_yaml::from_str(&content).unwrap();
// For some reason apply on the cluster does not properly apply to the default settings...
// So we manually apply it here first
+7 -13
View File
@@ -4,8 +4,8 @@ use std::path::{Path, PathBuf};
use async_walkdir::WalkDir;
use futures::{Stream, StreamExt};
use minijinja::syntax::SyntaxConfig;
use minijinja::{AutoEscape, Environment, path_loader, value};
use minijinja::value::ViaDeserialize;
use minijinja::{AutoEscape, Environment, path_loader};
use crate::{get_configs_path, get_talos_path};
@@ -19,27 +19,21 @@ pub struct PathEnvironment<'a> {
}
fn apply_netmask(
ip: value::Serde<Ipv4Addr>,
netmask: value::Serde<Ipv4Addr>,
ip: ViaDeserialize<Ipv4Addr>,
netmask: ViaDeserialize<Ipv4Addr>,
) -> Result<String, minijinja::Error> {
Ok((*ip & *netmask).to_string())
}
pub fn configure_environment(env: &mut Environment) {
// Configure jinja
// Configure jinja
env.set_syntax(
SyntaxConfig::builder()
.trim_blocks(true)
.lstrip_blocks(true)
.build()
.expect("Syntax config should be valid"),
);
env.set_trim_blocks(true);
env.set_lstrip_blocks(true);
env.set_undefined_behavior(minijinja::UndefinedBehavior::Strict);
env.set_auto_escape_callback(|_| AutoEscape::None);
// Add filters
env.add_filter("to_prefix", |netmask: value::Serde<Ipv4Addr>| {
env.add_filter("to_prefix", |netmask: ViaDeserialize<Ipv4Addr>| {
let mask = netmask.to_bits();
let prefix = mask.leading_ones();
-10
View File
@@ -1,10 +0,0 @@
use crete::tftp::ServerError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("No clusters where found")]
NoClustersFound,
#[error("Server error: {0}")]
ServerError(#[from] ServerError),
}
-55
View File
@@ -1,55 +0,0 @@
use crete::cluster::Cluster;
use crete::environment::configure_environment;
use ipxe::IPXE_DIR;
use minijinja::{Environment, context, value};
use regex::regex;
pub async fn get_file(
filename: impl ToString,
http_url: impl ToString,
) -> Option<(Vec<u8>, &'static str)> {
let re = regex!(r"^talos/(?<cluster>.+)/(?<node>.+)\.ya?ml$");
let filename: String = filename.to_string();
let re = re.clone();
const IPXE_PATTERN: &str = "ipxe/";
if filename == format!("{IPXE_PATTERN}boot.ipxe") {
let mut env = Environment::new();
configure_environment(&mut env);
let template = env
.template_from_str(include_str!("./boot.ipxe"))
.expect("Template should be valid");
let clusters = Cluster::get_all().await;
let content = template
.render(context! {
clusters => value::Serde(clusters.values().collect::<Vec<_>>()),
httpUrl => http_url.to_string()
})
.unwrap();
Some((content.into(), "text/plain; charset=utf-8"))
} else if let Some(filename) = filename.strip_prefix(IPXE_PATTERN) {
Some((
IPXE_DIR.get_file(filename)?.contents().to_owned(),
"application/octet-stream",
))
} else if let Some(caps) = re.captures(&filename) {
let cluster = &caps["cluster"];
let node = &caps["node"];
let clusters = Cluster::get_all().await;
let cluster = clusters.get(cluster)?;
let node = cluster.node(node)?;
let config = node.config(cluster).await;
Some((config.into(), "application/yaml; charset=utf-8"))
} else {
None
}
}
-46
View File
@@ -1,46 +0,0 @@
use std::path::PathBuf;
use axum::debug_handler;
use axum::extract::Request;
use axum::http::Uri;
use axum::response::IntoResponse;
use reqwest::{StatusCode, header};
use crate::file::get_file;
#[debug_handler]
pub async fn handler(req: Request) -> impl IntoResponse {
let uri: Uri = req
.headers()
.iter()
.find(|(name, _)| header::HOST.eq(name))
.map(|(_, value)| value)
.expect("Host header should exist")
.to_str()
.expect("Header value should be valid ASCII")
.parse()
.expect("Host should be valid Uri");
let host = uri.host().expect("Uri should have host");
let port = uri.port().map(|port| port.as_u16()).unwrap_or(80);
let Some(path) = req.uri().path().strip_prefix("/") else {
return StatusCode::BAD_REQUEST.into_response();
};
let Some((file, content_type)) = get_file(path, format!("http://{host}:{port}")).await else {
return StatusCode::NOT_FOUND.into_response();
};
let path = PathBuf::from(path);
let filename = path.file_name().unwrap();
let filename = filename.to_str().unwrap();
let content_type = [(header::CONTENT_TYPE, content_type)];
let disposition = [(
header::CONTENT_DISPOSITION,
format!("inline; filename=\"{filename}\""),
)];
(content_type, disposition, file).into_response()
}
+119 -12
View File
@@ -1,27 +1,38 @@
mod cli;
mod error;
mod file;
mod http;
use std::net::SocketAddr;
use std::path::PathBuf;
use std::pin::pin;
use axum::Router;
use axum::extract::Request;
use axum::http::Uri;
use axum::response::IntoResponse;
use axum::routing::get;
use axum::{Router, debug_handler};
use clap::{CommandFactory, Parser};
use clap_complete::{Shell, generate as generate_complete};
use crete::cluster::Cluster;
use crete::environment::PathEnvironment;
use crete::environment::{PathEnvironment, configure_environment};
use crete::talosconfig::{get_current_context, set_context};
use crete::tftp::ServerError;
use crete::{get_configs_path, get_repo_path, set_repo_path, tftp};
use futures::StreamExt;
use futures::future::join_all;
use minijinja::{context, value};
use ipxe::IPXE_DIR;
use minijinja::{Environment, context};
use regex::Regex;
use reqwest::{StatusCode, header};
use thiserror::Error;
use crate::cli::{Cli, Commands, GlobalOpts};
use crate::error::Error;
use crate::file::get_file;
use crate::http::handler;
#[derive(Debug, Error)]
enum Error {
#[error("No clusters where found")]
NoClustersFound,
#[error("Server error: {0}")]
ServerError(#[from] ServerError),
}
async fn generate(opts: &GlobalOpts) -> Result<(), Error> {
let clusters = Cluster::get_all().await;
@@ -44,8 +55,8 @@ async fn generate(opts: &GlobalOpts) -> Result<(), Error> {
let content = template
.render(context! {
clusters => value::Serde(clusters.values().collect::<Vec<_>>()),
root => value::Serde(&opts.repo)
clusters => clusters.values().collect::<Vec<_>>(),
root => opts.repo
})
.unwrap();
@@ -90,6 +101,99 @@ async fn generate(opts: &GlobalOpts) -> Result<(), Error> {
Ok(())
}
#[debug_handler]
async fn handler(req: Request) -> impl IntoResponse {
println!("{req:?}");
let uri: Uri = req
.headers()
.iter()
.find(|(name, _)| header::HOST.eq(name))
.map(|(_, value)| value)
.expect("Host header should exist")
.to_str()
.expect("Header value should be valid ASCII")
.parse()
.expect("Host should be valid Uri");
let host = uri.host().expect("Uri should have host");
let port = uri.port().map(|port| port.as_u16()).unwrap_or(80);
let Some(path) = req.uri().path().strip_prefix("/") else {
return StatusCode::BAD_REQUEST.into_response();
};
let Some((file, content_type)) = get_file(path, format!("http://{host}:{port}")).await else {
return StatusCode::NOT_FOUND.into_response();
};
let path = PathBuf::from(path);
let filename = path.file_name().unwrap();
let filename = filename.to_str().unwrap();
let content_type = [(header::CONTENT_TYPE, content_type)];
let disposition = [(
header::CONTENT_DISPOSITION,
format!("inline; filename=\"{filename}\""),
)];
(content_type, disposition, file).into_response()
}
// TODO: Make this a proper async function
fn get_file(
filename: impl ToString,
http_url: impl ToString,
) -> impl Future<Output = Option<(Vec<u8>, &'static str)>> {
// TODO: Make this a static that is initialized once
let re =
Regex::new(r"^talos/(?<cluster>.+)/(?<node>.+)\.ya?ml$").expect("regex should be valid");
let filename: String = filename.to_string();
let re = re.clone();
async move {
const IPXE_PATTERN: &str = "ipxe/";
if filename == format!("{IPXE_PATTERN}boot.ipxe") {
let mut env = Environment::new();
configure_environment(&mut env);
let template = env
.template_from_str(include_str!("./boot.ipxe"))
.expect("Template should be valid");
let clusters = Cluster::get_all().await;
let content = template
.render(context! {
clusters => clusters.values().collect::<Vec<_>>(),
httpUrl => http_url.to_string()
})
.unwrap();
Some((content.into(), "text/plain; charset=utf-8"))
} else if let Some(filename) = filename.strip_prefix(IPXE_PATTERN) {
Some((
IPXE_DIR.get_file(filename)?.contents().to_owned(),
"application/octet-stream",
))
} else if let Some(caps) = re.captures(&filename) {
let cluster = &caps["cluster"];
let node = &caps["node"];
let clusters = Cluster::get_all().await;
let cluster = clusters.get(cluster)?;
let node = cluster.node(node)?;
let config = node.config(cluster).await;
Some((config.into(), "application/yaml; charset=utf-8"))
} else {
None
}
}
}
#[tokio::main]
async fn main() -> Result<(), Error> {
let cli = Cli::parse();
@@ -114,10 +218,13 @@ async fn main() -> Result<(), Error> {
axum::serve(listener, app).await.unwrap();
});
tftp::serve(ip, move |filename, ip| async move {
tftp::serve(ip, move |filename, ip| {
let filename = filename.to_owned();
async move {
get_file(filename, format!("http://{ip}:{port}"))
.await
.map(|(file, _)| file)
}
})
.await?;
}
+2 -2
View File
@@ -102,7 +102,7 @@ pub struct Node {
ntp: String,
install: Install,
kernel_args: Vec<String>,
patches: Patches<serde_json::Value>,
patches: Patches<serde_yaml::Value>,
sops: Secret,
}
@@ -124,7 +124,7 @@ impl Node {
path.add_extension("yaml");
let content = tokio::fs::read_to_string(path).await.unwrap();
let node: OptionalNodeDeserialize = serde_saphyr::from_str(&content).unwrap();
let node: OptionalNodeDeserialize = serde_yaml::from_str(&content).unwrap();
// We want all vectors to be empty vectors by default
// Sadly we have to this manually
+6 -6
View File
@@ -1,4 +1,4 @@
use minijinja::{Environment, context, value};
use minijinja::{Environment, context};
use optional_struct::optional_struct;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@@ -21,7 +21,7 @@ async fn render(
env: &Environment<'static>,
cluster: &Cluster,
node: &Node,
) -> Vec<serde_json::Value> {
) -> Vec<serde_yaml::Value> {
let env = env.clone();
let cluster = cluster.clone();
let node = node.clone();
@@ -35,12 +35,12 @@ async fn render(
.get_template(&name)
.unwrap()
.render(context! {
node => value::Serde(&node),
cluster => value::Serde(&cluster)
node,
cluster
})
.unwrap();
serde_saphyr::from_str(&content).unwrap()
serde_yaml::from_str(&content).unwrap()
})
.collect()
})
@@ -64,7 +64,7 @@ impl Patches<String> {
env: &Environment<'static>,
cluster: &Cluster,
node: &Node,
) -> Patches<serde_json::Value> {
) -> Patches<serde_yaml::Value> {
Patches {
all: render(self.all.clone(), env, cluster, node).await,
control_plane: render(self.control_plane.clone(), env, cluster, node).await,
+1 -1
View File
@@ -20,7 +20,7 @@ pub async fn get_current_context() -> Option<String> {
tokio::fs::read(&TalosConfig::merged_path())
.await
.ok()
.and_then(|config| serde_saphyr::from_slice(&config).ok())
.and_then(|config| serde_yaml::from_slice(&config).ok())
.map(|config: TalosConfig| config.context)
}
+5 -8
View File
@@ -5,7 +5,7 @@ use std::time::Duration;
use socket_pktinfo::{PktInfo, PktInfoUdpSocket};
use socket2::Domain;
use thiserror::Error;
use tokio::io::unix::{AsyncFd, AsyncFdRegisterError};
use tokio::io::unix::AsyncFd;
use tokio::net::UdpSocket;
use crate::tftp::packet::{ErrorCode, Mode, PACKET_SIZE};
@@ -29,8 +29,6 @@ pub enum Error {
UnexpectedPacket(Packet),
#[error("Timeout")]
Timeout,
#[error("AsyncFd: {0}")]
AsyncFd(#[from] AsyncFdRegisterError<PktInfoUdpSocket>),
}
pub async fn handle_connection<F, Fut>(
@@ -39,7 +37,7 @@ pub async fn handle_connection<F, Fut>(
callback: F,
) -> Result<(), Error>
where
F: Fn(String, IpAddr) -> Fut,
F: Fn(&str, IpAddr) -> Fut,
Fut: Future<Output = Option<Vec<u8>>>,
{
let src = info.addr_src;
@@ -61,7 +59,7 @@ where
let filename = request.filename();
println!("{src}: {filename} [{:?}]", request.mode());
let Some(data) = callback(filename.to_string(), info.addr_dst).await else {
let Some(data) = callback(filename, info.addr_dst).await else {
Packet::error(ErrorCode::FileNotFound, "Unknown file")
.send_to(&socket, &src)
.await?;
@@ -154,7 +152,7 @@ where
pub async fn serve<F, Fut>(ip: IpAddr, callback: F) -> Result<!, Error>
where
F: Fn(String, IpAddr) -> Fut + Clone + Send + 'static,
F: Fn(&str, IpAddr) -> Fut + Clone + Send + 'static,
Fut: Future<Output = Option<Vec<u8>>> + Send + 'static,
{
let socket = PktInfoUdpSocket::new(Domain::IPV4)?;
@@ -163,8 +161,7 @@ where
let addr: SocketAddr = (ip, 69).into();
socket.bind(&addr.into())?;
let async_fd = unsafe { AsyncFd::register(socket)? };
let async_fd = AsyncFd::new(socket)?;
let mut buf = [0u8; PACKET_SIZE];
println!("Tftp server started on {addr}");
-2
View File
@@ -1,2 +0,0 @@
[default.extend-words]
rela = "rela"