Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/relay_minitest/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ipaddress
import ssl

import pytest
Expand All @@ -15,13 +16,21 @@ def pytest_addoption(parser):


def get_ssl_context(maildomain):
is_ip = False
try:
ipaddress.ip_address(maildomain)
is_ip = True
except ValueError:
pass

if (
maildomain.startswith("_")
or maildomain.startswith("10.")
or maildomain.startswith("172.")
or maildomain.startswith("192.168.")
or maildomain == "localhost"
or maildomain == "127.0.0.1"
or is_ip
):
ctx = ssl.create_default_context()
ctx.check_hostname = False
Expand Down
Loading