mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-22 15:23:08 +01:00
python test script fixed
This commit is contained in:
parent
bfd76ff76a
commit
dcd82f9893
@ -19,21 +19,18 @@ 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 = fdfile.read()
|
text = os.read(fd, 65535)
|
||||||
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
|
||||||
fdfile.write(text)
|
os.write(fd,text)
|
||||||
fdfile.flush()
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
tr = threading.Thread(target = read_loop, args=(pr,))
|
tr = threading.Thread(target = read_loop, args=(pr,))
|
||||||
@ -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,21 +19,18 @@ 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 = fdfile.read()
|
text = os.read(fd, 65535)
|
||||||
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
|
||||||
fdfile.write(text)
|
os.write(fd,text)
|
||||||
fdfile.flush()
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
tr = threading.Thread(target = read_loop, args=(er,))
|
tr = threading.Thread(target = read_loop, args=(er,))
|
||||||
|
@ -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