-- Leo's gemini proxy

-- Connecting to senders.io:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en;

Devlog 1 - Part 2 - Correcting for mistakes


Literally after I posed yesterdays devlog I realized "Wait how the hell do I account for SNI? How do I have gemini.senders.io/index.gmi and app.senders.io/index.gmi?


Yesterday's devlog


I got so use to running, if need be, smaller services (SOA style) behind an nginx or some other proxy that does the SSL handshake and then proxies over to another service to handle.


Since this will just be a monolith where you can run your different services under I need to add a host layer ontop of the router layer. I wanted to keep the heirarchy of:

1 Server -> multiple hosts -> multiple routers -> multiple routers.


The code


ResponseMessage response =
    hosts
        .filter(h -> h.hosts().equals(request.uri().getHost()))
        .flatMap(Host::routers)
        .flatMap(Router::routes)
        .filter(r -> RouteMatcher.match(r.route(), request.uri()))
        .findFirst()
        .map(r -> r.handle(request))
        .orElse(this.fallbackRouteHandler.handle(request.uri()));

Basically you'll be at the mercy of "first come first serve" (literally) but we:


filter by host (app.senders.io)

map to the host's routers

iterate over the routers' routes

filter for matching paths

take the first we find

otherwise use server's fallback handler


The fallback handler is an idea that I am thinking we basically allow you to put int like maybe just try and serve anything we don't match as a file. But I have a feeling you'd handle that on the route level but registering essentially a /* route or something...


What's next


It will definetly take some time before I get this back into a working state. I've torn apart a lot of the sub-server layer that you'll be interfacing with as a developer and I want it to feel consistent.


Javadoc?


Something that piqued my interest was getting the javadoc on gemini. Most likely it'll have to be a hand written reference but there is an idea for you java devs bored looking for a project: Javadoc -> gemini processor!


I'm excited again


Thanks, I am excited again to actually push this thing out. I am also thinking of how to profile this app. So if you have ideas, or ways to test a gemini servers features...


Thanks again

- Senders


Links


Gemlog

Home

-- Response ended

-- Page fetched on Sat Apr 20 10:19:30 2024