Browse Source

feat: test of ss and ssr

master
Dnomd343 3 years ago
parent
commit
2826f720b7
  1. 11
      demo.py
  2. 30
      test.py
  3. 1
      test/ShadowsocksR.py
  4. 2
      test/docker/shadowsocks.py
  5. 3
      test/docker/shadowsocksr.py
  6. 1
      test/docker/sip003.py

11
demo.py

@ -1,3 +1,6 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import time import time
import socket import socket
import requests import requests
@ -28,10 +31,6 @@ testInfo = {
} }
print("start") print("start")
print(dir(Builder))
print(dir(Checker))
print(testInfo) print(testInfo)
task = Builder.build(testInfo, '/tmp/ProxyC') task = Builder.build(testInfo, '/tmp/ProxyC')
print(task) print(task)
@ -40,7 +39,7 @@ if Builder.check(task) == False:
print("error exit") print("error exit")
Builder.destroy(task) Builder.destroy(task)
else: else:
print("test with gstatic") print("http check")
health, delay = Checker.httpCheck(task['port']) health, delay = Checker.httpCheck(task['port'])
print("health = " + str(health)) print("health = " + str(health))
if delay < 0: if delay < 0:
@ -48,4 +47,4 @@ else:
else: else:
print("delay = " + format(delay, '.2f') + 'ms') print("delay = " + format(delay, '.2f') + 'ms')
Builder.destroy(task) Builder.destroy(task)
print("stop") print("done")

30
test.py

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
import sys
import time import time
import subprocess import subprocess
@ -8,17 +9,11 @@ import test as Tester
import ProxyBuilder as Builder import ProxyBuilder as Builder
import ProxyChecker as Checker import ProxyChecker as Checker
# print(dir(Tester)) defaultPort = 10808
defaultPasswd = 'dnomd343'
data = Tester.Shadowsocks(1081, 'dnomd343') def startTest(testList):
# data = Tester.ShadowsocksR(1081, 'dnomd343') for field in testList:
# for field in data:
# print(field['proxyInfo'])
# print(field['serverCommand'])
# print('')
for field in data:
serverProcess = subprocess.Popen( serverProcess = subprocess.Popen(
field['serverCommand'], field['serverCommand'],
stdout = subprocess.DEVNULL, stdout = subprocess.DEVNULL,
@ -39,3 +34,18 @@ for field in data:
serverProcess.terminate() # 关闭服务端 serverProcess.terminate() # 关闭服务端
time.sleep(0.1) time.sleep(0.1)
print() print()
if len(sys.argv) <= 1:
print("no param")
sys.exit(0)
testName = sys.argv[1]
if testName == 'ss':
testList = Tester.Shadowsocks(defaultPort, defaultPasswd)
elif testName == 'ssr':
testList = Tester.ShadowsocksR(defaultPort, defaultPasswd)
else:
print("unknown test name")
sys.exit(1)
startTest(testList)

1
test/ShadowsocksR.py

@ -1,7 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
ssrMethodList = [ ssrMethodList = [
"aes-128-cfb", "aes-128-cfb",
"aes-192-cfb", "aes-192-cfb",

2
test/docker/shadowsocks.py

@ -1,4 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding:utf-8 -*-
method_list = { method_list = {
"ss-python": [ "ss-python": [
"aes-128-gcm", "aes-128-gcm",

3
test/docker/shadowsocksr.py

@ -1,3 +1,6 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
method_list = [ method_list = [
"aes-128-cfb", "aes-128-cfb",
"aes-192-cfb", "aes-192-cfb",

1
test/docker/sip003.py

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding:utf-8 -*-
testHost = "dns.343.re" testHost = "dns.343.re"
testCert = "/etc/ssl/certs/dns.343.re/certificate.crt" testCert = "/etc/ssl/certs/dns.343.re/certificate.crt"

Loading…
Cancel
Save