mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 05:30:17 +00:00
Compare commits
9 Commits
4b34c9c10b
...
8be98dd5e7
Author | SHA1 | Date | |
---|---|---|---|
|
8be98dd5e7 | ||
|
04925d8004 | ||
|
4284084fef | ||
|
63ad2afe3f | ||
|
61712d322a | ||
|
3599066356 | ||
|
18c2a38b97 | ||
|
f55004a574 | ||
|
1768ddc459 |
@ -200,7 +200,9 @@ class TCPClientInterface(Interface):
|
|||||||
if initial:
|
if initial:
|
||||||
RNS.log("Establishing TCP connection for "+str(self)+"...", RNS.LOG_DEBUG)
|
RNS.log("Establishing TCP connection for "+str(self)+"...", RNS.LOG_DEBUG)
|
||||||
|
|
||||||
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
addrInfo=socket.getaddrinfo(self.target_ip, self.target_port)
|
||||||
|
addrFam=addrInfo[0]
|
||||||
|
self.socket = socket.socket(addrFam, socket.SOCK_STREAM)
|
||||||
self.socket.settimeout(TCPClientInterface.INITIAL_CONNECT_TIMEOUT)
|
self.socket.settimeout(TCPClientInterface.INITIAL_CONNECT_TIMEOUT)
|
||||||
self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||||
self.socket.connect((self.target_ip, self.target_port))
|
self.socket.connect((self.target_ip, self.target_port))
|
||||||
@ -412,6 +414,11 @@ class TCPServerInterface(Interface):
|
|||||||
def get_address_for_if(name):
|
def get_address_for_if(name):
|
||||||
import RNS.vendor.ifaddr.niwrapper as netinfo
|
import RNS.vendor.ifaddr.niwrapper as netinfo
|
||||||
ifaddr = netinfo.ifaddresses(name)
|
ifaddr = netinfo.ifaddresses(name)
|
||||||
|
|
||||||
|
# IPv6 preference (if present)
|
||||||
|
if(netinfo.AF_INET6 in ifaddr):
|
||||||
|
return ifaddr[netinfo.AF_INET6][0]["addr"]
|
||||||
|
|
||||||
return ifaddr[netinfo.AF_INET][0]["addr"]
|
return ifaddr[netinfo.AF_INET][0]["addr"]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user