我正在尝试将烧瓶应用程序部署为 .onion 站点。我正在使用茎。我已经阅读了很多教程,但仍然出现了这个错误:
stem.SocketError: [Errno 111] 连接被拒绝
我已经配置了 torrc,并且我已经更改了 Tor 隐藏服务的密码。我什至尝试调整代码顺序(无济于事。)。有谁知道出了什么问题?
这是代码(这是教程的原件(我已经尝试过没有自己的东西。)):
from stem.control import Controller
from flask import Flask
if __name__ == "__main__":
app = Flask("example")
port = 5000
host = "127.0.0.1"
hidden_svc_dir = "c:/temp/"
@app.route('/')
def index():
return "<h1>Tor works!</h1>"
print (" * Getting controller")
controller = Controller.from_port(address="127.0.0.1", port=9151)
try:
controller.authenticate(password="my_password")
controller.set_options([
("HiddenServiceDir", hidden_svc_dir),
("HiddenServicePort", "80 %s:%s" % (host, str(port)))
])
svc_name = open(hidden_svc_dir + "/hostname", "r").read().strip()
print (" * Created host: %s" % svc_name)
except Exception as e:
print (e)
app.run()