mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-25 16:53:19 +01:00
python test script fixed
This commit is contained in:
parent
bfd76ff76a
commit
dcd82f9893
@ -19,22 +19,19 @@ def signal_handler(sig, frame):
|
|||||||
|
|
||||||
def read_loop(fd):
|
def read_loop(fd):
|
||||||
print("Main Start read fd:",fd)
|
print("Main Start read fd:",fd)
|
||||||
with os.fdopen(fd, 'rb') as fdfile:
|
while True:
|
||||||
while True:
|
text = os.read(fd, 65535)
|
||||||
text = fdfile.read()
|
if len(text) == 0:
|
||||||
if len(text) == 0:
|
print("EOF!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||||
print("EOF!!!!!!!!!!!!!!!!!!!!!!!!")
|
break
|
||||||
break
|
print("Main: RECEIVED:",text)
|
||||||
print("Main: RECEIVED:",text)
|
|
||||||
|
|
||||||
def write_loop(fd):
|
def write_loop(fd):
|
||||||
with os.fdopen(fd, 'wb') as fdfile:
|
while True:
|
||||||
while True:
|
print("Main Write fd:",fd)
|
||||||
print("Main Write fd:",fd)
|
text = b'\xff\xff\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xaa\xaa' + b'm'*88
|
||||||
text = b'\xff\xff\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xaa\xaa' + b'm'*88
|
os.write(fd,text)
|
||||||
fdfile.write(text)
|
time.sleep(1)
|
||||||
fdfile.flush()
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
tr = threading.Thread(target = read_loop, args=(pr,))
|
tr = threading.Thread(target = read_loop, args=(pr,))
|
||||||
tr.start()
|
tr.start()
|
||||||
@ -48,8 +45,8 @@ os.environ["EG_FD_TX"] = str(ew)
|
|||||||
print(str(er), str(ew))
|
print(str(er), str(ew))
|
||||||
|
|
||||||
#p = subprocess.Popen('./etherguard-go -config example_config/super_mode/n1_fd.yaml -mode edge'.split(" "),pass_fds=[er,ew])
|
#p = subprocess.Popen('./etherguard-go -config example_config/super_mode/n1_fd.yaml -mode edge'.split(" "),pass_fds=[er,ew])
|
||||||
#p = subprocess.Popen('python3 example_config/super_mode/n1_test_fd_mode2.py'.split(" "),pass_fds=[er,ew])
|
p = subprocess.Popen('python3 example_config/super_mode/n1_test_fd_mode2.py'.split(" "),pass_fds=[er,ew])
|
||||||
p = subprocess.Popen('example_config/super_mode/n1_test_fd_mode2'.split(" "),pass_fds=[er,ew])
|
#p = subprocess.Popen('example_config/super_mode/n1_test_fd_mode2'.split(" "),pass_fds=[er,ew])
|
||||||
|
|
||||||
os.close(er)
|
os.close(er)
|
||||||
os.close(ew)
|
os.close(ew)
|
||||||
|
@ -19,22 +19,19 @@ def signal_handler(sig, frame):
|
|||||||
|
|
||||||
def read_loop(fd):
|
def read_loop(fd):
|
||||||
print("Sub: Start read fd:",fd)
|
print("Sub: Start read fd:",fd)
|
||||||
with os.fdopen(fd, 'rb') as fdfile:
|
while True:
|
||||||
while True:
|
text = os.read(fd, 65535)
|
||||||
text = fdfile.read()
|
if len(text) == 0:
|
||||||
if len(text) == 0:
|
print("EOF!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||||
print("EOF!!!!!!!!!!!!!!!!!!!!!!!!")
|
break
|
||||||
break
|
print("Sub RECEIVED:",text)
|
||||||
print("Sub RECEIVED:",text)
|
|
||||||
|
|
||||||
def write_loop(fd):
|
def write_loop(fd):
|
||||||
with os.fdopen(fd, 'wb') as fdfile:
|
while True:
|
||||||
while True:
|
print("Sub: Write fd:",fd)
|
||||||
print("Sub: Write fd:",fd)
|
text = b'\xff\xff\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xaa\xaa' + b's'*88
|
||||||
text = b'\xff\xff\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xaa\xaa' + b's'*88
|
os.write(fd,text)
|
||||||
fdfile.write(text)
|
time.sleep(1)
|
||||||
fdfile.flush()
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
tr = threading.Thread(target = read_loop, args=(er,))
|
tr = threading.Thread(target = read_loop, args=(er,))
|
||||||
tr.start()
|
tr.start()
|
||||||
|
@ -53,6 +53,9 @@ func CreateSockTAP(iconfig config.InterfaceConf, protocol string, NodeID config.
|
|||||||
if iconfig.SendAddr != "" {
|
if iconfig.SendAddr != "" {
|
||||||
client, err := net.Dial(protocol, iconfig.SendAddr)
|
client, err := net.Dial(protocol, iconfig.SendAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if tap.server != nil {
|
||||||
|
(*tap.server).Close()
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
tap.connTx = &client
|
tap.connTx = &client
|
||||||
|
Loading…
Reference in New Issue
Block a user