💾 Archived View for gem.rmgr.dev › files › gemring.py captured on 2022-04-29 at 12:15:51.

View Raw

More Information

⬅️ Previous capture (2022-04-28)

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

#Usage: python3 gemrng.py --cert /path/to/cert.crt --key /path/to/key.key --port 1965 --list /path/to/list.txt
#This is super duper alpha software
import ssl
import socket
import socketserver
import re
from urllib.parse import urlparse
import argparse

parser = argparse.ArgumentParser(description='Run a gemring on the Gemini protocol')
parser.add_argument('--cert', type=str,
                   help='certificate location for the server', required=True)
parser.add_argument('--key', type=str,
                   help='private key location for the server', required=True)
parser.add_argument('--port', type=int, default=1965,
                   help='port to run on (default: 1965)')
parser.add_argument('--list', type=str, default="ring.txt",
                   help='text file containing a list of gemini capsules to link to (default: ring.txt)')


args = parser.parse_args()

context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(args.cert, args.key)

NO_SITE_FOUND = b'59 NO_SITE_FOUND\r\n' 
MAX_REQ