add a flag, --gopherhost

This commit is contained in:
randomuser 2021-07-29 22:59:21 -05:00
parent bc1d100297
commit 252c63a0d5
1 changed files with 5 additions and 1 deletions

View File

@ -42,7 +42,7 @@ class GopherLine:
try: self.host = split[2]
except IndexError:
if location == True: self.host = host
if location == True: self.host = ghost
try: self.port = split[3]
except IndexError:
@ -222,6 +222,8 @@ def parseArgs():
help="group to change to on startup")
parse.add_argument("-s", "--host", default="localhost",
help="host to host on")
parse.add_argument("-gs", "--gopherhost", default=None,
help="host defaulted to in links on gophermaps")
parse.add_argument("-p", "--port", default=70, type=int,
help="port to host on")
parse.add_argument("-d", "--dir", default="/var/gopher",
@ -240,11 +242,13 @@ if __name__ == "__main__":
switchgrp = grp.getgrnam(args.group).gr_gid
switchusr = pwd.getpwnam(args.user).pw_uid
host = args.host
ghost = args.gopherhost
port = args.port
location = args.dir
exempt = args.direxc
nocgi = args.nocgi
log.log("arguments good")
if ghost == None: ghost = host
try:
with TCPServer((host, port), GopherHandler) as server:
os.setgid(switchgrp)