panicbit / twinstar Goto Github PK
View Code? Open in Web Editor NEWA gemini server implementation
License: Other
A gemini server implementation
License: Other
Hello! I'm having some difficulty running the server. The error appeared in my original code, but it seems to happen in the example too. I've put some sample code that produces it below, heavily based on the example code.
use anyhow::*;
use futures::{future::BoxFuture, FutureExt};
use northstar::{Server, Request, Response, GEMINI_PORT};
#[tokio::main]
async fn main() {
let result = Server::bind(("localhost", GEMINI_PORT))
.serve(handle_request)
.await;
if let Err(e) = result {
for e in e.chain() {
println!("{:?}", e);
}
}
}
fn handle_request(request: Request) -> BoxFuture<'static, Result<Response>> {
async move {
let path = request.path_segments();
let response = northstar::util::serve_dir("public", &path).await?;
Ok(response)
}
.boxed()
}
And the output is:
Os { code: 2, kind: NotFound, message: "No such file or directory" }
Which also renders as
Error: No such file or directory (os error 2)
when the actual example program is run. I very quickly peeked through the source code, but I don't really know where it's coming from. It might be worth noting that the handle_request
method is never run.
Any help is appreciated. I'm running 0.1.0
off of crates.io.
Travis introduced annoying limits and ceremonies around their OSS plan and silently denies service if you run out of credits.
CI should probably be moved to GitHub Actions.
Probably Travis, but I'm open to try something else (except Github Actions).
The current timeout of 1 second for sending the response to the client is a bit too short.
I suggest raising it to 30 seconds for now, since it is still shared with the timeout for receiving the request.
See #17 (comment)
It should contain mention of the CHANGELOG.md.
gemini_mime()
is a bit inconvenient as it returns a Result
. Considering that the function doesn't take parameter's and is side-effect free, it should either always succeed or always fail, depending on the correctness of the impl. The correctness of the impl can however be asserted using tests. Furthermore, there is no need to parse the mime over and over, so a lazy_static can be used.
This issue is referring to the crash referenced by #3, wherein any authenticated connections from Kristall to northstar crash with the error
[2020-11-22T01:47:23Z ERROR northstar] Failed to establish TLS session
Caused by:
invalid certificate: BadDER
As best as I can tell, the backtrace for this error looks something like this: (all line numbers are as of 0ca71e4)
Server::serve()
(lib.rs:60)tokio_rustls::TlsAcceptor::accept()
in Server::serve_client()
(lib.rs:69)webpki::EndEntityCert::from()
, although I'm not sure where fromwebpki::cert::parse_cert_internal()
, but why exactly is anyone's guessparse_cert_internal()
throws webpki::Error::BadDER
a million and one times throughout it's execution, and it would be a real hassle to figure out which on is ours. I'm honestly kinda stumped on how to go about debugging this or asking for help, since I'm assuming:
But honestly I don't know enough about whatever a DER file is supposed to look like to go through and identify if the certificate is invalid or if there's an issue with the stream or if there's an issue with the client library.
Any ideas on how to move forward? Kristall is the only GUI client supporting client certs (afaik), and definitely the most popular one, so I'd hate to release an app that couldn't support it, but at the same time, where the hell even is this bug???
certificates
example (although this should work with any program that prompts the user to connect with a client cert)I am using this Cargo.lock, and Kristall version v0.3, built and run on Fedora 33
Hello! I've been writing a small gemini client and I believe a lot of the functionality in the types
directory could be used as a standalone library. Is that something that would be of interest at all?
Response::success
should just have the additional body
parameter. It should be comparatively rare that one wants to send an empty body and it still can be achieved by simply passing vec![]
.
The guess_mime
crate can detect a wider range of mime types by file extension.
It should be integrated into the guess_mime_from_path
method:
As far as I can tell, the Gemini MIME is not included in guess_mime
, so it still needs to be supported as a special case.
Hello,
This library looks really awesome and I would like to use this library in a server I'm considering writing, but I would like to know what the intended license is, and if one will be added. Without a license the code is currently All Rights Reserved which limits the license I can chose and potentially the legality of using the library in general.
If you're unsure which license, if any, you want to use with this library I've found this article to be very helpful:
https://man.sr.ht/license.md
Thank you,
Andrew
All instances of ?
should be prefaced with a .context()
(or similar) to make errors actually useful.
Timeouts are crucial to prevent trivial DOS attacks.
It is however unclear how exactly they should be integrated into the API, especially with regards to Response
s.
Create an API that allows easier creation of Gemini documents.
According to the spec, meta strings 1024
bytes:
<META> is a UTF-8 encoded string of maximum length 1024 bytes, whose meaning is <STATUS> dependent.
[...]
If a server sends a which is not a two-digit number or a <META> which exceeds 1024 bytes in length, the client SHOULD close the connection and disregard the response header, informing the user of an error.
See 3.1 Response headers.
As such Meta::new
should reject strings that exceed 1024
bytes and Meta::new_lossy
should truncate to 1024 bytes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.