💾 Archived View for tilde.team › ~smokey › logs › 2022-05-24-duckling-guide.gmi captured on 2024-05-12 at 15:16:58. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-07-16)

-=-=-=-=-=-=-

Duckling Proxy Quick Setup Guide For Local Hosting

This is a guide to help anyone who might want to set up a local duckling proxy. I was initially confused as to how to get it working or how to make a server certificate/key and puzzled things out. Here is a step-by-step of what I did, in as simple instructions as I can muster. I am on linux but shouldnt be much different on other systems. Good luck!

Adknowledgements

Duckling Proxy Homepage

Acidus's Public Duckling Proxy

DuckDuckGo Input: A Simple CGI Script For Searching DDG In Your Client

Files & Dependencies

Dependencies:

Go

Program Files (download these!):

Duckling Proxy Github

Gemcert Git

Step 0: Figure out your host PC's internal IPV4 address

1. Open terminal

2. Run this command

ip addr | grep inet

A large block of text will be printed out. what you are looking for is a "INET 10.0.0.XXX" number after the default gateway (typically 127.0.0.1).

If you have a hard time finding this number, you can try the default gateway (127.0.0.1) in place of YOUR_IPV4. This didn't work for me but it might work for you (or so im told)

What is an internal ipv4?

Very briefly stated, an internal IP is a kind of "network name" assigned to your computer by the router. Each computer connected to your network has an ip addressed to it. There are generally two kinds of IP your computer has, an internal and external.

The internal ip is the name your router gives it, typically a 10.0.0.XXX address. This is the local name all devices on your network use to refer to eachother. The external IP is the name the router assigns your computer for external connection from other networks. Its the name that computers outside your network refer to your computer as.

Since this is a local proxy running on the same computer as the gemini client, we are effectively telling the computer to connect to itself by pointing to its local IP address.

Step 1: Use Gemcert to generate required cert and key files

go run main.go -server -domain YOUR_IPV4

This will generate a pair of files named YOUR_IPV4.crt and YOUR_IPV4.key needed for Duckling Proxy to work.

Step 2. Configure & run duckling-proxy.go

go run duckling-proxy.go -c YOUR_IPV4.crt -k YOUR_IPV4.key -a YOUR_IPV4

At this point the duckling proxy program should be up and running, and print out the message

Info: Starting Duckling Proxy v0.2.1 on YOUR_IPV4 port: 1965

The specifics of the command

go run duckling-proxy.go: is self-explainitory
-c YOUR_IPV4.crt: defines the /path/name to your crt file. No need for path if in same dir
-k YOUR_IPV4.key: Same as -c but for the key file
-a YOUR_IPV4: Binds the proxy to your computers local address 

Optional Duckling Configs

Duckling has several configurations that can be changed to suit your taste. For example, I like the option to have links to images if I want to view them by default. You can either set the -flag at startup or go into the code itself and change the default options. All flag options are listed down below in references. To edit the default values, open duckling-proxy.go file and go to line 26. From there change the true and false values as you see fit.

Step 3: Configure client to use proxy

I am using lagrange, arguably the most popular GUI gemini client. If you are using some other client, refer to the supported clients list in references. For Lagrange:

Alright! Theoretically if all went well, we can try out a website. For best experience its better to stay with smol-orientated websites. How about:

https://solar.lowtechmagazine.com/

If you can reach it and see readable text without duckling-proxy crashing then that means we are done! Congratz, you are winnar.

Connecting to duckling proxy on other devices

Lets say for example that you have lagrange on your phone or another computer and would like duckling to work for those devices too. All you need to do is go through the same process in step 3 but for your device. Same host IPV4 and everything.

Keep in mind that this only works for devices on the same network. If you want to use your duckling service outside the local network like on your cell service, you need to port-forward 1695 in your router, and connect to it through your host external_IPV4:1965

References

duckling-proxy [flags]

  -a, --address string          Bind to address
                                 (default "127.0.0.1")
  -m, --citationMarkers         Use footnote style citation markers
  -s, --citationStart int       Start citations from this index (default 1)
  -e, --emitImagesAsLinks       Emit links to included images
  -l, --linkEmitFrequency int   Emit gathered links through the document after this number of paragraphs (default 2)
  -T, --maxConnectTime int      Max connect time (s)
                                 (default 5)
  -t, --maxDownloadTime int     Max download time (s)
                                 (default 10)
  -n, --numberedLinks           Number the links
  -p, --port int                Server port (default 1965)
  -r, --prettyTables            Pretty tables - works with most simple tables
  -c, --serverCert string       serverCert path.
  -k, --serverKey string        serverKey path.
      --unfiltered              Do not filter text/html to text/gemini
  -u, --userAgent string        User agent for HTTP requests
  -v, --version                 Find out what version of Duckling Proxy you're running
Supported clients

The following clients support per-scheme proxies and can be configured to use Duckling proxy.

Amfora - supports per scheme proxies since v1.5.0
AV-98 - Merge pull request #24 then use set http_proxy machine:port to access.
diohsc - edit diohscrc config file
gemget - use -p option
GemiNaut - since 0.8.8, which also has its own native html to gemini conversion - update in settings
Lagrange - set proxy in preferences (use 127.0.0.1:port, not localhost:port for localhost)
Telescope - set proxy in the config file add: proxy "https" via "gemini://127.0.0.1:1965", and similarly for http

Back To Logs