Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
wh33zle
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
1.
▲
by
wh33zle
2y ago
How low do you need the footprint? At firezone.dev, we also build a ZT product and our headless-client and Gateway are in Rust and use around 15-30 MB of RAM. Could likely be tuned further down if you need it :)
2.
▲
by
wh33zle
2y ago
One of the coolest things I've learned about recently is `.git/info/exclude`. It allows you to ignore files in the local repo without modifying the repo's .gitignore Very useful if you want to add your own .envrc or shel
3.
▲
by
wh33zle
2y ago
Depends. MASQUE implies QUIC and a lot of coporate networks still block QUIC, forcing a fallback to TCP (for web browsers). Not sure how they want to address this in case of WARP? Nevertheless, MASQUE is some pretty exciting development in
4.
▲
by
wh33zle
2y ago
I find myself defining my own traits very rarely these days. Traits enable polymorphic actions on data. Most of the time, you simply don't need that. An enum often suffices to express the different combinations. Of course, from a patte
5.
▲
by
wh33zle
2y ago
WASM shouldn't care about which language the host is written in vs what the apps are written in. Writing the host in C seems like a bad choice though. Isn't that exactly the kind of software you want to ensure is memory-safe?
6.
▲
by
wh33zle
2y ago
> An async method, basically does the same, but it means your logic doesn't have to handle the polling, orchestration, selection, ordering, etc. In order to take advantage of that, I'd need to create one `async` method for each
7.
▲
by
wh33zle
2y ago
Thinking about your example again made me think of another requirement: Multiplexing. STUN ties requests and responses together with a transaction ID that is encoded as an attribute in the message. Modelling this using `Sink`s and `Stream`s
8.
▲
by
wh33zle
2y ago
> The stream is a stream of Result<ParsedMessage, ErrorMessage> Fair point! Yeah that would allow error handling the state machine. > > Lastly, and this is where using async falls apart: If you try to model these state machin
9.
▲
by
wh33zle
2y ago
This isn't an adequat comparison in my eyes. Your example moves a very critical component out if the "protocol logic": message parsing. Dealing with invalid messages is crucial in network protocols, meaning the API should be
10.
▲
by
wh33zle
2y ago
> [EDIT2] Any good recommendations of a tiny protocol that might be a good walk through intro to this? > > Something even simpler than Gopher or SMTP? Would be nice to have a really small thing to do a tiny project in. I only have
11.
▲
by
wh33zle
2y ago
> What am I missing here? From unrelated code, I want to call `get_ip_via_stun_or_timeout(hostnames: &[String], timeout: Duration) -> Option<String>`, is what I'm missing that I need to wrap this state machine in anothe
12.
▲
by
wh33zle
2y ago
> If I want to write a function that listens or times out in sans-IO style, should I use tokio::select? If so, where is the async runtime coming from, and how will the caller of the function be able to avoid caring? To "time-out&quo
13.
▲
by
wh33zle
2y ago
The line between applications and libraries is fairly blurry, isn't it? In my experience, most applications grow to the point where you have internal libraries or could at least split out one or more crates. I would go as far as saying
14.
▲
by
wh33zle
2y ago
> I would have been more interested in seeing how they could implement an encapsulated function in the sans-IO style that had to do something like wait on an action or a timer The "encapsulated function" is the `StunBinding` st
15.
▲
by
wh33zle
2y ago
I too came from the OOP world to Rust (6 years ago now) and in my first 2-3 years I produced horrible code! Type parameters and traits everywhere. Structs being (ab-)used as class-like structures that provide functionality. Rust works bette
16.
▲
by
wh33zle
2y ago
Channels work fine if you are happy for your software to have an actor-like design. But as you say, it comes with problems: Actors / channels can be disconnected for example. You also want to make sure they are bounded otherwise you do
17.
▲
by
wh33zle
2y ago
If Rust ever gets a native generator syntax, this might be become achievable because one would be able to say: `yield transmit` to "write" data whilst staying within the context of your async operation. In other words, every `sock
18.
▲
by
wh33zle
2y ago
They actually play together fairly well higher up the stack. Non-blocking IO (i.e async) makes it easy to concurrently wait for socket IO and time. You can do it with blocking IO too by setting a read-timeout on the socket but using async p
19.
▲
by
wh33zle
2y ago
Yes, traffic is routed to the gateway through a WireGuard tunnel. Broadly speaking, what happens is: - Client and gateway perform ICE to agree on a socket pair (this is where hole-punching happens or if that fails, a relay is used) - The so
20.
▲
by
wh33zle
2y ago
Haha thank you! Yes there are indeed similarities to rust-libp2p! Over there, things are more interleaved though because the actual streams and connections are still within `Future`-like constructs and not strictly split like in the sans-IO
21.
▲
by
wh33zle
2y ago
I tried to address this at the end of the post: If what you are implementing is mostly _sequential_ IO operations, then this model becomes a bit painful. That isn't always the case though. In more packet-oriented usecases (QUIC, WebRTC
22.
▲
by
wh33zle
2y ago
Yes! Decoupling is the goal of this! Using non-blocking IO is still useful in this case because it means we can wait on two conditions at once (i.e. socket IO and time), see [0]. It is possible to do the same blocking IO but it feels a litt
23.
▲
by
wh33zle
2y ago
In Firezone's case, things are built on top of UDP so technically there aren't any (kernel-managed) connections and only a single file descriptor is allocated for the UDP socket. The main benefit is being able to use `&mut` ev
24.
▲
by
wh33zle
2y ago
I did some quick research and found that there is an "async job" API in OpenSSL. That one appears to do IO though, it even says that creating a job is a very expensive operation and thus jobs should be reused. Is the similarity yo
25.
▲
Sans-IO: The secret to effective Rust for network services
(firezone.dev)
233 points
by
wh33zle
2y ago
|
86 comments
26.
▲
by
wh33zle
2y ago
If you don't mind me asking, how much did they pay you to build it?
27.
▲
by
wh33zle
3y ago
I really enjoyed: Software Architecture, The Hard Parts. https://www.oreilly.com/library/view/software-architecture-t... One part it discusses is in fact communication patterns along the dimensions of: - sync/
28.
▲
Ask HN: How do you monitor your systemd services?
127 points
by
wh33zle
3y ago
|
60 comments
29.
▲
by
wh33zle
3y ago
At the bottom is the link to the more technical specification: https://github.com/libp2p/specs/blob/master/kad-dht/README.m...
30.
▲
by
wh33zle
4y ago
Don't have any data on that unfortunately.
More ›