-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I learned something new about Rust and traits
Basically, if I send something to a new thread that implements the Fn trait (e.g. a function or a closure), then it needs to implement Copy or Clone. Clippy said "use Copy", so I went with that. I thought "eh, it's just a function pointer anyway", but no. Rust is a bit more complex there. And because the function needs to implement Copy, everything else does too. Numbers work, but not Strings, even if they're static. So the fix was to just use Clone instead and explicitly clone the function type (which is always gonna be a function pointer anyway, not a struct). I did remove Chargen and Quote of the Day as well as the ability to change ports. I will probably re-add QotD, but I'll also need to work on system file paths (i.e. for the config and how it's getting read) too. The last thing that's missing is a SIGINT handle. I probably can just shut off the program, because I don't know how I would use channels without either the actual service of the channel communication getting blocked. When I'm done, I'll try another attempt at tokio-fying this application, since I originally started this as practice for "low-level" network stuff like this (using TcpStream and UdpSocket, I am very happy Rust and Zig have a std-library that wraps around Winsock and POSIX sockets).
- Loading branch information
1 parent
90297fe
commit 616787e
Showing
12 changed files
with
105 additions
and
76 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 +1,12 @@ | ||
[package] | ||
name = "inetdx" | ||
description = "Rust implementation of inetd internal services" | ||
description = "Rust implementation of inetd trivial services" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
apputils = "0.1.5" | ||
toml = "0.8" | ||
serde = { version = "1", features = ["derive"] } | ||
chrono = "0.4" | ||
chrono = "0.4" | ||
ctrlc = { version = "3.4", features = ["termination"] } |
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,13 +1,5 @@ | ||
# inetdx | ||
Rust implementation of inetd trivial services | ||
|
||
Rust implementation of inetd internal services | ||
|
||
| Service | Port | RFC | Notes | | ||
| -------- | ---- | ------- | ------------------------------------ | | ||
| Echo | 7 | RFC 862 | - | | ||
| Discard | 9 | RRC 863 | - | | ||
| Daytime | 13 | RFC 867 | RFC 2822 timestamp | | ||
| QotD | 17 | RFC 865 | Custom list or /etc/motd as fallback | | ||
| Chargen | 19 | RFC 864 | - | | ||
| Time | 37 | RFC 868 | Unix Timestamp as u64 | | ||
| Hostname | 42 | - | cat /etc/hostname over TCP+UDP | | ||
<!--TODO: Add more description, e.g. list of network services--> | ||
This is supposed to be a rather simple project, but I'm open for any feature requests, so just [open an issue](https://github.com/Stridsvagn69420/inetdx/issues/new). |
Empty file.
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
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
Empty file.
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
Oops, something went wrong.