server: add --signal-error CLI argument
This commit is contained in:
parent
a4ce663c31
commit
a2b88dbf61
|
@ -24,6 +24,8 @@ sp_start.add_argument("--transit", default="tcp:3001", metavar="tcp:PORT",
|
|||
help="endpoint specification for the transit-relay port")
|
||||
sp_start.add_argument("--advertise-version", metavar="VERSION",
|
||||
help="version to recommend to clients")
|
||||
sp_start.add_argument("--signal-error", metavar="ERROR",
|
||||
help="force all clients to fail with a message")
|
||||
sp_start.add_argument("--blur-usage", default=None, type=int,
|
||||
metavar="SECONDS",
|
||||
help="round logged access times to improve privacy")
|
||||
|
|
|
@ -13,7 +13,9 @@ class MyPlugin:
|
|||
from .server import RelayServer
|
||||
return RelayServer(self.args.rendezvous, self.args.transit,
|
||||
self.args.advertise_version,
|
||||
"relay.sqlite", self.args.blur_usage)
|
||||
"relay.sqlite", self.args.blur_usage,
|
||||
signal_error=self.args.signal_error,
|
||||
)
|
||||
|
||||
class MyTwistdConfig(twistd.ServerOptions):
|
||||
subCommands = [("XYZ", None, usage.Options, "node")]
|
||||
|
|
|
@ -26,7 +26,8 @@ class PrivacyEnhancedSite(server.Site):
|
|||
|
||||
class RelayServer(service.MultiService):
|
||||
def __init__(self, rendezvous_web_port, transit_port,
|
||||
advertise_version, db_url=":memory:", blur_usage=None):
|
||||
advertise_version, db_url=":memory:", blur_usage=None,
|
||||
signal_error=None):
|
||||
service.MultiService.__init__(self)
|
||||
self._blur_usage = blur_usage
|
||||
|
||||
|
@ -42,6 +43,8 @@ class RelayServer(service.MultiService):
|
|||
}
|
||||
if advertise_version:
|
||||
welcome["current_version"] = advertise_version
|
||||
if signal_error:
|
||||
welcome["error"] = signal_error
|
||||
|
||||
rendezvous = Rendezvous(db, welcome, blur_usage)
|
||||
rendezvous.setServiceParent(self) # for the pruning timer
|
||||
|
|
Loading…
Reference in New Issue
Block a user