Gemini in Godot?

https://www.reddit.com/r/geminiprotocol/comments/1ec4h3q/gemini_in_godot/

created by poeticAndroid on 25/07/2024 at 20:02 UTC*

9 upvotes, 4 top-level comments (showing 4)

[SOLVED! link in comments]

Hello! I'm trying to make a Gemini browser in the Godot game engine, just for fun.. :p

I think it *should* be possible since Godot has TLS support[1], but I'm not sure how to get it to work with Gemini. Whenever I try to connect to sites like `gemini://geminiprotocol.net/` it seems to fail with a `STATUS_ERROR_HOSTNAME_MISMATCH` status.

1: https://docs.godotengine.org/en/stable/classes/class_streampeertls.html

Can someone help me out? I don't really know anything about TLS. Like, what should I put as `common_name` in the connect_to_stream[2] method? Should I get my own certificate from somewhere? Godot seems to already include its own[3].

2: https://docs.godotengine.org/en/stable/classes/class_streampeertls.html#class-streampeertls-method-connect-to-stream

3: https://github.com/godotengine/godot/blob/master/thirdparty/certs/ca-certificates.crt

Comments

Comment by hermesnikesas at 25/07/2024 at 20:20 UTC*

7 upvotes, 1 direct replies

I don't know anything about Godot, but if I'm reading the API correctly, it seems that the method you mentioned performs certificate verification. The "common_name" should be the FQDN of the site you want to access (for instance, if you want to access gemini://maiaforum.net/index.gmi, the FQDN would be "maiaforum.net"). For the 3rd argument, you will likely need to disable verification completely, or find an option that will allow self-signed certificates (which are standard for Gemini), since most TLS libraries don't accept those by default.

Comment by odintsoff at 25/07/2024 at 20:31 UTC

3 upvotes, 1 direct replies

Are you going to make it 3D like an old Gopher browser (forgot the name) where you navigate the links in a 3D environment?

Comment by TurtleGraphics64 at 27/09/2024 at 07:05 UTC

2 upvotes, 0 direct replies

hi, was curious how far you got on this project!

Comment by poeticAndroid at 31/07/2024 at 07:48 UTC

1 upvotes, 0 direct replies

[SOLVED!]

I figured it out. turns out you just gotta wait for the TCP to connect first before you add the TLS layer. (and you gotta call the `poll` method at lot.)

https://github.com/poeticAndroid/gemdot/blob/master/protocols/gemini.gd