我想知道是否有任何方法可以隐藏python套接字服务器ip(使用tor或代理)。
我知道您可以通过tor发出客户端请求,但我希望能够连接到服务器而不必知道他的真实IP地址(例如,.onion地址)
将可以访问该代码,因此对IP进行加密可能不是解决方案。
我现在的服务器代码:
import socket
s = socket.socket()
host = "192.168.1.1"
port = 9999
print(f"server will start on host:{host}")
s.bind((host, port))
print("Server is bond !")
s.listen(1)
client, address = s.accept()
print(address, "connected")
我的客户代码:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = '192.168.1.18'# ip address of the server (that I would like to hide)
port = 80
try:
s.connect((host, port))
print("connected !")
except:
print("error !")