import socket def test_stream(addr, **kwargs) -> bool: # Examples # print(test_stream(("localhost", 1234))) # print(test_stream(("localhost", 9001))) # print(test_stream("/tmp/aohansoth", family=socket.AF_UNIX)) # print(test_stream("/tmp/bb", family=socket.AF_UNIX)) try: s = socket.socket(**kwargs) s.connect(addr) return True except OSError: return False def print_status(r,name,desc): print(f"{r:8} {name:>20} {desc}") def print_stream(name, desc, addr, **kwargs): r = "ECONN" if test_stream(addr, **kwargs): r = "OK" print_status(r, name, desc) def main(): print_status("status", "service_name", "description") print_status("OK", "exozy.me", "You can test this with `ping exozy.me`") print_status("OK", "status.exozy.me", "The page you are looking at. Edit at https://git.exozy.me/exozyme/isitstilup") #print_stream("name", "desc", ("localhost", 9001)) print_stream("reposearch.exozy.me", "Git reposearch Meta Search Engine", "/srv/http/pages/reposearch", family=socket.AF_UNIX) print_stream("textgen.exozy.me", "LLM Vicuna Frontend", "/srv/http/pages/reposearch", family=socket.AF_UNIX) if __name__ == '__main__': main()