Developing server, added run options, broadcasting encrypted works
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import sys
|
||||
import click
|
||||
|
||||
from dragonion_server.modules.server import run
|
||||
from dragonion_server.modules.server import run, run_without_onion, integrate_onion
|
||||
from dragonion_server.common import console
|
||||
|
||||
|
||||
@@ -24,14 +25,39 @@ class ServiceRunCommand(click.Command):
|
||||
prompt_required=False,
|
||||
type=int,
|
||||
help='Port to start service on'
|
||||
),
|
||||
click.Option(
|
||||
('--without-tor', '-wt'),
|
||||
is_flag=True,
|
||||
help='Run service without tor'
|
||||
),
|
||||
click.Option(
|
||||
('--only-tor', '-ot'),
|
||||
is_flag=True,
|
||||
help='Run only tor proxy to service'
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def callback(name: str, port: int | None):
|
||||
def callback(name: str, port: int | None, without_tor: bool, only_tor: bool):
|
||||
try:
|
||||
run(name, port)
|
||||
if without_tor and only_tor:
|
||||
print('Cannot run only tor without tor, exiting')
|
||||
sys.exit(1)
|
||||
elif without_tor:
|
||||
run_without_onion(name, port)
|
||||
elif only_tor:
|
||||
if port is None:
|
||||
print('For this mode, you need to specify port, '
|
||||
'to which requests will be redirected. Cannot start '
|
||||
'tor service, exiting')
|
||||
sys.exit(1)
|
||||
onion = integrate_onion(port, name)
|
||||
input('Press Enter to stop onion and service...')
|
||||
onion.cleanup()
|
||||
else:
|
||||
run(name, port)
|
||||
except Exception as e:
|
||||
assert e
|
||||
console.print_exception(show_locals=True)
|
||||
|
||||
Reference in New Issue
Block a user