Browse Source

feat: ipv6 test option

master
dnomd343 2 years ago
parent
commit
68e28873dc
  1. 4
      Tester/Settings.py
  2. 11
      Tester/__init__.py
  3. 3
      test.py

4
Tester/Settings.py

@ -3,8 +3,8 @@
Settings = {
'workDir': '/tmp/ProxyC',
'serverBind': '127.0.0.1',
'clientBind': '127.0.0.1',
'serverBind': '',
'clientBind': '',
'site': 'www.bing.com',
'host': '',
'cert': '',

11
Tester/__init__.py

@ -39,7 +39,7 @@ def waitPort(port: int, times: int = 100, delay: int = 100) -> bool: # wait unt
return False # timeout
def httpCheck(socksInfo: dict, url: str, timeout: int = 10):
def httpCheck(socksInfo: dict, url: str, timeout: int = 10) -> None:
socksProxy = 'socks5://%s:%i' % (hostFormat(socksInfo['addr'], v6Bracket = True), socksInfo['port'])
try:
proxy = {
@ -90,7 +90,7 @@ def runTest(testInfo: dict, testUrl: str, testFilter: set or None, delay: int =
logging.error('\n%s' % testInfo['server'].output)
def test(testIter: iter, threadNum: int, testUrl: str, testFilter: set or None = None):
def test(testIter: iter, threadNum: int, testUrl: str, testFilter: set or None = None) -> None:
threads = []
while True: # infinite loop
try:
@ -112,7 +112,12 @@ def test(testIter: iter, threadNum: int, testUrl: str, testFilter: set or None =
thread.join()
def loadCert(host: str = 'proxyc.net', remark: str = 'ProxyC'):
def loadBind(serverV6: bool = False, clientV6: bool = False) -> None:
Settings['serverBind'] = '::1' if serverV6 else '127.0.0.1'
Settings['clientBind'] = '::1' if clientV6 else '127.0.0.1'
def loadCert(host: str = 'proxyc.net', remark: str = 'ProxyC') -> None:
loadPath = lambda x: os.path.join(Settings['workDir'], x)
certFlag = genFlag(length = 8)
caCert = loadPath('proxyc_%s_ca.pem' % certFlag)

3
test.py

@ -20,6 +20,7 @@ helpMsg = '''
--url URL http check url
--filter ID1[,ID2...] test the specified id
--all test extra shadowsocks items
--ipv6 test on ipv6 network
--help show this message
'''
@ -44,6 +45,8 @@ if getArg('--thread') is not None:
if getArg('--filter') is not None:
testFilter = set(getArg('--filter').split(','))
isV6 = '--ipv6' in sys.argv
Tester.loadBind(serverV6 = isV6, clientV6 = isV6)
Tester.loadCert('proxyc.net', 'ProxyC')
logging.critical('TEST ITEM: ' + ('all' if testItem is None else testItem))
logging.critical('FILTER: %s' % testFilter)

Loading…
Cancel
Save