#!/usr/bin/env python3
import socket
import threading
import time


SERVICES = [
    ("192.168.10.10", 443, b"SRV1 HTTPS\n"),
]


def serve(host: str, port: int, payload: bytes) -> None:
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    sock.bind((host, port))
    sock.listen()
    while True:
        conn, _ = sock.accept()
        try:
            conn.sendall(payload)
        finally:
            conn.close()


if __name__ == "__main__":
    for host, port, payload in SERVICES:
        thread = threading.Thread(target=serve, args=(host, port, payload), daemon=True)
        thread.start()

    while True:
        time.sleep(3600)
