-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d967595
commit a4df3c2
Showing
7 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
laddr=127.0.0.1 | ||
lport=1081 | ||
sport=8888 | ||
|
||
if which ssserver; then | ||
sslocal=sslocal | ||
ssserver=ssserver | ||
else | ||
curl -L https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.18.2/shadowsocks-v1.18.2.x86_64-unknown-linux-musl.tar.xz -O | ||
tar xf shadowsocks-v1.18.2.x86_64-unknown-linux-musl.tar.xz | ||
sslocal=./sslocal | ||
ssserver=./ssserver | ||
fi | ||
|
||
python3 ../testcase/udp-echo-server.py & | ||
echo_server_pid=$! | ||
|
||
$ssserver -c ../testcase/sip003u-server.json & | ||
spid=$! | ||
|
||
function cleanup() { | ||
kill $echo_server_pid $lpid $spid | ||
rm -rf o.* | ||
} | ||
|
||
trap cleanup SIGINT SIGTERM ERR EXIT | ||
|
||
echo wss-proxy udp client - ss | ||
$sslocal -c ../testcase/sip003u-client-ss.json & | ||
lpid=$! | ||
sleep 1 | ||
if ! python3 ../testcase/check-udp.py; then | ||
exit 1 | ||
fi | ||
|
||
kill $lpid | ||
|
||
echo wss-proxy udp client - wss | ||
$sslocal -c ../testcase/sip003u-client-ws.json & | ||
lpid=$! | ||
sleep 1 | ||
if ! python3 ../testcase/check-udp.py; then | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import socket | ||
import socks | ||
|
||
if __name__ == '__main__': | ||
for x in range(4): | ||
sock = socks.socksocket(socket.AF_INET, socket.SOCK_DGRAM) | ||
sock.set_proxy(socks.SOCKS5, "localhost", 1081) | ||
for y in range(65): | ||
data = ("deadbeef_%d_%d" % (x, y)) | ||
data += 'c' * (1024 * y - len(data)) | ||
req = data.encode('utf8') | ||
try: | ||
sock.sendto(req, ("127.0.0.1", 1235)) | ||
except OSError: | ||
break | ||
(res, addr) = sock.recvfrom(65535) | ||
print("round %d_%d, length: %d" % (x, y, len(data))) | ||
if req != res: | ||
raise ValueError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"local_address": "127.0.0.1", | ||
"local_port": 1081, | ||
"method": "chacha20-ietf-poly1305", | ||
"mode": "tcp_and_udp", | ||
"password": "sip003u", | ||
"plugin": "./wss-proxy-client", | ||
"plugin_mode": "tcp_and_udp", | ||
"plugin_opts": "mux=0;ws=0;loglevel=debug", | ||
"server": "127.0.0.1", | ||
"server_port": 8888, | ||
"timeout": 60 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"local_address": "127.0.0.1", | ||
"local_port": 1081, | ||
"method": "chacha20-ietf-poly1305", | ||
"mode": "tcp_and_udp", | ||
"password": "sip003u", | ||
"plugin": "./wss-proxy-client", | ||
"plugin_mode": "tcp_and_udp", | ||
"plugin_opts": "mux=0;loglevel=debug", | ||
"server": "127.0.0.1", | ||
"server_port": 8888, | ||
"timeout": 60 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"method": "chacha20-ietf-poly1305", | ||
"mode": "tcp_and_udp", | ||
"password": "sip003u", | ||
"plugin": "./wss-proxy-server", | ||
"plugin_mode": "tcp_and_udp", | ||
"plugin_opts": "mux=0;loglevel=debug", | ||
"server": "127.0.0.1", | ||
"server_port": 8888, | ||
"timeout": 60 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import socket | ||
import sys | ||
|
||
host = '127.0.0.1' | ||
port = int(len(sys.argv) > 1 and sys.argv or '1235') | ||
|
||
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
|
||
server_socket.bind((host, port)) | ||
|
||
while True: | ||
data, addr = server_socket.recvfrom(65535) | ||
print("received %d bytes" % len(data)) | ||
server_socket.sendto(data, addr) |