|
@ -1,6 +1,8 @@ |
|
|
#!/usr/bin/python |
|
|
#!/usr/bin/python |
|
|
# -*- coding:utf-8 -*- |
|
|
# -*- coding:utf-8 -*- |
|
|
|
|
|
|
|
|
|
|
|
import copy |
|
|
|
|
|
|
|
|
testConfig = {} |
|
|
testConfig = {} |
|
|
|
|
|
|
|
|
def __originConfig() -> dict: |
|
|
def __originConfig() -> dict: |
|
@ -8,7 +10,7 @@ def __originConfig() -> dict: |
|
|
'caption': 'Brook original', |
|
|
'caption': 'Brook original', |
|
|
'client': { |
|
|
'client': { |
|
|
'type': 'brook', |
|
|
'type': 'brook', |
|
|
'server': testConfig['host'], |
|
|
'server': testConfig['bind'], |
|
|
'port': testConfig['port'], |
|
|
'port': testConfig['port'], |
|
|
'passwd': testConfig['passwd'] |
|
|
'passwd': testConfig['passwd'] |
|
|
}, |
|
|
}, |
|
@ -25,7 +27,7 @@ def __wsConfig() -> dict: |
|
|
'caption': 'Brook websocket', |
|
|
'caption': 'Brook websocket', |
|
|
'client': { |
|
|
'client': { |
|
|
'type': 'brook', |
|
|
'type': 'brook', |
|
|
'server': testConfig['host'], |
|
|
'server': testConfig['bind'], |
|
|
'port': testConfig['port'], |
|
|
'port': testConfig['port'], |
|
|
'passwd': testConfig['passwd'], |
|
|
'passwd': testConfig['passwd'], |
|
|
'ws': { |
|
|
'ws': { |
|
@ -47,7 +49,7 @@ def __wssConfig() -> dict: |
|
|
'caption': 'Brook websocket with TLS', |
|
|
'caption': 'Brook websocket with TLS', |
|
|
'client': { |
|
|
'client': { |
|
|
'type': 'brook', |
|
|
'type': 'brook', |
|
|
'server': testConfig['host'], |
|
|
'server': testConfig['bind'], |
|
|
'port': testConfig['port'], |
|
|
'port': testConfig['port'], |
|
|
'passwd': testConfig['passwd'], |
|
|
'passwd': testConfig['passwd'], |
|
|
'ws': { |
|
|
'ws': { |
|
@ -60,7 +62,7 @@ def __wssConfig() -> dict: |
|
|
}, |
|
|
}, |
|
|
'server': [ |
|
|
'server': [ |
|
|
'brook', 'wssserver', |
|
|
'brook', 'wssserver', |
|
|
'--domainaddress', testConfig['host'] + ':' + str(testConfig['port']), |
|
|
'--domainaddress', testConfig['bind'] + ':' + str(testConfig['port']), |
|
|
'--cert', testConfig['cert'], |
|
|
'--cert', testConfig['cert'], |
|
|
'--certkey', testConfig['key'], |
|
|
'--certkey', testConfig['key'], |
|
|
'--password', testConfig['passwd'], |
|
|
'--password', testConfig['passwd'], |
|
@ -85,7 +87,9 @@ def __brookConfig(brookConfig: dict) -> dict: |
|
|
|
|
|
|
|
|
def test(config: dict) -> list: |
|
|
def test(config: dict) -> list: |
|
|
global testConfig |
|
|
global testConfig |
|
|
testConfig = config |
|
|
testConfig = copy.deepcopy(config) |
|
|
|
|
|
if testConfig['bind'].find(':') >= 0: |
|
|
|
|
|
testConfig['bind'] = '[' + testConfig['bind'] + ']' |
|
|
return [ |
|
|
return [ |
|
|
__brookConfig(__originConfig()), |
|
|
__brookConfig(__originConfig()), |
|
|
__brookConfig(__wsConfig()), |
|
|
__brookConfig(__wsConfig()), |
|
|