mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-21 22:39:08 +00:00
Add very basic and dirty iperf test
This commit is contained in:
parent
980ae0172e
commit
286ce0ca6d
2 changed files with 63 additions and 0 deletions
24
tests/iperf/dante.conf
Normal file
24
tests/iperf/dante.conf
Normal file
|
@ -0,0 +1,24 @@
|
|||
# logoutput: /var/log/socks.log
|
||||
internal: 10.0.0.3
|
||||
external: 10.0.0.3
|
||||
clientmethod: none
|
||||
socksmethod: none
|
||||
user.privileged: root
|
||||
user.notprivileged: nobody
|
||||
|
||||
client pass {
|
||||
from: 0/0 to: 0/0
|
||||
log: error connect disconnect
|
||||
}
|
||||
|
||||
socks pass {
|
||||
from: 0/0 to: 0/0
|
||||
command: bind connect udpassociate
|
||||
log: error connect disconnect
|
||||
socksmethod: none
|
||||
}
|
||||
|
||||
socks pass {
|
||||
from: 0.0.0.0/0 to: 0.0.0.0/0
|
||||
command: bindreply udpreply
|
||||
}
|
39
tests/iperf/test.sh
Executable file
39
tests/iperf/test.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
netns="test"
|
||||
dante="sockd"
|
||||
tun2proxy="../../target/release/tun2proxy"
|
||||
|
||||
ip netns add "$netns"
|
||||
|
||||
ip link add veth0 type veth peer name veth0 netns "$netns"
|
||||
|
||||
# Configure veth0 in default ns
|
||||
ip addr add 10.0.0.2/24 dev veth0
|
||||
ip link set dev veth0 up
|
||||
|
||||
# Configure veth0 in child ns
|
||||
ip netns exec "$netns" ip addr add 10.0.0.3/24 dev veth0
|
||||
ip netns exec "$netns" ip addr add 10.0.0.4/24 dev veth0
|
||||
ip netns exec "$netns" ip link set dev veth0 up
|
||||
|
||||
# Configure lo interface in child ns
|
||||
ip netns exec "$netns" ip addr add 127.0.0.1/8 dev lo
|
||||
ip netns exec "$netns" ip link set dev lo up
|
||||
|
||||
echo "Starting Dante in background ..."
|
||||
ip netns exec "$netns" "$dante" -f dante.conf &
|
||||
|
||||
# Start iperf server in netns
|
||||
ip netns exec "$netns" iperf -s -B 10.0.0.4 &
|
||||
|
||||
sleep 1
|
||||
|
||||
# Prepare tun2proxy
|
||||
ip tuntap add name tun0 mode tun
|
||||
ip link set tun0 up
|
||||
ip route add 10.0.0.4 dev tun0
|
||||
"$tun2proxy" --proxy socks5://10.0.0.3:1080 &
|
||||
|
||||
# Run iperf client through tun2proxy
|
||||
iperf -c 10.0.0.4
|
||||
|
||||
iperf -c 10.0.0.4 -R
|
Loading…
Add table
Reference in a new issue