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 socket
import requests
@ -28,10 +31,6 @@ testInfo = {
}
print("start")
print(dir(Builder))
print(dir(Checker))
print(testInfo)
task = Builder.build(testInfo, '/tmp/ProxyC')
print(task)
@ -40,7 +39,7 @@ if Builder.check(task) == False:
print("error exit")
Builder.destroy(task)
else:
print("test with gstatic")
print("http check")
health, delay = Checker.httpCheck(task['port'])
print("health = " + str(health))
if delay < 0:
@ -48,4 +47,4 @@ else:
else:
print("delay = " + format(delay, '.2f') + 'ms')
Builder.destroy(task)
print("stop")
print("done")

30
test.py

@ -1,6 +1,7 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import sys
import time
import subprocess
@ -8,17 +9,11 @@ import test as Tester
import ProxyBuilder as Builder
import ProxyChecker as Checker
# print(dir(Tester))
defaultPort = 10808
defaultPasswd = 'dnomd343'
data = Tester.Shadowsocks(1081, 'dnomd343')
# data = Tester.ShadowsocksR(1081, 'dnomd343')
# for field in data:
# print(field['proxyInfo'])
# print(field['serverCommand'])
# print('')
for field in data:
def startTest(testList):
for field in testList:
serverProcess = subprocess.Popen(
field['serverCommand'],
stdout = subprocess.DEVNULL,
@ -39,3 +34,18 @@ for field in data:
serverProcess.terminate() # 关闭服务端
time.sleep(0.1)
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
# -*- coding:utf-8 -*-
ssrMethodList = [
"aes-128-cfb",
"aes-192-cfb",

2
test/docker/shadowsocks.py

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

3
test/docker/shadowsocksr.py

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

1
test/docker/sip003.py

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

Loading…
Cancel
Save